Instructions to use JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4") model = AutoModelForCausalLM.from_pretrained("JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4") 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-14B-Instruct-FP4-W4A4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4" # 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-14B-Instruct-FP4-W4A4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4
- SGLang
How to use JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4 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-14B-Instruct-FP4-W4A4" \ --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-14B-Instruct-FP4-W4A4", "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-14B-Instruct-FP4-W4A4" \ --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-14B-Instruct-FP4-W4A4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4 with Docker Model Runner:
docker model run hf.co/JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4
Qwen2.5-14B-Instruct-FP4-W4A4
Model Description
This is an NVFP4 (NVIDIA FP4) quantized version of Qwen/Qwen2.5-14B-Instruct using the compressed-tensors quantization method.
- Base Model: Qwen/Qwen2.5-14B-Instruct
- Quantization Method: compressed-tensors
- Quantization Type: NVFP4 W4A4 (4-bit Weight and Activation)
- Model Size: ~10.5GB (compared to ~28GB for BF16)
- Compression Ratio: ~2.7x
Quantization Configuration
This model uses NVFP4 (NVIDIA FP4) quantization with grouped quantization for both weights and activations:
Weights
- Precision: NVFP4 (4-bit floating point)
- Strategy: Tensor-group (grouped quantization)
- Group Size: 16
- Symmetric: Yes
- Dynamic: No (static quantization)
- Observer: MinMax
Activations
- Precision: NVFP4 (4-bit floating point)
- Strategy: Tensor-group (grouped quantization)
- Group Size: 16
- Symmetric: Yes
- Dynamic: Local (dynamic quantization with local calibration)
- Observer: MinMax
Other Details
- Format: nvfp4-pack-quantized (packed 4-bit format)
- KV Cache: Not quantized
- Ignored Layers: lm_head
- Target Layers: Linear layers
- Quantization Version: 0.11.0
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "JongYeop/Qwen2.5-14B-Instruct-FP4-W4A4"
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id)
# Load quantized model
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype="auto"
)
# Generate text
messages = [
{"role": "user", "content": "What is machine learning?"}
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
input_ids,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)
Model Architecture
- Architecture: Qwen2ForCausalLM
- Hidden Size: 5120
- Intermediate Size: 13824
- Number of Layers: 48
- Number of Attention Heads: 40
- Number of KV Heads: 8
- Vocabulary Size: 152064
- Max Position Embeddings: 32768
Intended Use
This quantized model is intended for efficient inference with significantly reduced memory footprint while maintaining reasonable performance. It is suitable for:
- Resource-constrained environments
- Edge deployment
- Applications requiring minimal memory usage
- High throughput scenarios
- GPU inference with FP4 support
Limitations
- FP4 quantization may result in more accuracy loss compared to FP8 or INT8 quantization
- Best performance is achieved on hardware with native FP4 support (e.g., NVIDIA H100, Ada Lovelace, Blackwell GPUs)
- Dynamic activation quantization may introduce additional runtime overhead
- Grouped quantization requires compatible inference engines
Performance Notes
- Memory Usage: ~2.7x reduction compared to BF16
- Speed: Requires hardware with FP4 tensor core support for optimal performance
- Accuracy: May experience some degradation compared to higher precision formats
Citation
If you use this model, please cite the original Qwen2.5 paper and the compressed-tensors library.
License
Same as the base model: Apache 2.0
- Downloads last month
- 706