Instructions to use Weidows/WeMM-Embedding-9B-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Weidows/WeMM-Embedding-9B-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Weidows/WeMM-Embedding-9B-FP8", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Weidows/WeMM-Embedding-9B-FP8", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("Weidows/WeMM-Embedding-9B-FP8", trust_remote_code=True, device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Weidows/WeMM-Embedding-9B-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Weidows/WeMM-Embedding-9B-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Weidows/WeMM-Embedding-9B-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Weidows/WeMM-Embedding-9B-FP8
- SGLang
How to use Weidows/WeMM-Embedding-9B-FP8 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Weidows/WeMM-Embedding-9B-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Weidows/WeMM-Embedding-9B-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Weidows/WeMM-Embedding-9B-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Weidows/WeMM-Embedding-9B-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Weidows/WeMM-Embedding-9B-FP8 with Docker Model Runner:
docker model run hf.co/Weidows/WeMM-Embedding-9B-FP8
WeMM-Embedding-9B (FP8)
FP8 (E4M3) quantization of tencent/WeMM-Embedding-9B, produced with the same per-tensor round-to-nearest procedure used for the 2B variant.
- Method: per-tensor FP8 (E4M3,
scale = absmax/448), applied to allnn.Linearlayers — including the vision tower at 8-bit (safe). 4-bit vision-tower quantization is known to degrade multimodal retrieval, so it is intentionally avoided. - Size: 18.8 GB (BF16) → 9.8 GB (FP8), ~2× smaller, near-lossless on retrieval benchmarks.
- Format:
model.fp8.safetensors+fp8_scales.json(dequant at load:w = w_fp8 * scale). Loads withtransformers/sentence-transformersusing the same API as the BF16 base.
Why FP8 (not 4-bit)
The 9B model's multimodal quality is sensitive to vision-tower precision. FP8 (8-bit) keeps the vision tower well above the degradation threshold observed with 4-bit, while still halving weight memory — ideal for serving on FP8-capable GPUs (Ada / Hopper, e.g. RTX 4090, H100).
Usage (transformers / sentence-transformers)
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Weidows/WeMM-Embedding-9B-FP8", trust_remote_code=True)
emb = model.encode("Represent the meaning of this sentence.")
Usage (vLLM / SGLang)
FP8 is natively supported on Ada/Hopper GPUs. Serve with vLLM:
vllm serve Weidows/WeMM-Embedding-9B-FP8 --task embed
Evaluation
Quantized and evaluated with the identical per-tensor FP8 (E4M3) pipeline used for the 2B variant, on the same engine (transformers) as the BF16 baseline to isolate pure quantization loss.
| Metric | BF16 | FP8 | Δ |
|---|---|---|---|
| STS-B (text) — Spearman ρ | 0.8225 | 0.8239 | −0.0014 |
| COCO Image→Text R@1 / R@5 / R@10 | 0.1968 / 0.9002 / 0.9840 | 0.1978 / 0.9012 / 0.9850 | ~−0.001 |
| COCO Text→Image R@1 / R@5 / R@10 | 0.9331 / 0.9960 / 0.9980 | 0.9311 / 0.9960 / 0.9980 | ~+0.002 |
COCO split: val2017, 200 images × 5 captions = 1001 captions (hard pool — random baseline ≈0.5% R@1). Every metric moves <0.002 absolute; FP8 rounding is benign at the 9B scale. Weight size: 18.8 GB → 9.8 GB (~2× compression), vision tower kept at 8-bit to avoid the 4-bit degradation path.
- Downloads last month
- -