AdaSeq icon indicating copy to clipboard operation
AdaSeq copied to clipboard

[Question] running self trained NER model causes errors

Open breadbread1984 opened this issue 6 months ago • 1 comments

What is your question?

error message:

Traceback (most recent call last):
  File "/root/raid/electrolyte_papers_extraction/NER/ner.py", line 31, in <module>
    ner = NER('ckpt/ner/240731013859.938009/output_best', device = 'gpu')
  File "/root/raid/electrolyte_papers_extraction/NER/ner.py", line 12, in __init__
    self.pipeline = pipeline(Tasks.named_entity_recognition, abspath(ckpt), device = device)
  File "/usr/local/lib/python3.10/dist-packages/modelscope/pipelines/builder.py", line 169, in pipeline
    return build_pipeline(cfg, task_name=task)
  File "/usr/local/lib/python3.10/dist-packages/modelscope/pipelines/builder.py", line 65, in build_pipeline
    return build_from_cfg(
  File "/usr/local/lib/python3.10/dist-packages/modelscope/utils/registry.py", line 215, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
RuntimeError: SequenceLabelingPipeline: SequenceLabelingModel: TransformerEmbedder: Try loading from huggingface and modelscope failed 

huggingface:
The request model: google-bert/bert-base-cased does not exist!

modelscope:
The request model: google-bert/bert-base-cased does not exist!

self trained NER checkpoint:

https://github.com/breadbread1984/electrolyte_papers_extraction/tree/main/NER/ckpt/ner/240731013859.938009

What have you tried?

under ckpt/ner/. edit <path/to/latest/checkpoint>/output_best/configuration.json to change the following lines

from

    "plugins": [
        "adaseq"
    ]

to

    "plugins": [
        "https://files.pythonhosted.org/packages/49/47/ddf684253dbb4c3e0716fcda67094aa3c407237d5eb8930ede0a91b9feb8/adaseq-0.6.6-py3-none-any.whl"
    ]

Code (if necessary)

source code:

from os.path import abspath
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
pipeline_ = pipeline(Tasks.named_entity_recognition, abspath('ckpt/ner/240731013859.938009/output_best'), device = 'gpu')

What's your environment?

  • AdaSeq Version (e.g., 1.0 or master): 0.6.6
  • ModelScope Version (e.g., 1.0 or master): 1.16.1
  • PyTorch Version (e.g., 1.12.1): 2.2.0a0+81ea7a4
  • OS (e.g., Ubuntu 20.04): Ubuntu 22.04.3 LTS
  • Python version: 3.10.12
  • CUDA/cuDNN version: 8.9.7.29-1+cuda12.2
  • GPU models and configuration: A100
  • Any other relevant information:

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

breadbread1984 avatar Jul 31 '24 08:07 breadbread1984