Feature Extraction
Transformers
Safetensors
Chinese
English
qwen3_5
image-text-to-text
multimodal-embedding
text-embedding
image-embedding
video-embedding
mrl
custom_code
Instructions to use tencent/WeMM-Embedding-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/WeMM-Embedding-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="tencent/WeMM-Embedding-9B", trust_remote_code=True)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tencent/WeMM-Embedding-9B", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("tencent/WeMM-Embedding-9B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Integrate with Sentence Transformers, restore training-time tokenization on newer transformers
#1
by tomaarsen HF Staff - opened
Hello @JUNJIE99 @kekekeke @xiaoxiaoshadiao and team!
As a heads up, this PR is AI-generated but human-reviewed.
Pull Request overview
- Integrate WeMM-Embedding-9B with Sentence Transformers v5.7+ via
modules.jsonandtrust_remote_code - Restore the training-time tokenization on
transformersnewer than the pinned 5.2.0
Details
This is the sister PR of the https://huggingface.co/tencent/WeMM-Embedding-2B/discussions/1, with the same changes to transformers and Sentence Transformers integration, but for the 9B model. See that PR description for more details.
You can test the Sentence Transformers integration with the following snippet:
from sentence_transformers import SentenceTransformer
model_id = "tencent/WeMM-Embedding-9B"
model = SentenceTransformer(model_id, trust_remote_code=True)
queries = [
"Which Llama 4 model variants are available?",
"How is mapo tofu prepared?",
]
documents = [
"Mapo tofu is a Sichuan dish of soft tofu simmered in a spicy, numbing sauce of chili bean paste and Sichuan peppercorn.",
{
"image": "https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/llama4_hgf.png",
"text": "Represent this image.",
},
{
"video": "https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/mapo_tofu.mp4",
"text": "Represent this video.",
},
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# (2, 4096) (3, 4096)
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.2153, 0.5843, 0.1221],
# [0.7665, 0.2604, 0.5366]])
To try it before merging, load the PR revision:SentenceTransformer(model_id, revision="refs/pr/1", trust_remote_code=True).
Happy to tweak anything you'd like changed. Please let me know if you have any questions or feedback!
- Tom Aarsen
tomaarsen changed pull request status to open