Здравствуйте, не могу корректно работать с библиотекой DeepPavlov на удалённом сервере.
Сервер я использую VPS reg.ru - 4 ГБ • 2 ядра • 25 ГБ SSD
Ход действий установки на сервере.
Установка Python 3.7.10
sudo apt update
- обновляю список пакетов
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
- установка пакетов
wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz
tar -xf Python-3.7.10.tgz
cd Python-3.7.10
./configure --enable-optimizations
make -j 2
sudo make altinstall
Установка DeepPavlov
mkdir test_programm
cd test_programm
virtualenv env -p python3.7
source env/bin/activate
pip install deeppavlov
python -m deeppavlov install tfidf_logreg_en_faq
python -m deeppavlov interact tfidf_logreg_en_faq -d
В последнем пункте появлятся сообщение:
2021-04-20 12:45:49.778 INFO in 'deeppavlov.core.common.file'['file'] at line 32: Interpreting 'tfidf_logreg_en_faq' as '/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/configs/faq/tfidf_logreg_en_faq.json'
2021-04-20 12:45:50.896 INFO in 'deeppavlov.download'['download'] at line 132: Skipped http://files.deeppavlov.ai/faq/mipt/en_mipt_faq_v4.tar.gz?config=tfidf_logreg_en_faq download because of matching hashes
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/__main__.py", line 4, in
main()
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/deep.py", line 89, in main
interact_model(pipeline_config_path)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/commands/infer.py", line 79, in interact_model
model = build_model(config)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/commands/infer.py", line 62, in build_model
component = from_params(component_config, mode=mode, serialized=component_serialized)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/common/params.py", line 95, in from_params
obj = get_model(cls_name)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/common/registry.py", line 72, in get_model
return cls_from_str(_REGISTRY[name])
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/common/registry.py", line 40, in cls_from_str
return getattr(importlib.import_module(module_name), cls_name)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 953, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 953, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/models/__init__.py", line 17, in
import nltk
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/__init__.py", line 150, in
from nltk.translate import *
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/translate/__init__.py", line 23, in
from nltk.translate.meteor_score import meteor_score as meteor
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/translate/meteor_score.py", line 10, in
from nltk.stem.porter import PorterStemmer
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/stem/__init__.py", line 29, in
from nltk.stem.snowball import SnowballStemmer
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/stem/snowball.py", line 32, in
from nltk.corpus import stopwords
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/corpus/__init__.py", line 66, in
from nltk.corpus.reader import *
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/corpus/reader/__init__.py", line 105, in
from nltk.corpus.reader.panlex_lite import *
File "/root/test_programm/env/lib/python3.7/site-packages/nltk/corpus/reader/panlex_lite.py", line 15, in
import sqlite3
File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
Если запустить код обучения:
from deeppavlov.deprecated.skills.similarity_matching_skill import SimilarityMatchingSkill
faq_skill = SimilarityMatchingSkill(data_path = ‘/content/models.csv’,
x_col_name = ‘Question’,
y_col_name = ‘Answer’,
save_load_path = ‘./model’,
config_type = ‘tfidf_autofaq’,
train = True)
print(faq_skill([‘Каккие симптомы пневмонии?’], [], []))
То появлятся сообщение:
Traceback (most recent call last):
File "test.py", line 8, in
train = True)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/deprecated/skills/similarity_matching_skill/similarity_matching_skill.py", line 80, in __init__
self.model = train_model(model_config, download=True)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/__init__.py", line 29, in train_model
train_evaluate_model_from_config(config, download=download, recursive=recursive)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/commands/train.py", line 92, in train_evaluate_model_from_config
data = read_data_by_config(config)
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/commands/train.py", line 51, in read_data_by_config
reader = get_model(reader_config.pop('class_name'))()
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/common/registry.py", line 72, in get_model
return cls_from_str(_REGISTRY[name])
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/core/common/registry.py", line 40, in cls_from_str
return getattr(importlib.import_module(module_name), cls_name)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/test_programm/env/lib/python3.7/site-packages/deeppavlov/dataset_readers/faq_reader.py", line 17, in
from pandas import read_csv
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/__init__.py", line 55, in
from pandas.core.api import (
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/core/api.py", line 24, in
from pandas.core.groupby import Grouper, NamedAgg
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/core/groupby/__init__.py", line 1, in
from pandas.core.groupby.generic import ( # noqa: F401
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 44, in
from pandas.core.frame import DataFrame
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/core/frame.py", line 88, in
from pandas.core.generic import NDFrame, _shared_docs
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/core/generic.py", line 70, in
from pandas.io.formats.format import DataFrameFormatter, format_percentiles
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/io/formats/format.py", line 48, in
from pandas.io.common import _expand_user, _stringify_path
File "/root/test_programm/env/lib/python3.7/site-packages/pandas/io/common.py", line 3, in
import bz2
File "/usr/local/lib/python3.7/bz2.py", line 19, in
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
При тестировании в Google Colab всё работало.
Подскажите, пожалуйста, в чём проблема?
Код я из пользую из этой директории - GitHub - NikitaAkimov/test_deeppavlov