Zero-Shot Object Detection
ZeroModels
Keras
PyTorch
JAX
TensorFlow
owlvit
open-vocabulary
object-detection
Instructions to use zeromodels/owlvit-base-patch32 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/owlvit-base-patch32 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/owlvit-base-patch32") - Keras
How to use zeromodels/owlvit-base-patch32 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/owlvit-base-patch32") - Notebooks
- Google Colab
- Kaggle
Upgrade kf_config.json to v2 (nested config + dtype)
Browse files- kf_config.json +19 -13
kf_config.json
CHANGED
|
@@ -1,23 +1,29 @@
|
|
| 1 |
{
|
| 2 |
"library_name": "kerasformers",
|
| 3 |
-
"kerasformers_version": "1.
|
| 4 |
"model_module": "kerasformers.models.owlvit",
|
| 5 |
"model_class": "OwlViTDetect",
|
| 6 |
"variant": "owlvit-base-patch32",
|
| 7 |
"weights": "model.weights.h5",
|
|
|
|
|
|
|
| 8 |
"model_type": "owlvit",
|
| 9 |
-
"
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
"projection_dim": 512,
|
| 19 |
-
"text_num_layers": 12,
|
| 20 |
-
"text_max_position_embeddings": 16,
|
| 21 |
-
"text_vocab_size": 49408,
|
| 22 |
"image_size": null
|
| 23 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"library_name": "kerasformers",
|
| 3 |
+
"kerasformers_version": "1.2.1",
|
| 4 |
"model_module": "kerasformers.models.owlvit",
|
| 5 |
"model_class": "OwlViTDetect",
|
| 6 |
"variant": "owlvit-base-patch32",
|
| 7 |
"weights": "model.weights.h5",
|
| 8 |
+
"schema_version": 2,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
"model_type": "owlvit",
|
| 11 |
+
"text_config": {
|
| 12 |
+
"hidden_dim": 512,
|
| 13 |
+
"intermediate_size": 2048,
|
| 14 |
+
"num_heads": 8,
|
| 15 |
+
"num_layers": 12,
|
| 16 |
+
"max_position_embeddings": 16,
|
| 17 |
+
"vocab_size": 49408
|
| 18 |
+
},
|
| 19 |
+
"vision_config": {
|
| 20 |
+
"image_size": 768,
|
| 21 |
+
"patch_size": 32,
|
| 22 |
+
"hidden_dim": 768,
|
| 23 |
+
"intermediate_size": 3072,
|
| 24 |
+
"num_layers": 12,
|
| 25 |
+
"num_heads": 12
|
| 26 |
+
},
|
| 27 |
"projection_dim": 512,
|
|
|
|
|
|
|
|
|
|
| 28 |
"image_size": null
|
| 29 |
}
|