├── Dockerfile.cpu ├── README.md ├── LICENSE └── Dockerfile.gpu /Dockerfile.cpu: -------------------------------------------------------------------------------- 1 | FROM python:3.6-slim 2 | 3 | RUN apt-get update && apt-get install -y unixodbc-dev gcc g++ 4 | 5 | RUN pip install torch==0.4.1 6 | RUN pip install flair==0.3.2 7 | RUN pip install spacy==2.0.11 8 | 9 | RUN pip install \ 10 | dateparser==0.7.0 \ 11 | pymorphy2==0.8 \ 12 | yargy==0.11.0 \ 13 | natasha==0.10.0 \ 14 | nltk==3.2.1 \ 15 | yake==0.3.7 \ 16 | python-dateutil==2.7.5 17 | 18 | RUN python -m nltk.downloader stopwords && python -m nltk.downloader punkt && \ 19 | python -m nltk.downloader averaged_perceptron_tagger 20 | 21 | RUN python -c 'import flair; _ = flair.models.SequenceTagger.load("ner-fast")' 22 | 23 | CMD mkdir src 24 | WORKDIR src 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## How to use 2 | 3 | In your docker file write `FROM iwitaly/nlp:cpu` for CPU version or `FROM iwitaly/nlp:gpu` for GPU version. 4 | 5 | Find the image at Docker hub https://hub.docker.com/r/iwitaly/nlp/ 6 | 7 | 8 | ## Whats inside 9 | 10 | Modern NLP frameworks including deep learning: 11 | * torch==0.4.1 12 | * flair==0.3.2 13 | * spacy==2.0.11 14 | * dateparser==0.7.0 15 | * pymorphy2==0.8 16 | * yargy==0.11.0 17 | * natasha==0.10.0 18 | * nltk==3.2.1 19 | * yake==0.3.7 20 | 21 | 22 | ## How to build 23 | 24 | 25 | ### CPU 26 | 27 | ```bash 28 | docker build -t nlp-cpu -f ./Dockerfile.cpu . 29 | ``` 30 | 31 | ### GPU 32 | 33 | ```bash 34 | docker build -t nlp-gpu -f ./Dockerfile.gpu . 35 | ``` 36 | 37 | Please keep in mind that this version works with CUDA 10. Choose another base image if your GPU does not support it. 38 | 39 | You can find NVIDIA images here https://hub.docker.com/r/nvidia/cuda/ 40 | 41 | ## How to use 42 | 43 | `docker run -it --runtime=nvidia iwitaly/nlp:gpu nvidia-smi` 44 | 45 | You can also pass `CUDA_VISIBLE_DEVICES` environment variable. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Poteha Labs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile.gpu: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 2 | 3 | ENV LANG=C.UTF-8 4 | 5 | RUN apt-get update -y && apt-get install -y \ 6 | git \ 7 | wget \ 8 | curl \ 9 | cmake \ 10 | unzip \ 11 | software-properties-common \ 12 | unixodbc-dev \ 13 | gcc \ 14 | g++ 15 | 16 | # Install python 17 | RUN add-apt-repository -y ppa:jonathonf/python-3.6 \ 18 | && apt-get update -y \ 19 | && apt-get install -y python3.6 python3.6-dev \ 20 | && ln -sfn /usr/bin/python3.6 /usr/local/bin/python \ 21 | && ln -sfn /usr/bin/python3.6 /usr/bin/python3 \ 22 | && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ 23 | && python get-pip.py \ 24 | && rm get-pip.py \ 25 | && apt-get clean \ 26 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 27 | 28 | RUN pip install torch==0.4.1 29 | RUN pip install flair==0.3.2 30 | RUN pip install spacy==2.0.11 31 | 32 | RUN pip install \ 33 | dateparser==0.7.0 \ 34 | pymorphy2==0.8 \ 35 | yargy==0.11.0 \ 36 | natasha==0.10.0 \ 37 | nltk==3.2.1 \ 38 | yake==0.3.7 \ 39 | python-dateutil==2.7.5 40 | 41 | RUN python -m nltk.downloader stopwords && python -m nltk.downloader punkt && \ 42 | python -m nltk.downloader averaged_perceptron_tagger 43 | 44 | RUN python -c 'import flair; _ = flair.models.SequenceTagger.load("ner-fast")' 45 | 46 | CMD mkdir src 47 | WORKDIR src --------------------------------------------------------------------------------