radames commited on
Commit
260c01a
1 Parent(s): a9ba4b6
Files changed (2) hide show
  1. Dockerfile +45 -0
  2. run.sh +19 -0
Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvcr.io/nvidia/pytorch:22.10-py3
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ RUN apt-get update && apt-get install --no-install-recommends -y \
8
+ build-essential \
9
+ git \
10
+ ffmpeg \
11
+ libsm6 libxext6 libxrender-dev \
12
+ wget \
13
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
14
+
15
+ WORKDIR /home/user
16
+
17
+
18
+ RUN git clone https://github.com/microsoft/unilm.git .
19
+
20
+ # Set up a new user named "user" with user ID 1000
21
+ RUN useradd -m -u 1000 user
22
+ # Switch to the "user" user
23
+ # Set home to the user's home directory
24
+ ENV HOME=/home/user \
25
+ PATH=/home/user/.local/bin:$PATH \
26
+ GRADIO_ALLOW_FLAGGING=never \
27
+ GRADIO_NUM_PORTS=1 \
28
+ GRADIO_SERVER_NAME=0.0.0.0 \
29
+ GRADIO_THEME=huggingface \
30
+ SYSTEM=spaces
31
+
32
+ RUN mkdir ./kosmos-g/kosmosg_checkpoints
33
+ # RUN wget -q https://huggingface.co/radames/Kosmos-G/resolve/main/ViT-L-14-sd.pt -P ./kosmos-g/kosmosg_checkpoints
34
+ # RUN wget -q https://huggingface.co/radames/Kosmos-G/resolve/main/checkpoint_stage1.pt -P ./kosmos-g/kosmosg_checkpoints
35
+ # RUN wget -q https://huggingface.co/radames/Kosmos-G/resolve/main/checkpoint_stage1.pt -P ./kosmos-g/kosmosg_checkpoints
36
+ RUN wget -q https://huggingface.co/radames/Kosmos-G/resolve/main/checkpoint_final.pt -P ./kosmos-g/kosmosg_checkpoints/
37
+
38
+ RUN chown -R user:user /home/user/
39
+ WORKDIR $HOME/kosmos-g
40
+ RUN bash vl_setup.sh
41
+
42
+ USER user
43
+ COPY --chown=user . $HOME/kosmos-g
44
+
45
+ CMD ["bash", "run.sh"]
run.sh ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pip install -v -U git+https://github.com/facebookresearch/xformers.git@v0.0.22 && \
2
+ # git clone https://github.com/NVIDIA/apex.git && cd apex && pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./ && cd .. && rm -rf apex &&
3
+ # pip install -U ./torchscale ./open_clip ./fairseq ./infinibatch && \
4
+ python3 -m torch.distributed.launch --nproc_per_node=1 --nnodes=1 \
5
+ app.py None \
6
+ --task kosmosg \
7
+ --criterion kosmosg \
8
+ --arch kosmosg_xl \
9
+ --required-batch-size-multiple 1 \
10
+ --dict-path data/dict.txt \
11
+ --spm-model data/sentencepiece.bpe.model \
12
+ --memory-efficient-fp16 \
13
+ --ddp-backend=no_c10d \
14
+ --distributed-no-spawn \
15
+ --subln \
16
+ --sope-rel-pos \
17
+ --checkpoint-activations \
18
+ --flash-attention \
19
+ --pretrained-ckpt-path ./kosmosg_checkpoints/checkpoint_final.pt