深度阅读

解决add_code_sample_docstrings() got an unexpected keyword argument 'qa_target_start_index'

作者
作者
2023年08月22日
更新时间
11.33 分钟
阅读时间
0
阅读量
/opt/conda/lib/python3.7/site-packages/transformers/utils/import_utils.py in __getattr__(self, name)
    845 
    846     # Needed for autocompletion in an IDE
--> 847     def __dir__(self):
    848         result = super().__dir__()
    849         # The elements of self.__all__ that are submodules may or may not be in the dir already, depending on whether

/opt/conda/lib/python3.7/site-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
    859         if name in self._modules:
    860             value = self._get_module(name)
--> 861         elif name in self._class_to_module.keys():
    862             module = self._get_module(self._class_to_module[name])
    863             value = getattr(module, name)

RuntimeError: Failed to import transformers.models.bert.modeling_bert because of the following error (look up to see its traceback):
add_code_sample_docstrings() got an unexpected keyword argument 'qa_target_start_index'

原因出在transformers库在较新版本中删除了此文档字符串。
1) 使用transformers指定的版本
2) 手动删除 doc 字符串。

参考链接
https://github.com/HKUNLP/UnifiedSKG/issues/16#issuecomment-1102949121

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。