Feature Extraction
Transformers
Safetensors
muse_glimmer
metaencoder
multimodal-embedding
image-text-retrieval
video-retrieval
document-retrieval
Instructions to use facebook/meta-encoder-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/meta-encoder-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="facebook/meta-encoder-v1")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("facebook/meta-encoder-v1") model = AutoModel.from_pretrained("facebook/meta-encoder-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download chat_template.jinja from facebook/meta-encoder-v1: direct link, hf CLI and curl.
- Browser
- Download file 1.61 kB
-
https://huggingface.co/facebook/meta-encoder-v1/resolve/main/chat_template.jinja
- Command line
-
hf download hf://facebook/meta-encoder-v1/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/facebook/meta-encoder-v1/resolve/main/chat_template.jinja
1.61 kB
| {#- | |
| MetaEncoder v1 embedding template: renders one input exactly as the encoder was trained on it. | |
| messages: an optional {"role": "system"} message whose content is the task instruction, then one | |
| {"role": "user"} message holding the input as {"type": "image"} parts followed by an optional | |
| {"type": "text"} part. The embedding is the final hidden state of the closing <|eot|>. | |
| The date line is fixed so an input embeds identically on any day. | |
| -#} | |
| {%- macro render_content(content) -%} | |
| {%- if content is string -%} | |
| {{- content -}} | |
| {%- elif content is not none -%} | |
| {%- for part in content -%} | |
| {%- if part['type'] == 'image' -%} | |
| {{- '<|patch|>' -}} | |
| {%- elif part['type'] == 'text' -%} | |
| {{- part['text'] -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {%- endmacro -%} | |
| {%- set ns = namespace(instruction='') -%} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'system' -%} | |
| {%- set ns.instruction = render_content(message['content']) -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {{- bos_token -}} | |
| {{- '<|start|>system<|message|>You are Meta AI, a friendly AI Assistant.\n\nKnowledge cutoff: 2025-10-26.\n\nCurrent date: 2026-01-01.\n\nRepresent the user\'s input.' -}} | |
| {%- if ns.instruction -%} | |
| {{- '\n\n' + ns.instruction -}} | |
| {%- endif -%} | |
| {{- '\n\n# Valid recipients: "user".<|eot|>' -}} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'user' -%} | |
| {{- '<|start|>user<|message|>' + render_content(message['content']) + '<|eot|>' -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |