modelscope / modelscope/ms-swift
Lora fine-tunning对Qwen3.5-4B模型进行微调,经过GPTQ int4量化之后的模型不能正常输出,等待很久全是!!!
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 1.7k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 136
Description
Checklist / 检查清单
- I have searched existing issues, and this is a new question or discussion topic. / 我已经搜索过现有的 issues,确认这是一个新的问题与讨论。
Question Description / 问题描述
使用Lora fine-tunning对Qwen3.5-4B模型进行微调,融合后模型可以正常推理,但是经过GPTQ int4量化之后的模型不能正常输出,等待很久全是!!!的输出。
遇到的问题有:
1、python -m pip install -U accelerate optimum transformers
python -m pip install gptqmodel --no-build-isolation
2、CUDA_VISIBLE_DEVICES=0 swift export --model ./output/washer_tasks_system/v1-20260315-114809/checkpoint-260-merged --quant_method gptq_v2 --quant_bits 4 --dataset ./out/dishwasher_mix_sft/quant_mix.jsonl --quant_n_samples 256 --max_length 2048 --output_dir output/washer_qwen3.5_4b_gptq
运行量化指令之后,报错
然后打了补丁:
/home/super/anaconda3/envs/swift401/lib/python3.11/site-packages/optimum/gptq/quantizer.py中:
self.select_quant_linear(device_map=model.hf_device_map, pack=True)
改成下面这样:
device_map = getattr(model, "hf_device_map", {"": 0})
self.select_quant_linear(device_map=device_map, pack=True)
3、执行推理
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the swift export GPTQ int4 command for the merged Qwen3.5-4B checkpoint and inspect the reported error. Compare the behavior of optimum/gptq/quantizer.py with and without the shown hf_device_map fallback, then run inference on the quantized output. Done means the quantized model produces normal output rather than repeated exclamation marks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100