hankcs / HanLP

中文分词 词性标注 命名实体识别 依存句法分析 成分句法分析 语义依存分析 语义角色标注 指代消解 风格转换 语义相似度 新词发现 关键词短语提取 自动摘要 文本分类聚类 拼音简繁转换 自然语言处理

Home Page:https://hanlp.hankcs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

解析失败,提示升级hanlp

chn112211 opened this issue · comments

OS: Windows-10-10.0.19041-SP0
Python: 3.8.5
[2023-10-23 15:26:10,183] ERROR in app: Exception on /resumeFile [POST]
Traceback (most recent call last):
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp\utils\component_util.py", line 99, in load_from_meta_file
obj: Component = object_from_classpath(cls)
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp_common\reflection.py", line 27, in object_from_classpath
classpath = str_to_type(classpath)
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp_common\reflection.py", line 44, in str_to_type
cls = getattr(importlib.import_module(module_name), class_name)
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in load_unlocked
File "", line 783, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp\components\ner\transformer_ner.py", line 9, in
from hanlp.common.dataset import SamplerBuilder
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp\common\dataset.py", line 14, in
import torch
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\torch_init
.py", line 1429, in
from torch import optim as optim
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\optim_init
.py", line 8, in
from .adadelta import Adadelta
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\optim\adadelta.py", line 4, in
from .optimizer import (Optimizer, _use_grad_for_differentiable, _default_to_fused_or_foreach,
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\optim\optimizer.py", line 23, in
from typing_extensions import ParamSpec, Self, TypeAlias
ImportError: cannot import name 'ParamSpec' from 'typing_extensions' (C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\typing_extensions.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\flask\app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\flask\app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "D:\kzj\resume\hugh2020-haozhaome-hzm2_resume-\communicate.py", line 44, in get_resume_file
info = send_info(uploadId, resume_list)
File "D:\kzj\resume\hugh2020-haozhaome-hzm2_resume-\communicate.py", line 80, in send_info
"resumesInfo": get_resumes_info(resume_list)
File "D:\kzj\resume\hugh2020-haozhaome-hzm2_resume-\communicate.py", line 50, in get_resumes_info
all_info = get_all_info(f"data/{resume.file_name}")
File "D:\kzj\resume\hugh2020-haozhaome-hzm2_resume-\resume_parser\main.py", line 19, in get_all_info
model = hanlp.load('https://file.hankcs.com/hanlp/ner/msra_ner_electra_small_20220215_205503.zip')
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp_init_.py", line 43, in load
return load_from_meta_file(save_dir, 'meta.json', verbose=verbose, **kwargs)
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\hanlp\utils\component_util.py", line 161, in load_from_meta_file
import torch
File "C:\Users\keith\AppData\Local\Programs\Python\Python38\lib\site-packages\torch_init_.py", line 465, in
for name in dir(_C):
NameError: name '_C' is not defined

  • I've completed this form and searched the web for solutions.

建议您读一读《提问的智慧》