Instructions to use keras/dinov2_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/dinov2_base with KerasHub:
import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/dinov2_base") - Keras
How to use keras/dinov2_base 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://keras/dinov2_base") - Notebooks
- Google Colab
- Kaggle
Download config.json from keras/dinov2_base: direct link, hf CLI and curl.
- Browser
- Download file 781 Bytes
-
https://huggingface.co/keras/dinov2_base/resolve/main/config.json
- Command line
-
hf download hf://keras/dinov2_base/config.json
-
curl -L -o config.json https://huggingface.co/keras/dinov2_base/resolve/main/config.json
781 Bytes
| { | |
| "module": "keras_hub.src.models.dinov2.dinov2_backbone", | |
| "class_name": "DINOV2Backbone", | |
| "config": { | |
| "name": "dinov2_backbone", | |
| "trainable": true, | |
| "patch_size": 14, | |
| "num_layers": 12, | |
| "hidden_dim": 768, | |
| "num_heads": 12, | |
| "intermediate_dim": 3072, | |
| "layer_scale_init_value": 1.0, | |
| "num_register_tokens": 0, | |
| "use_mask_token": true, | |
| "use_swiglu_ffn": false, | |
| "dropout_rate": 0.0, | |
| "drop_path_rate": 0.0, | |
| "image_shape": [ | |
| 518, | |
| 518, | |
| 3 | |
| ], | |
| "position_embedding_shape": [ | |
| 518, | |
| 518 | |
| ], | |
| "antialias_in_interpolation": false | |
| }, | |
| "registered_name": "keras_hub>DINOV2Backbone" | |
| } |