Instructions to use bumbuk/Qwen3.5-4B-AWQ-text-flat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bumbuk/Qwen3.5-4B-AWQ-text-flat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bumbuk/Qwen3.5-4B-AWQ-text-flat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bumbuk/Qwen3.5-4B-AWQ-text-flat") model = AutoModelForCausalLM.from_pretrained("bumbuk/Qwen3.5-4B-AWQ-text-flat", 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 bumbuk/Qwen3.5-4B-AWQ-text-flat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bumbuk/Qwen3.5-4B-AWQ-text-flat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bumbuk/Qwen3.5-4B-AWQ-text-flat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bumbuk/Qwen3.5-4B-AWQ-text-flat
- SGLang
How to use bumbuk/Qwen3.5-4B-AWQ-text-flat 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 "bumbuk/Qwen3.5-4B-AWQ-text-flat" \ --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": "bumbuk/Qwen3.5-4B-AWQ-text-flat", "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 "bumbuk/Qwen3.5-4B-AWQ-text-flat" \ --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": "bumbuk/Qwen3.5-4B-AWQ-text-flat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bumbuk/Qwen3.5-4B-AWQ-text-flat with Docker Model Runner:
docker model run hf.co/bumbuk/Qwen3.5-4B-AWQ-text-flat
Qwen3.5-4B-AWQ-text-flat
Text-only AWQ quantum Qwen3.5-4B (2.91 GiB / 3.13 GB, one safetensors file) with tensors renamed to the flat naming scheme expected by vLLM.
Why is this needed?
The original checkpoint kumar2235/Qwen3.5-4B-AWQ
is preserved in the VLM model markup: all tensors are prefixed with model.language_model.*
(a legacy of Qwen3_5ForConditionalGeneration). The vLLM implementation of the text architecture
Qwen3_5ForCausalLM is flat: expects model.layers.*, model.embed_tokens, and model.norm.
Because of this, vLLM doesn't load the original and crashes on startup:
ValueError: There is no module or parameter named 'language_model' in Qwen3_5Model.
What's changed
- All 1170 tensors have had their prefix renamed from
model.language_model.tomodel.(e.g.,model.language_model.layers.0.mlp.gate_proj.weighttomodel.layers.0.mlp.gate_proj.weight). - Only the safetensors JSON header has been rewritten (154,752 to 137,196 bytes). Data bytes are intact: the file size matches the original byte for byte โ 3,127,716,724 bytes.
config.json, tokenizer, andchat_template.jinjaare copies of the original, unchanged.- The model remains text-only: no vision tower,
Qwen3_5ForCausalLMarchitecture, quantization โ AWQ W4A16_ASYM group 128 (compressed-tensors,pack-quantized),linear_attn(DeltaNet) andlm_headremain in BF16.
Verified
- vLLM 0.27.1 (
vllm/vllm-openai:latest), NVIDIA GPU (Blackwell / Ada): loads and responds to requests. -Quantization is determined automatically byconfig.json(--quantization compressed-tensorscan be omitted). - Note: when bind-mounting models on Windows (9P file system), vLLM recommends
--safetensors-load-strategy=prefetch. On a Linux server (standard deployment), the flag is not needed.
Running in vLLM
vllm serve /models/Qwen3.5-4B-AWQ-text-flat \
--served-model-name Qwen3.5-9B \
--max-model-len 16384 \
--reasoning-parser qwen3 \
--language-model-only \
--default-chat-template-kwargs '{"enable_thinking": false}'
How it's done (reproducible)
Renaming is rewriting the safetensors header (stdlib Python, no dependencies:
data_offsets in safetensors are calculated from the start of the data section, so the header can
be changed freely, the data is not shifted):
import json, struct, shutil
SRC = "model.safetensors" # original (kumar2235/Qwen3.5-4B-AWQ)
DST = "model-flat.safetensors" # result
with open(SRC, "rb") as f:
n = struct.unpack("<Q", f.read(8))[0]
header = json.loads(f.read(n))
renamed = {}
for k, v in header.items():
if k == "__metadata__":
renamed[k] = v
elif k.startswith("model.language_model."):
renamed["model." + k[len("model.language_model."):]] = v
else:
renamed[k] = v
new_header = json.dumps(renamed, separators=(",", ":")).encode()
with open(SRC, "rb") as fin, open(DST, "wb") as fout:
fout.write(struct.pack("<Q", len(new_header)))
fout.write(new_header)
fin.seek(8 + n) # data section immediately after the original header
shutil.copyfileobj(fin, fout)
Post-conversion check: there should be no names with language_model left in the header,
and os.path.getsize(DST) should equal
8 + len(new_header) + (os.path.getsize(SRC) - 8 - n).
Attribution
- Quantization: kumar2235/Qwen3.5-4B-AWQ (AWQ W4A16_ASYM g128, llm-compressor, calibration โ 512 OpenPlatypus samples).
- Base: Qwen/Qwen3.5-4B (Apache 2.0).
- Derivative license โ Apache 2.0 (inherited from base).
- Downloads last month
- 10