ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

Qwen3.6 Lora target_modules=all-linear识别失败

Open yph22 opened this issue 5 months ago • 3 comments

Checklist / 检查清单

  • [x] I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。

Bug Description / Bug 描述

对Qwen3.6-35B-A3B进行Lora训练时,指定 --target_modules all-linear \ 会报错: [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: Traceback (most recent call last): [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/cli/sft.py", line 20, in [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: sft_main() [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/sft.py", line 353, in sft_main [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: return SwiftSft(args).main() [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/base.py", line 52, in main [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: result = self.run() [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/ray/base.py", line 168, in wrapper [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: return func(self, *args, **kwargs) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/sft.py", line 182, in run [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: self.model = self.prepare_model(self.args, self.model, template=self.template, train_dataset=train_dataset) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/tuner.py", line 364, in prepare_model [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: model = prepare_adapter( [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/tuner.py", line 202, in prepare_adapter [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: model = Swift.prepare_model(model, lora_config) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/tuners/base.py", line 714, in prepare_model [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: return get_peft_model(model, config, **kwargs) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/peft/mapping_func.py", line 122, in get_peft_model [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: return MODEL_TYPE_TO_PEFT_MODEL_MAPPING[peft_config.task_type]( [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/peft/peft_model.py", line 1955, in init [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: super().init(model, peft_config, adapter_name, **kwargs) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/peft/peft_model.py", line 129, in init [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: self.base_model = cls(model, {adapter_name: peft_config}, adapter_name) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/tuners/peft.py", line 306, in new_init [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: self.init_origin(model, config, args, **kwargs) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/peft/tuners/tuners_utils.py", line 315, in init [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: self.inject_adapter(self.model, adapter_name, low_cpu_mem_usage=low_cpu_mem_usage, state_dict=state_dict) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/peft/tuners/tuners_utils.py", line 1008, in inject_adapter [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: raise ValueError(error_msg) [2026-06-11T16:47:00+08:00] qwen36-claw-sft-verify-swift-llama-55371631-db76c-cfcd2 >> [rank1]: ValueError: Target modules {'|', 'q', 'd', '.', '?', 't', 'r', 'j', 's', 'b', 'n', '=', 'p', 'g', 'e', 'w', 'h', '', '(', 'l', '\', '$', ')', '_', 'v', 'x', 'z', 'u', 'i', 'k', '^', 'm', 'o', 'a'} not found in the base model. Please check the target modules and try again.

是transformers版本问题吗?

How to Reproduce / 如何复现

swift=4.3.0 transformers=5.3.0

Additional Information / 补充信息

No response

yph22 avatar Jun 11 '26 12:06 yph22

好像是PEFT的版本问题?暂时通过对peft/utils/transformers_weight_conversion.py打补丁修复了

yph22 avatar Jun 11 '26 13:06 yph22

https://github.com/huggingface/peft/issues/3229

Jintao-Huang avatar Jun 15 '26 07:06 Jintao-Huang

等待peft修复的时候可以先切0.18.1正常跑

hazelduan avatar Jun 15 '26 12:06 hazelduan