LLaMA-Factory 微调遇到的错误与解决记录
·
LLaMA-Factory 微调遇到的错误与解决记录 TypeError: argument of type ‘NoneType’ is not iterable
🧪 使用命令
llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
❌ 遇到的问题与解决方法
问题 1:TypeError: argument of type ‘NoneType’ is not iterable

报错详情
TypeError: argument of type 'NoneType' is not iterable
出现在 transformers 初始化模型时:
if v not in ALL_PARALLEL_STYLES:
原因分析
- 使用的是本地模型
/home/fyp/Llama3-8B-Chinese-Chat; - 模型的 config.json 中缺少字段
parallelization_style; transformers>= 4.52 在初始化时默认对该字段进行判断,若为None就会报错。
解决方法 ✅
在文件 /home/fyp/LLaMA-Factory/src/llamafactory/train/tuner.py 顶部加入以下代码:
from transformers import modeling_utils
if not hasattr(modeling_utils, "ALL_PARALLEL_STYLES") or modeling_utils.ALL_PARALLEL_STYLES is None:
modeling_utils.ALL_PARALLEL_STYLES = ["tp", "none", "colwise", "rowwise"]
这段代码动态补上了缺失的变量,绕过了版本不兼容问题。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)