Skip to content

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

Description

@yph22

Checklist / 检查清单

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions