1

我正在尝试在 GoogleColab 上开始 deeppavlov 模型训练:

with configs.ner.ner_ontonotes_bert_mult.open(encoding='utf8') as f:
    nerconfig = json.load(f)
nerconfig['dataset_reader']['data_path'] = '/content/drive/MyDrive/ntiii/train_test'
nerconfig['metadata']['variables']['NER_PATH'] = '/content/drive/MyDrive/ntiii/'
nerconfig['metadata']['download'] = [nerconfig['metadata']['download'][-1]]
with open('/content/drive/MyDrive/ntiii/train_test/conf.json', 'w', encoding="utf-8") as f:
    json.dump(nerconfig, f)
!python -m deeppavlov train '/content/drive/MyDrive/ntiii/train_test/conf.json'

并得到错误:

[nltk_data] Downloading package punkt to /root/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
[nltk_data] Downloading package stopwords to /root/nltk_data...
[nltk_data]   Package stopwords is already up-to-date!
[nltk_data] Downloading package perluniprops to /root/nltk_data...
[nltk_data]   Package perluniprops is already up-to-date!
[nltk_data] Downloading package nonbreaking_prefixes to
[nltk_data]     /root/nltk_data...
[nltk_data]   Package nonbreaking_prefixes is already up-to-date!
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/__main__.py", line 4, in <module>
    main()
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/deep.py", line 85, in main
    start_epoch_num=args.start_epoch_num)
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/core/commands/train.py", line 121, in train_evaluate_model_from_config
    trainer.train(iterator)
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/core/trainers/nn_trainer.py", line 334, in train
    self.fit_chainer(iterator)
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/core/trainers/fit_trainer.py", line 104, in fit_chainer
    component = from_params(component_config, mode='train')
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/core/common/params.py", line 95, in from_params
    obj = get_model(cls_name)
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/core/common/registry.py", line 72, in get_model
    return cls_from_str(_REGISTRY[name])
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/core/common/registry.py", line 40, in cls_from_str
    return getattr(importlib.import_module(module_name), cls_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/dist-packages/deeppavlov/models/preprocessors/bert_preprocessor.py", line 19, in <module>
    from bert_dp.preprocessing import convert_examples_to_features, InputExample, InputFeatures
ModuleNotFoundError: No module named 'bert_dp'

我的代码基于http://docs.deeppavlov.ai/en/master/features/models/squad.html

请帮我解决这个问题

4

1 回答 1

0

请确保您已通过运行安装了所有模型要求

!python -m deeppavlov install '/content/drive/MyDrive/ntiii/train_test/conf.json'
于 2021-02-20T12:40:59.797 回答