Views
No views yet
vllm serve Intel/Qwen2.5-VL-7B-Instruct-int4-mixed-AutoRound --dtype bfloat16 --port 8001 --max-model-len 100001curl --noproxy '*' http://localhost:8001/v1/chat/completions -H "Content-Type: application/json" -d '{
2 "model": "Intel/Qwen2.5-VL-7B-Instruct-int4-mixed-AutoRound",
3 "messages": [
4 {
5 "role": "user",
6 "content": [
7 {
8 "type": "image_url",
9 "image_url": {
10 "url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"
11 }
12 },
13 {
14 "type": "text",
15 "text": "请描述这张图"
16 }
17 ]
18 }
19 ],
20 "max_tokens": 512
21 }'1import torch
2from auto_round import AutoRound, AutoRoundMLLM
3from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
4
5model_name = "Qwen/Qwen2.5-VL-7B-Instruct/"
6
7# default: Load the model on the available device(s)
8model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
9 model_name, torch_dtype="auto", device_map="auto"
10)
11
12tokenizer = AutoTokenizer.from_pretrained(model_name)
13
14processor = AutoProcessor.from_pretrained(model_name,trust_remote_code=True)
15layer_config = {}
16for n, m in model.named_modules():
17 if "visual" in n:
18 if not isinstance(m, torch.nn.Linear):
19 continue
20 if "mlp.gate_proj" in n or "mlp.down_proj" in n or "mlp.up_proj" in n:
21 layer_config[n] = {"bits": 16}
22 else:
23 layer_config[n] = {"bits": 8}
24
25autoround = AutoRoundMLLM(model, tokenizer, processor=processor, iters=200, group_size=128,layer_config=layer_config)
26autoround.quantize_and_save("./Qwen2.5-VL-7B-Instruct-autoround")