Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 用 llama-factory 微调,运行示例脚本报错 #872

Open
2 tasks done
vdogmcgee opened this issue Mar 5, 2025 · 0 comments
Open
2 tasks done

[BUG] 用 llama-factory 微调,运行示例脚本报错 #872

vdogmcgee opened this issue Mar 5, 2025 · 0 comments

Comments

@vdogmcgee
Copy link

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

环境配置好之后,运行 :
CUDA_VISIBLE_DEVICES=0 llamafactory-cli train configs/minicpmo_2_6_lora_sft.yaml

报错:
File "python3.10/site-packages/transformers/tokenization_utils_base.py", line 803, in
self.data = {k: v.to(device=device) for k, v in self.data.items() if v is not None}
AttributeError: 'list' object has no attribute 'to'

我打印了self.data,是一个字典,其中一些 value 是 tensor,一些 value 是被 list 包裹起来的 tensor , 直接 to.('cuda') 就会报这个错误

期望行为 | Expected Behavior

正常运行

复现方法 | Steps To Reproduce

照着官方给的 llama-factory 运行

运行环境 | Environment

- OS: ubuntu 22.04
- Python: 3.10
- Transformers: 4.44.2
- PyTorch: 2.3.0
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`): 12.1

备注 | Anything else?

No response

@vdogmcgee vdogmcgee changed the title [BUG] <title> 用 llama-factory 微调,运行示例脚本报错 [BUG] 用 llama-factory 微调,运行示例脚本报错 Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant