forked from allenai/unified-io-inference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VizWiz.Dockerfile
68 lines (56 loc) · 2.81 KB
/
VizWiz.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
LABEL name="unified-io-inference"
WORKDIR /root/.conda
WORKDIR /root
RUN apt-get update && apt-get -y install wget nano
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
ENV PATH=/opt/conda/bin:${PATH}
RUN bash -c "conda update -n base -c defaults conda"
RUN wget -nv https://ai2-prior-uio.s3.us-west-2.amazonaws.com/public/model-weights-bin/xl_1000k.bin \
-O xl.bin
RUN wget -nv https://ai2-prior-uio.s3.us-west-2.amazonaws.com/public/model-weights-bin/large_1000k.bin \
-O large.bin
RUN wget -nv https://ai2-prior-uio.s3.us-west-2.amazonaws.com/public/model-weights-bin/base_1000k.bin \
-O base.bin
RUN wget -nv https://ai2-prior-uio.s3.us-west-2.amazonaws.com/public/model-weights-bin/small_1000k.bin \
-O small.bin
RUN wget -nv https://farm2.staticflickr.com/1362/1261465554_95741e918b_z.jpg -O dbg_img.png
COPY uioi.yml .
RUN bash -c "conda env create -f uioi.yml"
COPY requirements.txt .
RUN bash -c ". activate uioi && pip install --upgrade pip \
&& pip install --upgrade "jax[cuda]" \
-f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html \
&& python3 -m pip install -r requirements.txt"
RUN bash -c ". activate uioi && pip install matplotlib notebook numpy==1.23.5 nvidia-cudnn-cu11==8.6.0.163 setuptools wheel spacy webdataset && python3 -m spacy download en_core_web_sm"
ENV PYTHONPATH=/root/uio
RUN apt-get -y install openjdk-8-jdk
RUN apt-get update && apt-get -y upgrade && apt-get -y install unzip
RUN apt-get update && apt-get -y upgrade && apt-get -y install git
WORKDIR /root/vizwiz/
RUN git clone https://github.com/Yinan-Zhao/vizwiz-caption.git
WORKDIR /root/vizwiz/vizwiz-caption
RUN bash ./get_stanford_models.sh
COPY eval-vizwiz.py .
WORKDIR /root
COPY vizwiz.yml .
RUN bash -c "conda env create -f vizwiz.yml"
RUN bash -c ". activate vizwiz && pip install --upgrade pip \
&& python3 -m pip install matplotlib notebook numpy==1.23.5"
WORKDIR /root/vizwiz/vizwiz-caption/annotations
# TODO create small sample annotations file for testing
COPY val.json val.json
ENV CLASSPATH=.;/root/vizwiz/vizwiz-caption;/root/vizwiz/vizwiz-caption/vizwiz_eval_cap/tokenizer
WORKDIR /root/vizwiz/vizwiz-caption
#RUN bash -c ". activate vizwiz && python3 eval-vizwiz.py"
WORKDIR /root
COPY . .
ENV PYTHONPATH=/root:/root/uio:/root/vizwiz/vizwiz-caption
RUN bash -c ". activate uioi && python ./uio/test/check.py"
ENV OUTPUT_FILE=/output/vizwiz-captions.json
ENV IMAGE_DIR=/images
ENV SAMPLE_COUNT=5
ENTRYPOINT bash -c ". activate uioi && touch $OUTPUT_FILE && python ./caption-vizwiz.py xl xl.bin $VIZWIZ_FILE $IMAGE_DIR $OUTPUT_FILE $SAMPLE_COUNT && . deactivate && . activate vizwiz && python ./eval-vizwiz.py ${VIZWIZ_FILE} ${OUTPUT_FILE}"