Sign inSign up

ekoerner/contextual-props-de

By ekoerner

•Updated over 3 years ago

A convenience Docker image for running https://github.com/ChristianHesels/contextual-props-de

Image
0

951

ekoerner/contextual-props-de repository overview

See https://github.com/ChristianHesels/contextual-props-de⁠

Convenience image:

  • Java (JDK) 8
  • Python 3.7
  • with installed dependencies (tensorflow 1.15 etc.) ~900MB
  • includes all google drive hosted files like models and jars ~9GB
>> Dockerfile (click me to expand)
FROM eclipse-temurin:8-jdk-focal

# install system dependencies for extracting archives, compiling and running python
# NOTE: installing python3.7 since tensorflow 1.15 (latest legacy one) requires this
RUN apt-get update \
    && apt-get -y install --no-install-recommends software-properties-common \
    && add-apt-repository -y ppa:deadsnakes/ppa \
    && apt-get update \
    && apt-get -y install --no-install-recommends curl wget unzip htop git nano less openssh-server default-libmysqlclient-dev build-essential \
    && apt-get -y install --no-install-recommends python3.7 python3.7-dev python3.7-venv \
    && update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 \
    && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# add a user (for ssh login or other stuff)
RUN useradd -rm -d /home/conprode -s /bin/bash -g root -u 1000 conprode

#USER conprode

WORKDIR /home/conprode

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_ROOT_USER_ACTION=ignore
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
ENV PATH="/opt/venv/bin:$PATH"

# create virtual environment and add to path (line above)
RUN python3 -m ensurepip \
    && python3 -m venv /opt/venv \
    && python3 -m pip install -U pip setuptools wheel
RUN python3 -m pip install gdown

# clone all code repos for folder structure (data etc.)
# can then also be linked if other code repos are used
RUN mkdir -p /home/conprode \
    && git clone https://github.com/ChristianHesels/contextual-props-de.git /home/conprode/contextual-props-de \
    && mkdir -p /home/conprode/contextual-props-de/ext/mate-model \
    && mkdir -p /home/conprode/contextual-props-de/tmp \
    && git clone https://github.com/ChristianHesels/e2e-german.git /home/conprode/contextual-props-de/ext/e2e \
    && mkdir -p /home/conprode/contextual-props-de/ext/e2e/data \
    && mkdir -p /home/conprode/contextual-props-de/ext/e2e/logs/props \
    && git clone https://github.com/ChristianHesels/CorZu.git /home/conprode/contextual-props-de/ext/CorZu_v2.0 \
    && 2to3-3.7 -nw /home/conprode/contextual-props-de/ext/CorZu_v2.0/*.py \
    && git clone https://github.com/conll/reference-coreference-scorers.git /home/conprode/contextual-props-de/ext/e2e/evaluate/scorer

WORKDIR /home/conprode/contextual-props-de/ext

# TODO: this needs to be downloaded manually as I couldn't easily get it to download via CLI
COPY transition-1.30.jar /home/conprode/contextual-props-de/ext/transition-1.30.jar
COPY lemma-ger-3.6.model /home/conprode/contextual-props-de/ext/mate-model/lemma-ger.model
#gdown 'https://drive.google.com/uc?export=download&id=0B-qbj-8rtoUMbVEzWDlvd0ZxVFU' -O transition-1.30.jar
#gdown 'https://drive.google.com/uc?export=download&id=0B-qbj-8rtoUMaUVsWUFuOE81ZW8' -O mate-model/lemma-ger.model

RUN wget -nv 'http://ltmaggie.informatik.uni-hamburg.de/jobimtext/wordpress/wp-content/uploads/2015/10/collapsing-asl.zip' -O collapsing-asl.zip \
    && unzip -q collapsing-asl.zip \
    && mv collapsing-asl/org.jobimtext.collapsing.jar org.jobimtext.collapsing.jar \
    && mv collapsing-asl/org.jobimtext.collapsing_lib org.jobimtext.collapsing_lib \
    && rm -rf collapsing-asl collapsing-asl.zip

WORKDIR /home/conprode/contextual-props-de/ext/e2e

# and now download and prepare all the data/models/etc.
# done here as this takes a long time and easier to symlink files than download again
# if you need/want/are required to work with your own (fork of) code then create a parallel folder and symlink!
# Layer ~9GB
RUN cd logs \
    && gdown '1L-kKxzlC0pPr_tJzRyi9xoTOKSPQXfNb' -O e2e_german_model.tar.xz \
    && tar xvf e2e_german_model.tar.xz \
    && mv final/* props/ \
    && rm -rf final e2e_german_model.tar.xz \
    && cd .. \
    && cd data \
    && gdown '1nN_qc3qHtPecxek0LsYf544ipJpfXEfj' -O glove_embeddings.tar.xz \
    && tar xvf glove_embeddings.tar.xz  \
    && rm -f glove_embeddings.tar.xz \
    && gdown 'https://drive.google.com/uc?export=download&id=1DuxqfFluLo_eMqY6PHZPJ2ePngz8C90y' -O char_vocab.txt

WORKDIR /home/conprode/contextual-props-de

# install python dependencies (that's why we cloned all the repos above)
# Layer ~900MB
RUN python3 -m pip install nltk \
    && python3 -c 'import nltk; nltk.download("punkt")' \
    && echo "neo4j" >> /home/conprode/contextual-props-de/requirements.txt \
    && python3 -m pip install -r /home/conprode/contextual-props-de/requirements.txt \
    && sed -i 's/tensorflow-gpu>=1.13.1/tensorflow>=1.14,<2.0/' /home/conprode/contextual-props-de/ext/e2e/requirements.txt \
    && sed -i 's/sklearn/scikit-learn<0.23/' /home/conprode/contextual-props-de/ext/e2e/requirements.txt \
    && echo "protobuf<=3.20" >> /home/conprode/contextual-props-de/ext/e2e/requirements.txt \
    && python3 -m pip install -r /home/conprode/contextual-props-de/ext/e2e/requirements.txt \
    && cd /home/conprode/contextual-props-de/ext/e2e && ./setup_all.sh

# startup
ENTRYPOINT [ "python3", "props_corzu_e2e.py" ]

Tag summary

Content type

Image

Digest

sha256:6d2d94a64…

Size

4 GB

Last updated

over 3 years ago

docker pull ekoerner/contextual-props-de