Describe the bug
File "/home/serverai/anaconda3/envs/yanGPU/lib/python3.6/site-packages/fastNLP/io/data_bundle.py", line 100, in get_vocab
raise KeyError(error_msg)
KeyError: "DataBundle do NOT have Vocabulary named target. It should be one of dict_keys(['vocab'])."
To Reproduce
def get_vocab(self, field_name: str) -> Vocabulary:
r"""
获取field名为field_name对应的vocab
:param str field_name: 名称
:return: Vocabulary
"""
if field_name in self.vocabs.keys():
return self.vocabs[field_name]
else:
error_msg = f'DataBundle do NOT have Vocabulary named {field_name}. ' \
f'It should be one of {self.vocabs.keys()}.'
logger.error(error_msg)
raise KeyError(error_msg)
Go to '...'
Click on '....'
Scroll down to '....'
See error
重现这个bug的步骤
Expected behavior
A clear and concise description of what you expected to happen.
清晰而简要地描述你期望的结果
Screenshots
If applicable, add screenshots to help explain your problem.
如果可以,请提供截图
Desktop (please complete the following information):
OS: [e.g. iOS]
Browser [e.g. chrome, safari]
Version [e.g. 22]
相关环境
Smartphone (please complete the following information):
Device: [e.g. iPhone6]
OS: [e.g. iOS8.1]
Browser [e.g. stock browser, safari]
Version [e.g. 22]
Additional context
Add any other context about the problem here.
备注
Describe the bug File "/home/serverai/anaconda3/envs/yanGPU/lib/python3.6/site-packages/fastNLP/io/data_bundle.py", line 100, in get_vocab raise KeyError(error_msg) KeyError: "DataBundle do NOT have Vocabulary named target. It should be one of dict_keys(['vocab'])."
To Reproduce def get_vocab(self, field_name: str) -> Vocabulary: r""" 获取field名为field_name对应的vocab
Expected behavior A clear and concise description of what you expected to happen. 清晰而简要地描述你期望的结果
Screenshots If applicable, add screenshots to help explain your problem. 如果可以,请提供截图
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here. 备注