Instructions to use Weidows/WeMM-Embedding-2B-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Weidows/WeMM-Embedding-2B-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-2B-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-2B-FP8", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("Weidows/WeMM-Embedding-2B-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-2B-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-2B-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-2B-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-2B-FP8
- SGLang
How to use Weidows/WeMM-Embedding-2B-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-2B-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-2B-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-2B-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-2B-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-2B-FP8 with Docker Model Runner:
docker model run hf.co/Weidows/WeMM-Embedding-2B-FP8
WeMM-Embedding-2B — FP8 Quantization
FP8 (8-bit float, E4M3) quantization of tencent/WeMM-Embedding-2B, intended for vLLM / SGLang-class backends with FP8 support (RTX 4090 / Ada and newer have native FP8 tensor cores).
This is a separate repo from the GGUF build — GGUF targets llama.cpp; this FP8 build targets GPU inference servers.
Files
model.fp8.safetensors— weights stored asfloat8_e4m3fn(per-tensor scale).fp8_scales.json— per-layer dequant scale (layer name -> scalar).- Supporting files (config, tokenizer, custom
WeMMEmbeddingmodeling, chat templates) are mirrored from the base model soAutoModelcan load it.
Note: the saved weights are raw fp8 + scale. To run, dequantize at load time (fp8 -> bf16) or serve through a backend that natively consumes fp8. See Usage below.
Evaluation (STS-B, same engine)
All numbers use the same engine (transformers / torch AutoModel) for both the BF16 baseline and the FP8 model, so Δρ is pure FP8 rounding error.
| Model | Bits/Weight | STS-B Spearman ρ | Δρ vs BF16 | Emb Cosine vs BF16 |
|---|---|---|---|---|
| BF16 | 16.00 | 0.8124 | — | — |
| FP8 (manual per-tensor E4M3) | 8.00 | 0.8114 | +0.12% | 0.9987 |
Metrics:
- STS-B Spearman ρ: rank correlation between model cosine similarities and human similarity scores (0-5). Higher is better.
- Δρ vs BF16: relative drop of ρ against the BF16 baseline. Negative = scored slightly above baseline (within noise).
- Emb Cosine vs BF16: mean cosine between each sentence embedding and its BF16 counterpart (space fidelity). 1.0 = identical.
Conclusion: FP8 causes negligible quality loss (Δρ = +0.12%, Emb Cosine = 0.999) on STS-B. This is the recommended format when serving on FP8-capable GPUs.
Usage
Dequantize to bf16 at load time (transformers)
import torch, json, safetensors.torch as st
from transformers import AutoModel, AutoProcessor
sd = st.load_file("model.fp8.safetensors")
scales = json.load(open("fp8_scales.json"))
for k, s in scales.items(): # k like 'model.xxx.weight'
sd[k] = (sd[k].to(torch.float32) * s).to(torch.bfloat16) # dequant
# save a runnable bf16 copy, or load directly:
model = AutoModel.from_pretrained(".", trust_remote_code=True, dtype=torch.bfloat16)
vLLM / SGLang
These backends expect a compressed-tensors / native fp8 checkpoint. The raw fp8+scale layout here is not yet wrapped for direct vLLM loading; repackaging into the backend's fp8 format (or quantizing the base model with the backend's own fp8 path) is required before serving. The quality numbers above already demonstrate the FP8 format itself is near-lossless.
Notes
- FP8 was produced by manual per-tensor fp8 (E4M3) quantization of all 285 Linear layers (including the vision tower).
llmcompressoroneshot did not actually quantize the qwen3_5 custom Linear layers, so the manual path is used for the reported numbers. - The GGUF variants (Q8_0 / Q6_K / Q5_K_M / IQ4_XS / IQ3_M) live in a separate repo.
- Downloads last month
- -