Image-Text-to-Text
Transformers
Safetensors
gemma4
quantized
fp8
w8a16
conversational
compressed-tensors
Instructions to use hoborific/G4-MeroMero-v2-31B-W8A16-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hoborific/G4-MeroMero-v2-31B-W8A16-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hoborific/G4-MeroMero-v2-31B-W8A16-FP8") 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("hoborific/G4-MeroMero-v2-31B-W8A16-FP8") model = AutoModelForMultimodalLM.from_pretrained("hoborific/G4-MeroMero-v2-31B-W8A16-FP8", 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 hoborific/G4-MeroMero-v2-31B-W8A16-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hoborific/G4-MeroMero-v2-31B-W8A16-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": "hoborific/G4-MeroMero-v2-31B-W8A16-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/hoborific/G4-MeroMero-v2-31B-W8A16-FP8
- SGLang
How to use hoborific/G4-MeroMero-v2-31B-W8A16-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 "hoborific/G4-MeroMero-v2-31B-W8A16-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": "hoborific/G4-MeroMero-v2-31B-W8A16-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 "hoborific/G4-MeroMero-v2-31B-W8A16-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": "hoborific/G4-MeroMero-v2-31B-W8A16-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 hoborific/G4-MeroMero-v2-31B-W8A16-FP8 with Docker Model Runner:
docker model run hf.co/hoborific/G4-MeroMero-v2-31B-W8A16-FP8
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,4 +11,33 @@ tags:
|
|
| 11 |
|
| 12 |
Quantized version of [zerofata/G4-MeroMero-v2-31B](https://huggingface.co/zerofata/G4-MeroMero-v2-31B).
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
| 11 |
|
| 12 |
Quantized version of [zerofata/G4-MeroMero-v2-31B](https://huggingface.co/zerofata/G4-MeroMero-v2-31B).
|
| 13 |
|
| 14 |
+
## Format
|
| 15 |
+
|
| 16 |
+
Offline-quantized **W8A16 FP8** in the
|
| 17 |
+
[compressed-tensors](https://github.com/neuralmagic/compressed-tensors)
|
| 18 |
+
`float-quantized` format: weights in `float8_e4m3fn` with per-output-channel
|
| 19 |
+
symmetric scales, activations kept in bf16/fp16.
|
| 20 |
+
|
| 21 |
+
## How it was quantized
|
| 22 |
+
|
| 23 |
+
For each linear layer, every output row gets its own scale starting from
|
| 24 |
+
`amax / 448`, refined by an MSE clip search over ~9 clip fractions
|
| 25 |
+
(0.8–1.0× amax) picking the lowest-error scale per row. Weights are then
|
| 26 |
+
quantized `q = e4m3(w / scale)` with round-to-nearest and saturation. This
|
| 27 |
+
per-channel + clipping scheme gives better SNR than vLLM's online per-tensor
|
| 28 |
+
`--quantization fp8` path.
|
| 29 |
+
|
| 30 |
+
Only 2D linear projection weights are quantized (attention q/k/v/o, MLP
|
| 31 |
+
gate/up/down). Embeddings, norms, lm_head, routers/experts, and the vision
|
| 32 |
+
tower stay in bf16 and are listed in the checkpoint's `ignore` list, so vLLM
|
| 33 |
+
leaves them untouched.
|
| 34 |
+
|
| 35 |
+
## Supported vLLM platforms
|
| 36 |
+
|
| 37 |
+
- **Intel XPU** — `XPUW8A16FP8LinearKernel` (the intended target).
|
| 38 |
+
- **NVIDIA CUDA** (SM75+, i.e. Turing and newer) —
|
| 39 |
+
`HummingFP8ScaledMMLinearKernel` when the `humming` package is installed,
|
| 40 |
+
otherwise `MarlinFP8ScaledMMLinearKernel`.
|
| 41 |
+
- **Not supported**: ROCm, CPU, TPU — vLLM has no W8A16-FP8 kernel for these
|
| 42 |
+
backends yet, so loading will fail with a "no kernel" error.
|
| 43 |
|