Instructions to use useful-quants/FastContext-1.0-4B-RL-w4a16-g128 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use useful-quants/FastContext-1.0-4B-RL-w4a16-g128 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="useful-quants/FastContext-1.0-4B-RL-w4a16-g128") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("useful-quants/FastContext-1.0-4B-RL-w4a16-g128") model = AutoModelForCausalLM.from_pretrained("useful-quants/FastContext-1.0-4B-RL-w4a16-g128", 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 useful-quants/FastContext-1.0-4B-RL-w4a16-g128 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "useful-quants/FastContext-1.0-4B-RL-w4a16-g128" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "useful-quants/FastContext-1.0-4B-RL-w4a16-g128", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/useful-quants/FastContext-1.0-4B-RL-w4a16-g128
- SGLang
How to use useful-quants/FastContext-1.0-4B-RL-w4a16-g128 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 "useful-quants/FastContext-1.0-4B-RL-w4a16-g128" \ --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": "useful-quants/FastContext-1.0-4B-RL-w4a16-g128", "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 "useful-quants/FastContext-1.0-4B-RL-w4a16-g128" \ --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": "useful-quants/FastContext-1.0-4B-RL-w4a16-g128", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use useful-quants/FastContext-1.0-4B-RL-w4a16-g128 with Docker Model Runner:
docker model run hf.co/useful-quants/FastContext-1.0-4B-RL-w4a16-g128
FastContext-1.0-4B-RL-w4a16-g128
This repository contains a W4A16 / BF16-activation export of microsoft/FastContext-1.0-4B-RL produced with llmcompressor in compressed-tensors format for vLLM deployment on Ampere-class and newer NVIDIA GPUs.
Quantization Summary
- Source model:
microsoft/FastContext-1.0-4B-RL - Source revision:
bd530b8e1f9a59b12e77061d9fe1e018f6eabe42 - Quantization:
W4A16 - Group size:
128 - Activation dtype:
bfloat16 - Backend:
llmcompressor+compressed-tensors - Export format:
compressed-tensors
Calibration and Accuracy Check
- Calibration samples:
96 - Held-out eval samples:
24 - Max sequence length:
4096 - Held-out perplexity before quantization:
7.3734 - Held-out perplexity after quantization:
7.1517 - Relative perplexity delta:
-3.01%
The calibration/eval prompts are repo-exploration and tool-calling flavored so the quantizer sees text that matches the deployed FastContext use case rather than generic chat data.
Local Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "useful-quants/FastContext-1.0-4B-RL-w4a16-g128"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
vllm serve useful-quants/FastContext-1.0-4B-RL-w4a16-g128 --quantization compressed-tensors
vLLM Smoke Test
This export was smoke-tested locally with vllm 0.23.0 after upload.
Launch command used:
python -m vllm.entrypoints.openai.api_server \
--model /path/to/FastContext-1.0-4B-RL-w4a16-g128 \
--quantization compressed-tensors \
--max-model-len 4096 \
--gpu-memory-utilization 0.7 \
--enforce-eager \
--host 127.0.0.1 \
--port 8011
Observed smoke results:
/v1/modelsreturned the model successfully.- Prompt
Return exactly: calibration-passreturnedcalibration-pass. - Prompt
Write one rg command to search for OAuth callback state validation. No explanation.returned a validrgcommand.
Files
recipe.yaml: exact GPTQ recipe used for this exportcalibration_text.jsonl: chat-rendered calibration corpuseval_text.jsonl: held-out evaluation corpusquantization_report.json: environment, perplexity, and generation checksvllm_smoke_test.json: exact local vLLM smoke-test command and responses
- Downloads last month
- 131
Model tree for useful-quants/FastContext-1.0-4B-RL-w4a16-g128
Base model
microsoft/FastContext-1.0-4B-RL