File size: 3,869 Bytes
82a8009
44fc622
82a8009
 
500cbfa
82c0cdf
21d1d68
44fc622
 
82c0cdf
21d1d68
 
 
 
 
44fc622
 
 
 
 
e310801
500cbfa
82a8009
44fc622
 
82c0cdf
44fc622
 
 
 
7971fe4
82c0cdf
 
44fc622
 
 
f0a6209
7971fe4
500cbfa
 
 
7971fe4
500cbfa
7971fe4
82c0cdf
e82cba1
 
 
82c0cdf
 
 
e82cba1
7971fe4
44fc622
e235434
500cbfa
 
82c0cdf
e310801
82a8009
44fc622
 
 
 
 
 
 
 
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
69
# build with: docker build . --tag sctg/roco-idefics3:0.0.20 --tag sctg/roco-idefics3:latest --push
# run with 
# docker run --gpus all --user=42420:42420 -p 7000-8000:7000-8000 -p 8080:8080 -e WANDB_API_KEY=wdkfjzfjz -e HF_TOKEN=hf_TOKEN -it sctg/roco-idefics3:0.0.20 bash -i /start.sh sleep infinity
# docker run --gpus all --user=42420:42420 -p 7000-8000:7000-8000 -p 8080:8080 -it sctg/roco-idefics3:0.0.20 bash -i /start.sh python /learn.py hf_...
FROM cloudflare/cloudflared:latest as cloudflared
FROM nvidia/cuda:12.6.2-cudnn-devel-ubuntu22.04
ARG NODE_MAJOR="20"
RUN /usr/sbin/addgroup --gid 42420 ovh
RUN /usr/sbin/useradd -u 42420 --gid 42420 -m -d /workspace -s /bin/bash ovh
RUN apt update -y && apt-get install -y cmake curl git git-lfs screen sudo \
      && mkdir -p /etc/apt/keyrings \
      && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
      && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
      && apt-get update \
      && apt-get install nodejs -y
COPY --chmod=777 start.sh /start.sh
COPY learn.py /learn.py
# Mandatory to run the jobs in rootless mode
USER root
RUN chown -R 42420:42420 /workspace
RUN echo "ovh ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
COPY --from=cloudflared /usr/local/bin/cloudflared /usr/local/bin/cloudflared
RUN curl -JL https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v7.7.1/oauth2-proxy-v7.7.1.linux-amd64.tar.gz | tar -xz -C /usr/local/bin --strip-components=1
USER 42420
RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > /workspace/miniconda.sh
COPY bitsandbytes-0.45.0-cp312-cp312-linux_x86_64.whl /tmp/bitsandbytes-0.45.0-cp312-cp312-linux_x86_64.whl
RUN /bin/bash /workspace/miniconda.sh -b -p /workspace/.miniconda3
RUN . /workspace/.miniconda3/bin/activate && conda init --all
RUN . /workspace/.miniconda3/bin/activate \
    && pip install -U "safetensors>=0.4.5" \
    && pip install -U tensorflow \
    && pip install -U tf-keras \
    && pip install -U /tmp/bitsandbytes-0.45.0-cp312-cp312-linux_x86_64.whl \
    && pip install -U git+https://github.com/huggingface/transformers.git\
    && pip install huggingface_hub[cli] accelerate datasets peft\
    && pip install -U Pillow \
    && pip install -U torchvision torchaudio \
    && pip install jupyter_copilot \
    && pip install -U jupyterlab-git \
    && pip install -U jupyterlab-code-formatter \
    && pip install -U black isort \
    && pip install unsloth\
    && pip install gradio \
    && pip uninstall unsloth -y \
    && pip install --upgrade --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git \
    && pip install wandb \
    && pip install spaces \
    && pip install -U mistune
    
COPY --chmod=777 libbitsandbytes_cuda124.so /workspace/.miniconda3/lib/python3.12/site-packages/bitsandbytes/libbitsandbytes_cuda124.so
COPY --chmod=777 libbitsandbytes_cuda126.so /workspace/.miniconda3/lib/python3.12/site-packages/bitsandbytes/libbitsandbytes_cuda126.so
#RUN rm -f /tmp/bitsandbytes-0.45.0-cp312-cp312-linux_x86_64.whl

RUN . /workspace/.miniconda3/bin/activate && conda install -y jupyter
RUN rm -f /workspace/miniconda.sh
RUN mkdir -p /workspace/.config/github-copilot/
COPY apps.json.enc /workspace/.config/github-copilot/apps.json.enc
COPY kaggle.json.enc /workspace/.config/kaggle.json.enc
COPY CFTOKEN.enc /workspace/.config/CFTOKEN.enc
COPY oauth2.cfg.enc /workspace/.config/oauth2.cfg.enc
# Mandatory to run the jobs in rootless mode
# USER root
# RUN chown -R 42420:42420 /workspace
USER 42420
WORKDIR /workspace
# RUN export HOME=/workspace && cd /workspace && . /workspace/.miniconda3/bin/activate \
#     && mkdir -p /workspace/data \
#     && python /preload.py