Instructions to use hoborific/Glistening-Gem-31B-v2.1-W8A16-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hoborific/Glistening-Gem-31B-v2.1-W8A16-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hoborific/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-W8A16-FP8") model = AutoModelForMultimodalLM.from_pretrained("hoborific/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-W8A16-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hoborific/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-W8A16-FP8
- SGLang
How to use hoborific/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-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/Glistening-Gem-31B-v2.1-W8A16-FP8 with Docker Model Runner:
docker model run hf.co/hoborific/Glistening-Gem-31B-v2.1-W8A16-FP8
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("hoborific/Glistening-Gem-31B-v2.1-W8A16-FP8")
model = AutoModelForMultimodalLM.from_pretrained("hoborific/Glistening-Gem-31B-v2.1-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]:]))Glistening-Gem-31B-v2.1-W8A16-FP8
Quantized version of sophosympatheia/Glistening-Gem-31B-v2.1.
Format
Offline-quantized W8A16 FP8 in the
compressed-tensors
float-quantized format: weights in float8_e4m3fn with per-output-channel
symmetric scales, activations kept in bf16/fp16.
How it was quantized
For each linear layer, every output row gets its own scale starting from
amax / 448, refined by an MSE clip search over ~9 clip fractions
(0.8–1.0× amax) picking the lowest-error scale per row. Weights are then
quantized q = e4m3(w / scale) with round-to-nearest and saturation. This
per-channel + clipping scheme gives better SNR than vLLM's online per-tensor
--quantization fp8 path.
Only 2D linear projection weights are quantized (attention q/k/v/o, MLP
gate/up/down). Embeddings, norms, lm_head, routers/experts, and the vision
tower stay in bf16 and are listed in the checkpoint's ignore list, so vLLM
leaves them untouched.
Supported vLLM platforms
- Intel XPU —
XPUW8A16FP8LinearKernel(the intended target). - NVIDIA CUDA (SM75+, i.e. Turing and newer) —
HummingFP8ScaledMMLinearKernelwhen thehummingpackage is installed, otherwiseMarlinFP8ScaledMMLinearKernel. - Not supported: ROCm, CPU, TPU — vLLM has no W8A16-FP8 kernel for these backends yet, so loading will fail with a "no kernel" error.
- Downloads last month
- 23
Model tree for hoborific/Glistening-Gem-31B-v2.1-W8A16-FP8
Base model
sophosympatheia/Glistening-Gem-31B-v2.1
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hoborific/Glistening-Gem-31B-v2.1-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)