AttributeError: ‘FieldInfo‘ object has no attribute ‘required‘.

2023-12-05

诸神缄默不语-个人CSDN博文目录

这个bug是在安装doccano包之后,在运行transformers代码时出现的。

核心报错信息:

RuntimeError: Failed to import transformers.models.bert.modeling_bert because of the following error (look up to see its traceback):
'FieldInfo' object has no attribute 'required'

这个是因为pydantic包>=2.0.0了,解决方案是安装比较老的版本,我的选择是 pip install pydantic==1.10.13
但是这样就又跟doccano冲突了,建议是把doccano安装到别的环境里。

参考资料:

  1. https://pypi.org/project/pydantic/#history
  2. [BUG] Attribute error when importing DeepSpeed Engine · Issue #3963 · microsoft/DeepSpeed
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

AttributeError: ‘FieldInfo‘ object has no attribute ‘required‘. 的相关文章

随机推荐