yzhangcs / parser

:rocket: State-of-the-art parsers for natural language.
https://parser.yzhang.site/
MIT License
837 stars 143 forks source link

ModuleNotFoundError: No module named 'supar.parsers.con' #95

Closed tsingcoo closed 2 years ago

tsingcoo commented 2 years ago

Hi,

I tried your demo on your GitHub to create a constituency parser with the RoBerta CRF pre-trained model but get an error when loading.

from supar import Parser
parser = Parser.load('crf-con-roberta-en')

got this error:

Downloading: https://github.com/yzhangcs/parser/releases/download/v1.1.0/ptb.crf.con.roberta.zip to /root/.cache/supar/ptb.crf.con.roberta.zip
100%|██████████████████████████████████████████████████████████████████████████████████████████████| 1.22G/1.22G [03:37<00:00, 6.02MB/s]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/search/odin/system/anaconda3/lib/python3.7/site-packages/supar/parsers/parser.py", line 194, in load
    state = torch.load(path if os.path.exists(path) else download(supar.MODEL[src].get(path, path), reload=reload))
  File "/search/odin/system/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 607, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/search/odin/system/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 882, in _load
    result = unpickler.load()
  File "/search/odin/system/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 875, in find_class
    return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'supar.parsers.con'
yzhangcs commented 2 years ago

@tsingcoo Hi, this bug raises because the con module has been renamed to const and the released model has not been updated yet. Downgrading the package version to 1.1.1 would solve the issue.