我在删除其他任务后,保存模型,再次加载模型后报错:
HanLP.save(’/root/.hanlp/ner/close_ner_model’)
HanLP.load(’/root/.hanlp/ner/close_ner_model’)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/envs/hanlp/lib/python3.6/site-packages/hanlp/common/torch_component.py", line 174, in load
self.load_vocabs(save_dir)
File "/root/anaconda3/envs/hanlp/lib/python3.6/site-packages/hanlp/components/mtl/multi_task_learning.py", line 760, in load_vocabs
task.load_vocabs(save_dir, f'{task_name}_{filename}')
File "/root/anaconda3/envs/hanlp/lib/python3.6/site-packages/hanlp/common/torch_component.py", line 147, in load_vocabs
self.vocabs.load_vocabs(save_dir, filename)
File "/root/anaconda3/envs/hanlp/lib/python3.6/site-packages/hanlp/common/transform.py", line 136, in load_vocabs
vocabs.load_json(os.path.join(save_dir, filename))
File "/root/anaconda3/envs/hanlp/lib/python3.6/site-packages/hanlp_common/structure.py", line 64, in load_json
item = load_json(path)
File "/root/anaconda3/envs/hanlp/lib/python3.6/site-packages/hanlp_common/io.py", line 29, in load_json
with open(path, encoding='utf-8') as src:
FileNotFoundError: [Errno 2] No such file or directory: '/root/.hanlp/ner/close_ner_model/con_vocabs.json'