Instructions to use facebook/metaclip-2-worldwide-m16-384 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/metaclip-2-worldwide-m16-384 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="facebook/metaclip-2-worldwide-m16-384") pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# Load model directly from transformers import AutoProcessor, AutoModelForZeroShotImageClassification processor = AutoProcessor.from_pretrained("facebook/metaclip-2-worldwide-m16-384") model = AutoModelForZeroShotImageClassification.from_pretrained("facebook/metaclip-2-worldwide-m16-384", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| { | |
| "architectures": [ | |
| "MetaClip2Model" | |
| ], | |
| "dtype": "float32", | |
| "initializer_factor": 1.0, | |
| "logit_scale_init_value": 2.6592, | |
| "model_type": "metaclip_2", | |
| "projection_dim": 512, | |
| "text_config": { | |
| "attention_dropout": 0.0, | |
| "eos_token_id": 2, | |
| "hidden_act": "gelu", | |
| "hidden_size": 512, | |
| "initializer_factor": 1.0, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2048, | |
| "layer_norm_eps": 1e-05, | |
| "max_position_embeddings": 77, | |
| "model_type": "metaclip_2_text_model", | |
| "num_attention_heads": 8, | |
| "num_hidden_layers": 12, | |
| "projection_dim": 512, | |
| "vocab_size": 901629 | |
| }, | |
| "transformers_version": "4.57.1", | |
| "vision_config": { | |
| "attention_dropout": 0.0, | |
| "hidden_act": "gelu", | |
| "hidden_size": 512, | |
| "image_size": 384, | |
| "initializer_factor": 1.0, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2048, | |
| "layer_norm_eps": 1e-05, | |
| "model_type": "metaclip_2_vision_model", | |
| "num_attention_heads": 8, | |
| "num_channels": 3, | |
| "num_hidden_layers": 12, | |
| "patch_size": 16, | |
| "projection_dim": 512 | |
| } | |
| } | |