Instructions to use ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final") model = AutoModelForMultimodalLM.from_pretrained("ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final", "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/ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final
- SGLang
How to use ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final 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 "ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final" \ --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": "ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final", "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 "ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final" \ --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": "ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final", "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 ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final with Docker Model Runner:
docker model run hf.co/ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final
Qwen3.8-Flash-Next-metal-experts-4bit-final
This is ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit with the always-on
nn.Linear layers stored pre-quantized (Metal affine 4-bit, group 32, with the
per-group clipping search). The expert banks and the n-gram table are unchanged.
It is made by make_final_qwen38_checkpoint.py from the stream-experts benchmark
notes. Loading it performs no on-the-fly quantization:
quantized 0 nn.Linear: 4g32c, fused 192 sibling groups
on-the-fly quantization calls: 0
Only the 52 checkpoint files that held the dense bf16 layers are rewritten; the expert and n-gram files are byte-identical to the parent checkpoint.
Why
The parent checkpoint stores ~10.2 GiB of dense weights in bf16 and quantizes them
at every load. On a 32 GB Mac the load-time quantization peaks near the Metal
working set (lm_head alone can take the process to ~24-26 GB), and it is
unnecessary work. With this checkpoint the model occupies ~3.5 GiB of MPS memory
after load and needs no quantization pass.
Measured on an M3 Ultra (512 GB) with the Metal allocator capped to a 32 GB-class
24.96 GiB working set, transformers stream-experts @ e6e0218, torch 2.15.0,
kernels 0.18.3, expert cache 6 GiB:
| Run | on-the-fly quantize | peak process footprint | peak MPS driver | correctness |
|---|---|---|---|---|
| parent checkpoint + chunked quantization | 1480 calls | 13.81 GiB | 12.70 GiB | n/a |
| parent checkpoint, no chunking | 1450 calls | 24.35 GiB | 11.79 GiB | n/a |
| this checkpoint | 0 calls | 13.82 GiB | 10.81 GiB | compiled == eager 128/128 |
The parent run without chunking is the one that hits the 32 GB wall; the final checkpoint never enters that path.
Use
git clone -b stream-experts https://github.com/huggingface/transformers
cd transformers/benchmark_v2/experts_offload
PYTHONPATH=../../src python verify_generate.py ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final 4g32c 6
Use run_qwen38_metal_final.sh in this repository for the 32 GB workarounds
(uncached expert reads, streamed embed_tokens, tiled affine_qmm_t, MPS events
off). It sets REQUIRE_NO_QUANT=1 and fails if anything is quantized at load.
bash run_qwen38_metal_final.sh 6
- Downloads last month
- 46
Model tree for ArthurZ/Qwen3.8-Flash-Next-metal-experts-4bit-final
Base model
Qwen/Qwen3.8-Flash-Next