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
File size: 2,466 Bytes
b1fd067 9536edc b1fd067 9536edc b1fd067 9536edc b1fd067 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | {
"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"
} |