Instructions to use zeromodels/sam_vit_large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/sam_vit_large with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/sam_vit_large") - Keras
How to use zeromodels/sam_vit_large with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://zeromodels/sam_vit_large") - Notebooks
- Google Colab
- Kaggle
Upgrade kf_config.json to v2 (nested config + dtype)
Browse files- kf_config.json +20 -16
kf_config.json
CHANGED
|
@@ -1,24 +1,28 @@
|
|
| 1 |
{
|
| 2 |
"library_name": "kerasformers",
|
| 3 |
-
"kerasformers_version": "1.
|
| 4 |
"model_module": "kerasformers.models.sam",
|
| 5 |
"model_class": "SAMPromptableSegment",
|
| 6 |
"variant": "sam_vit_large",
|
| 7 |
"weights": "model.weights.h5",
|
|
|
|
|
|
|
| 8 |
"model_type": "sam",
|
| 9 |
-
"
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"library_name": "kerasformers",
|
| 3 |
+
"kerasformers_version": "1.2.1",
|
| 4 |
"model_module": "kerasformers.models.sam",
|
| 5 |
"model_class": "SAMPromptableSegment",
|
| 6 |
"variant": "sam_vit_large",
|
| 7 |
"weights": "model.weights.h5",
|
| 8 |
+
"schema_version": 2,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
"model_type": "sam",
|
| 11 |
+
"vision_config": {
|
| 12 |
+
"vision_hidden_size": 1024,
|
| 13 |
+
"vision_num_hidden_layers": 24,
|
| 14 |
+
"vision_num_attention_heads": 16,
|
| 15 |
+
"vision_mlp_dim": 4096,
|
| 16 |
+
"vision_global_attn_indexes": [
|
| 17 |
+
5,
|
| 18 |
+
11,
|
| 19 |
+
17,
|
| 20 |
+
23
|
| 21 |
+
],
|
| 22 |
+
"num_multimask_outputs": 3,
|
| 23 |
+
"multimask_output": true,
|
| 24 |
+
"enable_boxes": false,
|
| 25 |
+
"enable_masks": false,
|
| 26 |
+
"image_size": 1024
|
| 27 |
+
}
|
| 28 |
}
|