Text Generation
Transformers
Safetensors
qwen3
compressed-tensors
kv-cache
quantization
conversational
text-generation-inference
Instructions to use inference-optimization/TinyQwen3-KV-Cache-Only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inference-optimization/TinyQwen3-KV-Cache-Only with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="inference-optimization/TinyQwen3-KV-Cache-Only") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("inference-optimization/TinyQwen3-KV-Cache-Only") model = AutoModelForCausalLM.from_pretrained("inference-optimization/TinyQwen3-KV-Cache-Only", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use inference-optimization/TinyQwen3-KV-Cache-Only with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inference-optimization/TinyQwen3-KV-Cache-Only" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inference-optimization/TinyQwen3-KV-Cache-Only", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/inference-optimization/TinyQwen3-KV-Cache-Only
- SGLang
How to use inference-optimization/TinyQwen3-KV-Cache-Only 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 "inference-optimization/TinyQwen3-KV-Cache-Only" \ --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": "inference-optimization/TinyQwen3-KV-Cache-Only", "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 "inference-optimization/TinyQwen3-KV-Cache-Only" \ --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": "inference-optimization/TinyQwen3-KV-Cache-Only", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use inference-optimization/TinyQwen3-KV-Cache-Only with Docker Model Runner:
docker model run hf.co/inference-optimization/TinyQwen3-KV-Cache-Only
|
Download README.md from inference-optimization/TinyQwen3-KV-Cache-Only: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/inference-optimization/TinyQwen3-KV-Cache-Only/resolve/main/README.md
- Command line
-
hf download hf://inference-optimization/TinyQwen3-KV-Cache-Only/README.md
-
curl -L -o README.md https://huggingface.co/inference-optimization/TinyQwen3-KV-Cache-Only/resolve/main/README.md
1.52 kB
| # For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1 | |
| # Doc / guide: https://huggingface.co/docs/hub/model-cards | |
| base_model: | |
| - nm-testing/tinysmokeqwen3 | |
| library_name: transformers | |
| tags: | |
| - compressed-tensors | |
| - kv-cache | |
| - quantization | |
| # TinyQwen3 KV-Cache-Only quantized | |
| A tiny Qwen3 model ([nm-testing/tinysmokeqwen3](https://huggingface.co/nm-testing/tinysmokeqwen3)) quantized | |
| with [llm-compressor](https://github.com/vllm-project/llm-compressor) using **only KV cache quantization** — | |
| the model weights are left unquantized (dense). | |
| ## Quantization config | |
| - `kv_cache_scheme`: 8-bit float (`fp8`), `tensor` strategy, static, symmetric | |
| - `config_groups`: `{}` (no weight quantization) | |
| - `quantization_status`: `compressed` | |
| Produced with `oneshot` and the recipe: | |
| ```yaml | |
| quant_stage: | |
| quant_modifiers: | |
| QuantizationModifier: | |
| kv_cache_scheme: | |
| num_bits: 8 | |
| type: float | |
| strategy: tensor | |
| dynamic: False | |
| symmetric: True | |
| ``` | |
| Calibrated on 16 samples of `open_platypus` with `max_seq_length=512`. | |
| ## Use | |
| Intended for testing `compressed-tensors` KV-cache-only checkpoints in `transformers` CI | |
| (see `tests/quantization/compressed_tensors_integration/test_compressed_tensors.py`). | |
| ```python | |
| from transformers import AutoModelForCausalLM | |
| model = AutoModelForCausalLM.from_pretrained("inference-optimization/TinyQwen3-KV-Cache-Only") | |
| ``` | |