Views
No views yet
auto-round-best and revision 54e7cd36d9f7a358b4b42740c3aef755638e5ea6 is generated by auto-round. Tipically auto-round-best is bettervllm serve Intel/Qwen3.6-35B-A3B-int4-AutoRound --port 8000 --tensor-parallel-size 1 --max-model-len 2048 --reasoning-parser qwen3 --served-model-name qwen --speculative-config '{"method":"qwen3_next_mtp","num_speculative_tokens":2}'1curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d ' {
2 "model": "qwen",
3 "messages": [
4 {"role": "system", "content": "You are a helpful assistant."},
5 {"role": "user", "content": "Summarize Qwen 3.6 in one sentence."}
6 ],
7 "temperature": 1,
8 "max_tokens": 512
9 } '
101from transformers import AutoProcessor, Qwen3_5MoeForConditionalGeneration
2model_name = "Intel/Qwen3.6-35B-A3B-int4-AutoRound"
3
4model = Qwen3_5MoeForConditionalGeneration.from_pretrained(model_name, dtype="auto",
5 device_map="auto")
6processor = AutoProcessor.from_pretrained(model_name)
7
8messages = [
9 {
10 "role": "user",
11 "content": [
12 {
13 "type": "image",
14 "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
15 },
16 {"type": "text", "text": "Describe this image in short."},
17 ],
18 }
19]
20
21
22inputs = processor.apply_chat_template(
23 messages,
24 tokenize=True,
25 add_generation_prompt=True,
26 return_dict=True,
27 return_tensors="pt"
28)
29inputs = inputs.to(model.device)
30
31
32generated_ids = model.generate(**inputs, max_new_tokens=128)
33generated_ids_trimmed = [
34 out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
35]
36print(processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0])
37
38"""
39The user wants a short description of the provided image.
40
411. **Identify the main subjects:** A young woman and a dog (looks like a Golden Retriever or Yellow Labrador).
422. **Identify the action:** They are interacting, specifically shaking hands (paw shake). They are both smiling.
433. **Identify the setting:** A sandy beach near the ocean.
444. **Identify the lighting/mood:** It looks like sunset or sunrise (golden hour) due to the warm light and soft shadows. The mood is happy, peaceful, and affectionate.
455
46"""1import gc
2
3from transformers import Qwen3_5MoeForConditionalGeneration,AutoProcessor
4import torch
5model_name = "Qwen/Qwen3.6-35B-A3B"
6
7model = Qwen3_5MoeForConditionalGeneration.from_pretrained(model_name)
8layer_config = {}
9mixed_bits = 16
10for n,m in model.named_modules():
11 if isinstance(m, torch.nn.Linear) and "language_model" in n:
12 if "linear_att" in n: #Must be set to 4 due to vLLM compatibility.
13 layer_config[n] = {"bits": 4}
14 continue
15 if not "expert" in n:
16 layer_config[n] = {"bits":mixed_bits}
17 elif "shared_expert" in n:
18 layer_config[n]={"bits":mixed_bits}
19from auto_round import AutoRound
20del model
21gc.collect()
22ar = AutoRound(model=model_name, layer_config=layer_config,nsamples=512,enable_torch_compile=512,low_gpu_mem_usage=True)
23ar.quantize_and_save("./qwen3-3.6-quantized")
24