swift webui导出模型时报KeyError: 'base_model.model.model

我用swift webui导出模型时报KeyError: 'base_model.model.model.layers.0.self_attn.k_proj.base_layer',哪位大神知道啥原因?
[INFO:swift] Loading the model using model_dir: /mnt/workspace/output/v3-20250116-173230/checkpoint-537
[INFO:swift] Successfully loaded /mnt/workspace/output/v3-20250116-173230/checkpoint-537/args.json.
[INFO:swift] Successfully registered []
[INFO:swift] rank: -1, local_rank: -1, world_size: 1, local_world_size: 1
[INFO:swift] Loading the model using model_dir: Qwen2.5-7B-Instruct-GPTQ-Int4
/usr/local/lib/python3.10/site-packages/gradio/blocks.py:1780: UserWarning: A function (export_model) returned too many output values (needed: 2, returned: 3). Ignoring extra values.
Output components:
[accordion, dropdown]
Output values returned:
[{'open': True, 'type': 'update'}, {'choices': ['pid:7794/create:2025-01-16, 19:10/running:2s/cmd:/usr/local/bin/python /usr/local/bin/swift export --model_type qwen2_5 --template qwen2_5 --quant_bits 4 --quant_method gptq --output_dir /mnt/workspace/export/1 --dataset datajson/sft.json --ckpt_dir /mnt/workspace/output/v3-20250116-173230/checkpoint-537 --log_file /mnt/workspace/output/qwen2_5-2025116191045/run_export.log --ignore_args_error true'], 'value': 'pid:7794/create:2025-01-16, 19:10/running:2s/cmd:/usr/local/bin/python /usr/local/bin/swift export --model_type qwen2_5 --template qwen2_5 --quant_bits 4 --quant_method gptq --output_dir /mnt/workspace/export/1 --dataset datajson/sft.json --ckpt_dir /mnt/workspace/output/v3-20250116-173230/checkpoint-537 --log_file /mnt/workspace/output/qwen2_5-2025116191045/run_export.log --ignore_args_error true', 'type': 'update'}, [None]]
warnings.warn(

日志内容如下:

···

Quantizing layers inside the block: 36%|█████████████████████████████████████████████ | 5/14 [00:05<00:09, 1.04s/it][A

Quantizing layers inside the block: 43%|██████████████████████████████████████████████████████ | 6/14 [00:05<00:06, 1.26it/s][A

Quantizing layers inside the block: 50%|███████████████████████████████████████████████████████████████ | 7/14 [00:06<00:07, 1.01s/it][A

Quantizing layers inside the block: 57%|████████████████████████████████████████████████████████████████████████ | 8/14 [00:07<00:04, 1.26it/s][A

Quantizing layers inside the block: 64%|█████████████████████████████████████████████████████████████████████████████████ | 9/14 [00:16<00:16, 3.36s/it][A

Quantizing layers inside the block: 71%|█████████████████████████████████████████████████████████████████████████████████████████▎ | 10/14 [00:16<00:09, 2.43s/it][A

Quantizing layers inside the block: 79%|██████████████████████████████████████████████████████████████████████████████████████████████████▏ | 11/14 [00:18<00:06, 2.14s/it][A

Quantizing layers inside the block: 86%|███████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 12/14 [00:18<00:03, 1.59s/it][A

Quantizing layers inside the block: 93%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 13/14 [00:19<00:01, 1.54s/it][A

Quantizing layers inside the block: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14/14 [00:20<00:00, 1.17s/it][A

                                                                                                                                                                                                  [A

Quantizing base_model.model.model.layers blocks : 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 28/28 [09:29<00:00, 20.39s/it] Quantizing base_model.model.model.layers blocks : 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 28/28 [09:29<00:00, 20.34s/it] Using Exllamav2 backend will reorder the weights offline, thus you will not be able to save the model with the right weights.Setting `disable_exllama=True`. You should only use Exllamav2 backend for inference. /usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py:5055: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead warnings.warn( Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/swift/cli/export.py", line 5, in
export_main()
File "/usr/local/lib/python3.10/site-packages/swift/llm/export/export.py", line 41, in export_main
return SwiftExport(args).main()
File "/usr/local/lib/python3.10/site-packages/swift/llm/base.py", line 45, in main
result = self.run()
File "/usr/local/lib/python3.10/site-packages/swift/llm/export/export.py", line 26, in run
quantize_model(args)
File "/usr/local/lib/python3.10/site-packages/swift/llm/export/quant.py", line 227, in quantize_model
QuantEngine(args).quantize()
File "/usr/local/lib/python3.10/site-packages/swift/llm/export/quant.py", line 39, in quantize
gptq_quantizer = self.gptq_model_quantize()
File "/usr/local/lib/python3.10/site-packages/swift/llm/export/quant.py", line 221, in gptq_model_quantize
gptq_quantizer.quantize_model(self.model, self.tokenizer)
File "/usr/local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(args, *kwargs)
File "/usr/local/lib/python3.10/site-packages/optimum/gptq/quantizer.py", line 569, in quantize_model
self.pack_model(model=model, quantizers=quantizers)
File "/usr/local/lib/python3.10/site-packages/optimum/gptq/quantizer.py", line 644, in pack_model
quantizers[name], scale, zero, g_idx = quantizers[name]
KeyError: 'base_model.model.model.layers.0.self_attn.k_proj.base_layer'

···

展开
收起
游客phlala5woslcc 2025-01-16 19:32:12 132 发布于河南 分享
分享
版权
举报
2 条回答
写回答
取消 提交回答
  • 解决了,是基模型不对,这种基模型训练完不能合并。

    2025-03-07 10:10:11 举报
    赞同 93 评论

    评论

    全部评论 (0)

    登录后可评论
  • 这个错误可能是由于模型文件不完整或损坏导致的,您可以尝试重新下载或训练模型,并确保模型文件完整无误。如果问题依旧存在,建议您联系阿里云的工作人员获取进一步的帮助。如果对您有帮助的话,可以帮忙采纳一下。谢谢。

    2025-02-09 19:38:38 举报
    赞同 142 评论

    评论

    全部评论 (0)

    登录后可评论

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352

热门讨论

热门文章

还有其他疑问?
咨询AI助理
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等