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"]
这段代码动态补上了缺失的变量,绕过了版本不兼容问题。
更多推荐




所有评论(0)