Skip to content

Commit 87a30f1

Browse files
authored
Prep pytorch example (#282)
1 parent 80760dd commit 87a30f1

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

examples/image_segmentation/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Image Segmentation pytorch example.
2+
3+
This is an example of a pytorch model
4+
5+
## Deploy to Baseten
6+
To deploy the model, run the following from the root of the directory
7+
8+
```
9+
import baseten, truss. os
10+
11+
sd = truss.load("./examples/stable-diffusion-2-1")
12+
13+
baseten.login(os.environ["BASETEN_API_KEY"])
14+
15+
baseten.deploy(sd, model_name"My Pytorch Model", publish=True)
16+
```

examples/image_segmentation/model/model.py

-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ def load(self):
2828
self._model = models.segmentation.deeplabv3_resnet101(pretrained=1).eval()
2929
self._device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
3030

31-
def preprocess(self, request: Dict) -> Dict:
32-
return request
33-
34-
def postprocess(self, request: Dict) -> Dict:
35-
return request
36-
3731
def predict(self, request: Dict) -> Dict[str, List]:
3832
return [self._predict_single(instance) for instance in request["instances"]]
3933

0 commit comments

Comments
 (0)