Image-Text-to-Text
Transformers
Safetensors
qwen4_moe
autoround
rtn
gptq
w4a16
Mixture of Experts
qwen4
vllm
4-bit precision
Run this model with HF Jobs
Run OpenTensorLab/Qwen4-35B-A3B-GPTQ on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use OpenTensorLab/Qwen4-35B-A3B-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenTensorLab/Qwen4-35B-A3B-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenTensorLab/Qwen4-35B-A3B-GPTQ")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenTensorLab/Qwen4-35B-A3B-GPTQ") model = AutoModelForMultimodalLM.from_pretrained("OpenTensorLab/Qwen4-35B-A3B-GPTQ", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenTensorLab/Qwen4-35B-A3B-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenTensorLab/Qwen4-35B-A3B-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/Qwen4-35B-A3B-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ
- SGLang
How to use OpenTensorLab/Qwen4-35B-A3B-GPTQ 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 "OpenTensorLab/Qwen4-35B-A3B-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/Qwen4-35B-A3B-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "OpenTensorLab/Qwen4-35B-A3B-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/Qwen4-35B-A3B-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenTensorLab/Qwen4-35B-A3B-GPTQ with Docker Model Runner:
docker model run hf.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ
|
Download README.md from OpenTensorLab/Qwen4-35B-A3B-GPTQ: direct link, hf CLI and curl.
- Browser
- Download file 10.2 kB
-
https://huggingface.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ/resolve/main/README.md
- Command line
-
hf download hf://OpenTensorLab/Qwen4-35B-A3B-GPTQ/README.md
-
curl -L -o README.md https://huggingface.co/OpenTensorLab/Qwen4-35B-A3B-GPTQ/resolve/main/README.md
10.2 kB
| base_model: Qwen/Qwen4-35B-A3B | |
| base_model_relation: quantized | |
| library_name: transformers | |
| license: apache-2.0 | |
| pipeline_tag: image-text-to-text | |
| quantized_by: OpenTensorLab | |
| tags: | |
| - autoround | |
| - rtn | |
| - gptq | |
| - w4a16 | |
| - moe | |
| - qwen4 | |
| - vllm | |
| # Qwen4-35B-A3B-GPTQ (W4A16 RTN) | |
| This repository contains a **W4A16 (4-bit weight, 16-bit activation)** RTN (Round-To-Nearest) GPTQ-formatted quantization of **[Qwen/Qwen4-35B-A3B](https://huggingface.co/Qwen/Qwen4-35B-A3B)**, generated using **[Intel AutoRound](https://github.com/intel/auto-round)** without multi-iteration SignRound fine-tuning. | |
| > [!IMPORTANT] | |
| > **vLLM Compatibility Notice:** You **must** use the `vllm/vllm-openai:qwen4` Docker image (or a vLLM build containing the Qwen4 MoE + QSA + PLE integration) to serve this model right now. Standard stable vLLM releases do not yet include `Qwen4MoeForConditionalGeneration` / `Qwen4Exp` support. | |
| --- | |
| ## Quantization Details | |
| * **Base Model:** [`Qwen/Qwen4-35B-A3B`](https://huggingface.co/Qwen/Qwen4-35B-A3B) (35B total parameters, 3B active per token, plus 20B N-gram PLE embedding and 2B MTP layer) | |
| * **Method:** **RTN / Fast W4A16** (`iters=1` via [Intel AutoRound](https://github.com/intel/auto-round) `0.18.0.dev355` without multi-iteration SignRound optimization) | |
| * **Scheme & Format:** `W4A16` (`auto_gptq` layout, `group_size=128`, `sym=True`) | |
| * **Calibration:** `NeelNanda/pile-10k` (`nsamples=256`, `seqlen=2048`) | |
| * **Quantized Modules (30,760 / 31,434 linear layers):** | |
| * All 40 MoE layers' routed experts (`256` experts per layer: `gate_proj`, `up_proj`, `down_proj`) | |
| * All 10 Qwen Sparse Attention (QSA) layers (`q_proj`, `k_proj`, `v_proj`, `o_proj`) | |
| * **Preserved in `BF16` (Unquantized for Precision & Kernel Compatibility):** | |
| * Vision encoder (`model.visual.*`) | |
| * Gated DeltaNet linear attention layers (`linear_attn.*`) | |
| * Shared experts & MoE routers (`mlp.shared_expert.*`, `mlp.shared_expert_gate`, `mlp.gate`) | |
| * Manifold-Constrained Hyper-Connections (`attn_hyper_connection`, `mlp_hyper_connection`, `hyper_connection_mixer`) | |
| * QSA sparse attention indexers (`self_attn.indexer.index_qk_proj`) | |
| * Layer 1 Parameterized Lexical Embedding (`ple.*`, including the 10M-entry N-gram table offloaded to pinned host RAM by vLLM) | |
| * Multi-Token Prediction (`mtp.*`) draft head & `lm_head` | |
| --- | |
| ## Serving with vLLM (`vllm/vllm-openai:qwen4`) | |
| ### 1. Launch via Docker | |
| > [!NOTE] | |
| > **`--dtype bfloat16` is required.** vLLM's Qwen4 Sparse Attention (`Qwen4ExpQSAAttention`) kernel requires `bfloat16` activations and raises `NotImplementedError: Qwen4Exp QSA currently requires BF16` if loaded in `float16`. | |
| ```bash | |
| docker run --rm -it --gpus all \ | |
| --ipc=host \ | |
| -p 8000:8000 \ | |
| -v ~/.cache/huggingface:/root/.cache/huggingface \ | |
| vllm/vllm-openai:qwen4 \ | |
| OpenTensorLab/Qwen4-35B-A3B-GPTQ \ | |
| --dtype bfloat16 \ | |
| --trust-remote-code \ | |
| --enable-prefix-caching \ | |
| --max-model-len 32k \ | |
| --disable-flashinfer-autotune \ | |
| --gpu-memory-utilization 0.90 \ | |
| --kv-cache-dtype fp8 \ | |
| --attention-config.indexer_kv_dtype fp8 \ | |
| --enable-auto-tool-choice \ | |
| --tool-call-parser qwen4 \ | |
| --reasoning-parser qwen4 \ | |
| --speculative-config '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true}' | |
| ``` | |
| ### 2. Verified Runtime Footprint | |
| On a single RTX PRO 600 GPU with `--gpu-memory-utilization 0.90` and `--max-model-len 32k`: | |
| * **GPU Weight + Non-Torch Memory:** `25.84 GiB` (N-gram PLE embedding automatically pinned in CPU host RAM) | |
| * **Peak Activation + CUDA Graph Memory:** `5.29 GiB` (`3.41 GiB` activation + `1.88 GiB` CUDA graphs) | |
| * **Available KV Cache (`fp8`):** `54.24 GiB` (`1,843,200` tokens / `57.60x` concurrency at 32K context) | |
| * **MTP Speculative Decoding (`num_speculative_tokens=3`):** Verified mean acceptance length `2.39 โ 2.85` tokens per step (~`300 โ 400 tok/s` single-stream generation) | |
| --- | |
| ## API Usage (OpenAI-Compatible) | |
| ```bash | |
| pip install -U openai | |
| export OPENAI_BASE_URL="http://localhost:8000/v1" | |
| export OPENAI_API_KEY="EMPTY" | |
| ``` | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI() | |
| messages = [ | |
| {"role": "user", "content": "Write a Python function to merge two sorted linked lists."}, | |
| ] | |
| completion = client.chat.completions.create( | |
| model="OpenTensorLab/Qwen4-35B-A3B-GPTQ", | |
| messages=messages, | |
| extra_body={ | |
| "chat_template_kwargs": { | |
| "preserve_thinking": True, | |
| "reasoning_effort": "high", # Supported: "xhigh", "high", "low", "off" | |
| }, | |
| }, | |
| stream=True, | |
| stream_options={"include_usage": True}, | |
| ) | |
| reasoning_content = "" | |
| answer_content = "" | |
| is_answering = False | |
| for chunk in completion: | |
| if not chunk.choices: | |
| print("\nUsage:", chunk.usage) | |
| continue | |
| delta = chunk.choices[0].delta | |
| if getattr(delta, "reasoning_content", None): | |
| if not is_answering: | |
| print(delta.reasoning_content, end="", flush=True) | |
| reasoning_content += delta.reasoning_content | |
| if getattr(delta, "content", None): | |
| if not is_answering: | |
| print("\n\n--- Answer ---\n") | |
| is_answering = True | |
| print(delta.content, end="", flush=True) | |
| answer_content += delta.content | |
| ``` | |
| ### Recommended Sampling Parameters | |
| * **Thinking Mode (`reasoning_effort` = `low` / `high` / `xhigh`):** | |
| `temperature=1.0`, `top_p=0.95`, `top_k=20`, `min_p=0.0`, `presence_penalty=0.0`, `repetition_penalty=1.0` | |
| * **Non-Thinking Mode (`reasoning_effort="off"` or `enable_thinking=False`):** | |
| `temperature=0.7`, `top_p=0.80`, `top_k=20`, `min_p=0.0`, `presence_penalty=1.5`, `repetition_penalty=1.0` | |
| --- | |
| ### ๐ Deploy on RunPod | |
| One-click launch environments pre-configured with PyTorch, CUDA, and dependencies for fine-tuning or quantization. | |
| > ๐ **Need GPU compute?** Sign up via [RunPod](https://runpod.io?ref=iabrlp7z) and get **$5โ$500 in free credits** when you add your first $10. | |
| #### PyTorch 2.15 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.15 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.15-runpod` | `0rsw686010` | [](https://runpod.io/console/deploy?template=0rsw686010&ref=iabrlp7z) | | |
| | **PyTorch 2.15 (CUDA 13.4)** | 13.4 | `vishva123/cuda-13.4-pytorch-2.15-runpod` | `0s0rhdfaqy` | [](https://runpod.io/console/deploy?template=0s0rhdfaqy&ref=iabrlp7z) | | |
| #### PyTorch 2.14 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.14 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.14-runpod` | `d7lxsa4w9m` | [](https://runpod.io/console/deploy?template=d7lxsa4w9m&ref=iabrlp7z) | | |
| | **PyTorch 2.14 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.14-runpod` | `yk0y6j6rpg` | [](https://runpod.io/console/deploy?template=yk0y6j6rpg&ref=iabrlp7z) | | |
| | **PyTorch 2.14 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.14-runpod` | `gsp4gwx0nw` | [](https://runpod.io/console/deploy?template=gsp4gwx0nw&ref=iabrlp7z) | | |
| #### PyTorch 2.13 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.13 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.13-runpod` | `gmlupxnxfk` | [](https://runpod.io/console/deploy?template=gmlupxnxfk&ref=iabrlp7z) | | |
| | **PyTorch 2.13 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.13-runpod` | `y3j8xvk4f4` | [](https://runpod.io/console/deploy?template=y3j8xvk4f4&ref=iabrlp7z) | | |
| | **PyTorch 2.13 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.13-runpod` | `vigpissn5w` | [](https://runpod.io/console/deploy?template=vigpissn5w&ref=iabrlp7z) | | |
| #### PyTorch 2.12 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.12 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.12-runpod` | `ctmz86zmf0` | [](https://runpod.io/console/deploy?template=ctmz86zmf0&ref=iabrlp7z) | | |
| | **PyTorch 2.12 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.12-runpod` | `qjko5yiwzi` | [](https://runpod.io/console/deploy?template=qjko5yiwzi&ref=iabrlp7z) | | |
| | **PyTorch 2.12 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.12-runpod` | `ifg6xmye0f` | [](https://runpod.io/console/deploy?template=ifg6xmye0f&ref=iabrlp7z) | | |
| --- | |
| ## Citation | |
| ```bibtex | |
| @misc{qwen4-35ba3b, | |
| title = {{Qwen4-35B-A3B}}, | |
| author = {{Qwen Team}}, | |
| month = {December}, | |
| year = {2026}, | |
| url = {[https://huggingface.co/Qwen/Qwen4-35B-A3B](https://huggingface.co/Qwen/Qwen4-35B-A3B)} | |
| } | |
| @article{cheng2023optimize, | |
| title = {Optimize Weight Rounding via Signed Gradient Descent for the Quantization of LLMs}, | |
| author = {Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, | |
| journal = {arXiv preprint arXiv:2309.05516}, | |
| year = {2023} | |
| } | |
| ``` |