FP8 quants
Collection
A collection of my FP8 quants for models missing this. • 2 items • Updated • 1
How to use marksverdhei/GLM-4.7-Flash-FP8 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="marksverdhei/GLM-4.7-Flash-FP8")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("marksverdhei/GLM-4.7-Flash-FP8")
model = AutoModelForCausalLM.from_pretrained("marksverdhei/GLM-4.7-Flash-FP8")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use marksverdhei/GLM-4.7-Flash-FP8 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "marksverdhei/GLM-4.7-Flash-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": "marksverdhei/GLM-4.7-Flash-FP8",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/marksverdhei/GLM-4.7-Flash-FP8
How to use marksverdhei/GLM-4.7-Flash-FP8 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "marksverdhei/GLM-4.7-Flash-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": "marksverdhei/GLM-4.7-Flash-FP8",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "marksverdhei/GLM-4.7-Flash-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": "marksverdhei/GLM-4.7-Flash-FP8",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use marksverdhei/GLM-4.7-Flash-FP8 with Docker Model Runner:
docker model run hf.co/marksverdhei/GLM-4.7-Flash-FP8
FP8 quantized version of zai-org/GLM-4.7-Flash.
Also, see Unsloth's new unsloth/GLM-4.7-Flash-FP8-Dynamic
Tested on 2x RTX 3090 (24GB each) with vLLM 0.13.0:
| Setting | Value |
|---|---|
| Tensor Parallel | 2 |
| Context Length | 8192 |
| VRAM per GPU | 14.7 GB |
| Throughput | 19.4 tokens/sec |
Note: RTX 3090 lacks native FP8 support, so vLLM uses the Marlin kernel for weight-only FP8 decompression. GPUs with native FP8 (RTX 40xx, Ada Lovelace+) will achieve higher throughput.
Requires vLLM 0.13.0+ and transformers 5.0+ for glm4_moe_lite architecture support.
from vllm import LLM, SamplingParams
llm = LLM(
model="marksverdhei/GLM-4.7-Flash-fp8",
tensor_parallel_size=2,
max_model_len=8192,
enforce_eager=True, # Optional: disable CUDA graphs to save VRAM
)
outputs = llm.generate(["Hello, world!"], SamplingParams(max_tokens=100))
print(outputs[0].outputs[0].text)
MIT (same as base model)
Base model
zai-org/GLM-4.7-Flash