Text Generation
Transformers
Safetensors
English
qwen2
fp8
vllm
quantized
compressed-tensors
conversational
text-generation-inference
Instructions to use JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8") model = AutoModelForCausalLM.from_pretrained("JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8
- SGLang
How to use JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8 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 "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8" \ --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": "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8" \ --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": "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8 with Docker Model Runner:
docker model run hf.co/JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8
Qwen2.5-3B-Instruct-FP8-W8A8
Model Overview
This model is a quantized version of Qwen/Qwen2.5-3B-Instruct using FP8 W8A8 quantization with the compressed-tensors format.
- Quantization Method: FP8 (float-quantized), W8A8 (8-bit weights, 8-bit activations)
- Quantization Strategy: Per-tensor, symmetric
- Calibration Dataset: CNN/DailyMail (512 samples, max sequence length 2048)
- Format: compressed-tensors
- Model Size: ~3.8 GB (vs ~6.0 GB for the original BF16 model)
Quantization Details
| Component | Precision | Strategy | Observer | Symmetric |
|---|---|---|---|---|
| Weights | FP8 (8-bit float) | Per-tensor | MinMax | Yes |
| Activations | FP8 (8-bit float) | Per-tensor | MinMax | Yes |
- The
lm_headlayer is not quantized to preserve output quality.
How to Use
With vLLM
from vllm import LLM, SamplingParams
model = LLM(model="JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8")
sampling_params = SamplingParams(max_tokens=512, temperature=0.7)
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! Can you introduce yourself?"},
]
outputs = model.chat(messages, sampling_params=sampling_params)
print(outputs[0].outputs[0].text)
With Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "JongYeop/Qwen2.5-3B-Instruct-FP8-W8A8"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! Can you introduce yourself?"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=True))
Creation
This model was created using llmcompressor with the following recipe:
quant_stage:
quant_modifiers:
QuantizationModifier:
config_groups:
group_0:
targets: [Linear]
weights:
num_bits: 8
type: float
symmetric: true
strategy: tensor
dynamic: false
observer: minmax
input_activations:
num_bits: 8
type: float
symmetric: true
strategy: tensor
dynamic: false
observer: minmax
targets: [Linear]
ignore: [lm_head]
Evaluation
For evaluation results, please refer to the original Qwen2.5-3B-Instruct model card. FP8 W8A8 quantization typically preserves most of the original model's quality.
- Downloads last month
- 5