Image-Text-to-Text
Transformers
Safetensors
qwen3_5
qwen
qwen3.5
qwen3.8
awq
int4
w4a16
compressed-tensors
lmdeploy
conversational
Instructions to use TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ") model = AutoModelForMultimodalLM.from_pretrained("TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ
- SGLang
How to use TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ 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 "TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ" \ --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": "TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ" \ --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": "TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ with Docker Model Runner:
docker model run hf.co/TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ
Qwen3.8-Queen-27B-W4A16-AWQ
W4A16 (4-bit weights, 16-bit activations) AWQ compressed-tensors quantization
of aifeifei798/Qwen3.8-Queen-27B.
Quantization method
- Scheme:
W4A16_ASYM— 4-bit asymmetric per-group quantization (group size 128) of allLinearweights, stored in the compressed-tensors pack-quantized format (weight_packed/weight_scale/weight_zero_point/weight_shape), which LMDeployturbomindauto-detects and loads natively (including the MTP heads and vision tower, which stay BF16). - Tooling: llmcompressor one-shot offline quantization with CPU offloading (
compressed_tensors.offload.load_offloaded_model), so the full-precision source fits on a 2×16 GB VRAM setup. - AWQ activation smoothing:
AWQModifierwith the layer-scoped hybrid-attention mappings frombuild_hybrid_attention_mappings— full-attentioninput_layernorm→self_attn.q/k/v,post_attention_layernorm→mlp.gate/up, andmlp.up_proj→mlp.down_proj, withduo_scaling="both"and CPU offload, followed by W4A16 quantization. This layer-scoped recipe is required for hybrid-attention (Qwen3.5-family) architectures — grouped-regex smoothing or mismatched mappings corrupt decoding. - Unquantized (kept BF16): embeddings,
lm_head, norms,linear_attn.in_proj_a/b, the vision tower, and MTP heads.
Usage
Tested with LMDeploy turbomind:
from lmdeploy import pipeline, TurbomindEngineConfig
pipe = pipeline(
"TheUnderscore/Qwen3.8-Queen-27B-W4A16-AWQ",
backend_config=TurbomindEngineConfig(
tp=2,
model_format="compressed-tensors",
language_model_only=True,
cpu_realtime_conversion=True,
),
)
print(pipe("Hello, who are you?").text)
Files
quantize-awq-hybrid.py— the script used to produce this quantization (CPU-offloaded, DDP/torchrun, produces properly numbered-of-Nshards).--offload_dirselects where per-rank CPU offload temp folders live (defaults to the current working directory).model-nonquant.safetensors— unquantized tensors (mtp.*andmodel.visual.*) preserved BF16 so the full model architecture is loadable.
- Downloads last month
- 12