Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +31 -28
Dockerfile
CHANGED
@@ -13,26 +13,28 @@ RUN apt-get update && \
|
|
13 |
apt-get install -y unzip && \
|
14 |
apt-get install -y git && \
|
15 |
git clone https://github.com/lydianish/RoLASER.git /app/RoLASER
|
|
|
|
|
16 |
|
17 |
# Clone the RoLASER repository into the container
|
18 |
WORKDIR /app/RoLASER
|
19 |
|
20 |
# Create conda environment with the required Python and GCC versions
|
21 |
COPY --chown=user environment.yml /app/RoLASER/environment.yml
|
22 |
-
RUN conda env create -f environment.yml
|
23 |
-
|
24 |
ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
|
25 |
|
26 |
# Install PyTorch 1.10.1
|
27 |
RUN pip3 install --no-cache-dir torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html
|
28 |
|
29 |
# Install Fairseq and dependencies
|
30 |
-
RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq \
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
WORKDIR /app/fairseq
|
38 |
ENV FAIRSEQ /app/fairseq
|
@@ -42,45 +44,46 @@ RUN git clone https://github.com/lydianish/LASER.git /app/LASER
|
|
42 |
WORKDIR /app/LASER
|
43 |
ENV LASER /app/LASER
|
44 |
|
45 |
-
RUN git checkout rolaser \
|
46 |
-
|
47 |
-
|
48 |
|
49 |
# Install other RoLASER dependencies
|
50 |
WORKDIR /app/RoLASER
|
51 |
RUN pip3 install --no-cache-dir -r /app/ROLASER_requirements.txt
|
52 |
ENV ROLASER /app/RoLASER
|
53 |
|
54 |
-
# Switch to the non-root user
|
55 |
-
USER user
|
56 |
-
|
57 |
# Download models
|
58 |
WORKDIR /app/RoLASER/models
|
59 |
-
RUN wget https://zenodo.org/api/records/10864557/files-archive
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
|
70 |
# Set Python system path to find the Fairseq and LASER modules
|
71 |
ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
|
72 |
ENV PYTHONPATH $PYTHONPATH:$LASER/source
|
73 |
|
|
|
|
|
74 |
# Set home to the user's home directory
|
75 |
ENV HOME /home/user
|
76 |
ENV PATH $HOME/.local/bin:$PATH
|
77 |
|
78 |
-
|
79 |
-
|
80 |
# Set the working directory to the user's home directory
|
81 |
-
|
82 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
83 |
-
|
84 |
|
85 |
EXPOSE 8501
|
86 |
CMD streamlit run app.py \
|
|
|
13 |
apt-get install -y unzip && \
|
14 |
apt-get install -y git && \
|
15 |
git clone https://github.com/lydianish/RoLASER.git /app/RoLASER
|
16 |
+
apt-get clean && \
|
17 |
+
rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
# Clone the RoLASER repository into the container
|
20 |
WORKDIR /app/RoLASER
|
21 |
|
22 |
# Create conda environment with the required Python and GCC versions
|
23 |
COPY --chown=user environment.yml /app/RoLASER/environment.yml
|
24 |
+
RUN conda env create -f environment.yml \
|
25 |
+
&& echo "conda activate rolaser_env" >> ~/.bashrc
|
26 |
ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
|
27 |
|
28 |
# Install PyTorch 1.10.1
|
29 |
RUN pip3 install --no-cache-dir torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html
|
30 |
|
31 |
# Install Fairseq and dependencies
|
32 |
+
RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq && \
|
33 |
+
cd /app/fairseq && \
|
34 |
+
git checkout rolaser && \
|
35 |
+
pip3 install --no-cache-dir --editable . && \
|
36 |
+
python3 setup.py build_ext --inplace && \
|
37 |
+
pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt
|
38 |
|
39 |
WORKDIR /app/fairseq
|
40 |
ENV FAIRSEQ /app/fairseq
|
|
|
44 |
WORKDIR /app/LASER
|
45 |
ENV LASER /app/LASER
|
46 |
|
47 |
+
RUN git checkout rolaser && \
|
48 |
+
bash ./install_external_tools.sh && \
|
49 |
+
pip3 install --no-cache-dir -r /app/LASER_requirements.txt
|
50 |
|
51 |
# Install other RoLASER dependencies
|
52 |
WORKDIR /app/RoLASER
|
53 |
RUN pip3 install --no-cache-dir -r /app/ROLASER_requirements.txt
|
54 |
ENV ROLASER /app/RoLASER
|
55 |
|
|
|
|
|
|
|
56 |
# Download models
|
57 |
WORKDIR /app/RoLASER/models
|
58 |
+
RUN wget https://zenodo.org/api/records/10864557/files-archive && \
|
59 |
+
unzip files-archive && \
|
60 |
+
mkdir $LASER/models && \
|
61 |
+
mv laser* $LASER/models && \
|
62 |
+
mkdir RoLASER && \
|
63 |
+
mv rolaser* RoLASER/ && \
|
64 |
+
mkdir c-RoLASER && \
|
65 |
+
mv c-rolaser* c-RoLASER/ && \
|
66 |
+
rm files-archive
|
67 |
+
COPY --chown=user . /app/RoLASER/models
|
68 |
+
WORKDIR /app/LASER/models
|
69 |
+
COPY --chown=user . /app/LASER/models
|
70 |
|
71 |
# Set Python system path to find the Fairseq and LASER modules
|
72 |
ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
|
73 |
ENV PYTHONPATH $PYTHONPATH:$LASER/source
|
74 |
|
75 |
+
# Switch to the non-root user
|
76 |
+
USER user
|
77 |
# Set home to the user's home directory
|
78 |
ENV HOME /home/user
|
79 |
ENV PATH $HOME/.local/bin:$PATH
|
80 |
|
81 |
+
WORKDIR $HOME
|
82 |
+
RUN mkdir app
|
83 |
# Set the working directory to the user's home directory
|
84 |
+
WORKDIR $HOME/app
|
85 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
86 |
+
COPY --chown=user . $HOME/app
|
87 |
|
88 |
EXPOSE 8501
|
89 |
CMD streamlit run app.py \
|