deeppavlov / DeepPavlov

An open source library for deep learning end-to-end dialog systems and chatbots.
https://deeppavlov.ai
Apache License 2.0
6.67k stars 1.14k forks source link

The demo for the NER model contains an incorrect model name #1679

Closed VITEK-THE-BEST closed 8 months ago

VITEK-THE-BEST commented 8 months ago

Issue: On the deeppavlov demo site for the NER model (https://demo.deeppavlov.ai/#/integration/token_ner ) in the "Integration" tab there is an example of running the model locally. This example specifies the ner_bert_base_mult model, which is not in the repository.

Launching the CLI example from the site:

$ python -m deeppavlov interact ner_bert_base_mult -di

Command that led to error:

Traceback (most recent call last):
  File "D:\conda\envs\torch\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\conda\envs\torch\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\conda\envs\torch\lib\site-packages\deeppavlov\__main__.py", line 4, in <module>
    main()
  File "D:\conda\envs\torch\lib\site-packages\deeppavlov\deep.py", line 62, in main
    install_from_config(pipeline_config_path)
  File "D:\conda\envs\torch\lib\site-packages\deeppavlov\utils\pip_wrapper\pip_wrapper.py", line 56, in install_from_config
    requirements_files = get_config_requirements(config)
  File "D:\conda\envs\torch\lib\site-packages\deeppavlov\utils\pip_wrapper\pip_wrapper.py", line 43, in get_config_requirements
    config = parse_config(config)
  File "D:\conda\envs\torch\lib\site-packages\deeppavlov\core\commands\utils.py", line 121, in parse_config
    config = read_json(find_config(config))
  File "D:\conda\envs\torch\lib\site-packages\deeppavlov\core\common\file.py", line 53, in read_json
    with open(fpath, encoding='utf8') as fin:
FileNotFoundError: [Errno 2] No such file or directory: 'ner_bert_base_mult'

Running the Python example from the site:

from deeppavlov import build_model     
model = build_model('ner_bert_base_mult', download=True, install=True)
model(['John, did you set a weekly appointment reminder? Can’t find it in my inbox.'])

Command that led to error:


---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[1], [line 2](vscode-notebook-cell:?execution_count=1&line=2)
      [1](vscode-notebook-cell:?execution_count=1&line=1) from deeppavlov import build_model     
----> [2](vscode-notebook-cell:?execution_count=1&line=2) model = build_model('ner_bert_base_mult', download=True, install=True)
      [3](vscode-notebook-cell:?execution_count=1&line=3) model(['John, did you set a weekly appointment reminder? Can’t find it in my inbox.'])

File [d:\conda\envs\torch\lib\site-packages\deeppavlov\core\commands\infer.py:34](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:34), in build_model(config, mode, load_trained, install, download)
     [31](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:31) def build_model(config: Union[str, Path, dict], mode: str = 'infer',
     [32](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:32)                 load_trained: bool = False, install: bool = False, download: bool = False) -> Chainer:
     [33](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:33)     """Build and return the model described in corresponding configuration file."""
---> [34](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:34)     config = parse_config(config)
     [36](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:36)     if install:
     [37](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/infer.py:37)         install_from_config(config)

File [d:\conda\envs\torch\lib\site-packages\deeppavlov\core\commands\utils.py:121](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:121), in parse_config(config, overwrite)
    [111](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:111) """Apply metadata.variables values to placeholders inside config and update nested configs using overwrite parameter
    [112](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:112) 
    [113](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:113) Args:
   (...)
    [118](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:118) 
    [119](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:119) """
    [120](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:120) if isinstance(config, (str, Path)):
--> [121](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:121)     config = read_json(find_config(config))
    [123](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:123) if overwrite is not None:
    [124](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/commands/utils.py:124)     for key, value in overwrite.items():

File [d:\conda\envs\torch\lib\site-packages\deeppavlov\core\common\file.py:53](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/common/file.py:53), in read_json(fpath)
     [52](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/common/file.py:52) def read_json(fpath: Union[str, Path]) -> dict:
---> [53](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/common/file.py:53)     with open(fpath, encoding='utf8') as fin:
     [54](file:///D:/conda/envs/torch/lib/site-packages/deeppavlov/core/common/file.py:54)         return json.load(fin, object_pairs_hook=OrderedDict)

FileNotFoundError: [Errno 2] No such file or directory: 'ner_bert_base_mult'```
nicolay-r commented 8 months ago

Hi, @VITEK-THE-BEST, i think it should be ner_ontonotes_bert_mult So far I experiment with this model (ner_ontonotes_bert) and ner_ontonotes_bert_mult form a separated projects which is purely focused on NER application: https://github.com/nicolay-r/ner-service Feel free to check out, I can confirm it could be launched in deeppavlov==1.3.0

VITEK-THE-BEST commented 8 months ago

Thanks for the reply @nicolay-r. I can run the ner_ontonotes_bert_mult model locally. But the models have different output classes. For example: Locally running model ner_ontonotes_bert_mult :

Computer Sciences Corp., El Segundo, Calif., the capitalization of which exceeds 150 million dollars, is no longer able to access its page on Facebook
ORG────────────────────  GPE───────  GPE───                                      MONEY──────────────                                          ORG─────
 and Instagram developed by Meta. Meta signalled this move would be coming as a response to this company's lobbying of the Online News Act, Bill C-18.
     ORG──────              ORG── ORG─                                                                                 LAW────────────────  LAW───────
 According to the annual report, after the adoption of these laws, the number of Meta users decreased by 10%.
                  DATE──                                                         ORG─                    PER                                                                       

But on the deeppavlov demo website, the following result is: image

The model on the site contains other classes. I also noticed that the quality of the model on the site is often better than that of ner_ontonotes_bert_mult

nicolay-r commented 8 months ago

@VITEK-THE-BEST, i see, thanks for update! I believe that demo adopts another model or checkpoint rather the one I advertised. Could you please share the link on this demo, so I can have a look on how we can reproduce it?

vaskonov commented 8 months ago

@VITEK-THE-BEST Thank you very much for your interest in NER DeepPavlov model. That's true the current version of the demo contains incorrect link to the NER model. The demo NER model (with many entities) will be added to the upcoming release of the DeepPavlov library. Please follow tg group DeepPavlovDreamDiscussions to get new updates and ask questions regarding the library.

nicolay-r commented 8 months ago

@vaskonov, thanks for the clarification and sorting this out!

VITEK-THE-BEST commented 8 months ago

Thanks @vaskonov ! I am looking forward to the release of the new ner model!