poteha / docker-nlp

Docker images for production NLP usage including deep learning
MIT License
35 stars 13 forks source link

Upgrade Flair to version 0.7 #2

Open michaelwechner opened 3 years ago

michaelwechner commented 3 years ago

Hi

I just tried to create the Docker image locally "docker build -t nlp-cpu -f ./Dockerfile.cpu ." but received the following error:


Step 7/10 : RUN python -m nltk.downloader stopwords && python -m nltk.downloader punkt && python -m nltk.downloader averaged_perceptron_tagger ---> Running in 1deffd426a6e /usr/local/lib/python3.6/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) [nltk_data] Downloading package stopwords to /root/nltk_data... [nltk_data] Unzipping corpora/stopwords.zip. /usr/local/lib/python3.6/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) [nltk_data] Downloading package punkt to /root/nltk_data... [nltk_data] Unzipping tokenizers/punkt.zip. /usr/local/lib/python3.6/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /root/nltk_data... [nltk_data] Unzipping taggers/averaged_perceptrontagger.zip. Removing intermediate container 1deffd426a6e ---> 77e530685b52 Step 8/10 : RUN python -c 'import flair; = flair.models.SequenceTagger.load("ner-fast")' ---> Running in c0a46d8d35e7 Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/site-packages/flair/init.py", line 2, in from . import models File "/usr/local/lib/python3.6/site-packages/flair/models/init.py", line 1, in from .sequence_tagger_model import SequenceTagger File "/usr/local/lib/python3.6/site-packages/flair/models/sequence_tagger_model.py", line 10, in import flair.embeddings File "/usr/local/lib/python3.6/site-packages/flair/embeddings.py", line 13, in from .file_utils import cached_path File "/usr/local/lib/python3.6/site-packages/flair/fileutils.py", line 14, in import requests ModuleNotFoundError: No module named 'requests' The command '/bin/sh -c python -c 'import flair; = flair.models.SequenceTagger.load("ner-fast")'' returned a non-zero code: 1


and noticed that the Dockerfile.cpu is referencing flair version 0.3.2

I would like to upgrade to the most recent flair version 0.7, but just changing the version number did not work, so I guess I also need to update the rest of the Dockerfile. Any hints what would be necessary to do would be appreciated, thanks!