llamafactory 微调模型出现TypeError: argument of type ‘NoneType‘ is not iterable

问题介绍

本文作者碰到的问题是
File “/root/miniconda3/lib/python3.12/site-packages/transformers/modeling_utils.py”, line 1969, in post_init
if v not in ALL_PARALLEL_STYLES:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type ‘NoneType’ is not iterable

所以其中就是ALL_PARALLEL_STYLES是一个NoneType

解决方法

llamafactory的训练代码最开始添加下面的代码

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']

我是添加到tuner.py文件中最开始那里的

你可能感兴趣的:(python,开发语言,人工智能,深度学习,神经网络,LoRA,LLama,Factory)