Instructions to use aradootle/sam-vit-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aradootle/sam-vit-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("mask-generation", model="aradootle/sam-vit-base")# Load model directly from transformers import AutoProcessor, AutoModelForMaskGeneration processor = AutoProcessor.from_pretrained("aradootle/sam-vit-base") model = AutoModelForMaskGeneration.from_pretrained("aradootle/sam-vit-base") - Notebooks
- Google Colab
- Kaggle
stuff
Browse files- handler.py +1 -0
- requirements.txt +3 -3
handler.py
CHANGED
|
@@ -9,6 +9,7 @@ class EndpointHandler():
|
|
| 9 |
# Preload all the elements you are going to need at inference.
|
| 10 |
model_type = "vit_b"
|
| 11 |
# prefix = "/opt/ml/model"
|
|
|
|
| 12 |
model_path = "models/tf_model.h5"
|
| 13 |
# model_checkpoint_path = os.path.join(prefix, "sam_vit_h_4b8939.pth")
|
| 14 |
sam = sam_model_registry[model_type](checkpoint=model_path)
|
|
|
|
| 9 |
# Preload all the elements you are going to need at inference.
|
| 10 |
model_type = "vit_b"
|
| 11 |
# prefix = "/opt/ml/model"
|
| 12 |
+
print('current working directory', os.getcwd())
|
| 13 |
model_path = "models/tf_model.h5"
|
| 14 |
# model_checkpoint_path = os.path.join(prefix, "sam_vit_h_4b8939.pth")
|
| 15 |
sam = sam_model_registry[model_type](checkpoint=model_path)
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
git+https://github.com/ara-vardanyan/segment-anything.git
|
| 5 |
flask
|
| 6 |
requests
|
|
|
|
| 1 |
+
-f https://download.pytorch.org/whl/cu117/torch_stable.html
|
| 2 |
+
torch
|
| 3 |
+
torchvision
|
| 4 |
git+https://github.com/ara-vardanyan/segment-anything.git
|
| 5 |
flask
|
| 6 |
requests
|