AttributeError: ‘FieldInfo‘ object has no attribute ‘required‘.
诸神缄默不语-个人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安装到别的环境里。
参考资料:
- https://pypi.org/project/pydantic/#history
- [BUG] Attribute error when importing DeepSpeed Engine · Issue #3963 · microsoft/DeepSpeed