Instructions to use keras/clip_vit_base_patch16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/clip_vit_base_patch16 with KerasHub:
import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/clip_vit_base_patch16") - Keras
How to use keras/clip_vit_base_patch16 with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://keras/clip_vit_base_patch16") - Notebooks
- Google Colab
- Kaggle
| { | |
| "module": "keras_hub.src.models.clip.clip_backbone", | |
| "class_name": "CLIPBackbone", | |
| "config": { | |
| "name": "clip_backbone", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "vision_encoder": { | |
| "module": "keras_hub.src.models.clip.clip_vision_encoder", | |
| "class_name": "CLIPVisionEncoder", | |
| "config": { | |
| "name": "clip_vision_encoder", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "patch_size": 16, | |
| "hidden_dim": 768, | |
| "num_layers": 12, | |
| "num_heads": 12, | |
| "intermediate_dim": 3072, | |
| "intermediate_activation": "quick_gelu", | |
| "intermediate_output_index": null, | |
| "image_shape": [ | |
| 224, | |
| 224, | |
| 3 | |
| ] | |
| }, | |
| "registered_name": "keras_hub>CLIPVisionEncoder" | |
| }, | |
| "text_encoder": { | |
| "module": "keras_hub.src.models.clip.clip_text_encoder", | |
| "class_name": "CLIPTextEncoder", | |
| "config": { | |
| "name": "clip_text_encoder", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "vocabulary_size": 49408, | |
| "embedding_dim": 512, | |
| "hidden_dim": 512, | |
| "num_layers": 12, | |
| "num_heads": 8, | |
| "intermediate_dim": 2048, | |
| "intermediate_activation": "quick_gelu", | |
| "intermediate_output_index": null, | |
| "max_sequence_length": 77 | |
| }, | |
| "registered_name": "keras_hub>CLIPTextEncoder" | |
| }, | |
| "projection_dim": 512 | |
| }, | |
| "registered_name": "keras_hub>CLIPBackbone" | |
| } |