错误类型:ImportError: attempted relative import with no known parent package
(即python无法找到相应的包)
文件的目录如下:
|--transformer
|--src
|--transformer
current.py(当前文件)
configuration_bert.py (包含BertConfig函数)
从当前文件中调用BertConfig函数
原import代码:from configuration_bert import BertConfig
需修改为:
–> from src.transformers.configuration_bert import BertConfig