File size: 2,106 Bytes
5c5e3cb
 
205d3ba
18dd498
bda7b65
 
 
 
 
 
6949a68
 
bda7b65
 
 
 
116c46b
 
 
 
6fa1731
116c46b
feb2a2f
b69a5bc
116c46b
e0d1db5
 
d5afe14
e0d1db5
 
 
 
 
 
 
 
 
 
 
 
a285ee6
116c46b
 
 
 
 
 
bda7b65
7081f25
f8b4d06
5c5e3cb
 
 
 
116c46b
205d3ba
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
# Use an official PyTorch image with CUDA support as the base image
FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime


# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory to the user's home directory
WORKDIR $HOME/app

# Clone your repository or add your code to the container
RUN git clone -b dev https://github.com/camenduru/DiffBIR $HOME/app

# Install Python dependencies
RUN pip3 install -q einops pytorch_lightning gradio omegaconf xformers==0.0.20 transformers lpips opencv-python

# Install open_clip from GitHub
RUN pip3 install -q git+https://github.com/mlfoundations/open_clip@v2.20.0

# Use sudo to install aria2 with elevated privileges
USER root
RUN apt-get update && apt-get install -y sudo wget libgl1-mesa-glx && \
    wget https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0.tar.gz && \
    tar -xzvf aria2-1.36.0.tar.gz && \
    cd aria2-1.36.0 && \
    ./configure && \
    make && \
    make install && \
    cd .. && \
    rm -rf aria2-1.36.0 && \
    rm aria2-1.36.0.tar.gz

# Switch back to the "user" user
USER user

# Download checkpoint files using aria2
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lxq007/DiffBIR/resolve/main/general_full_v1.ckpt -d $HOME/app/models -o general_full_v1.ckpt
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lxq007/DiffBIR/resolve/main/general_swinir_v1.ckpt -d $HOME/app/models -o general_swinir_v1.ckpt

# Expose any necessary ports (if your application requires it)
# EXPOSE 80

RUN find $HOME/app

# Set the environment variable to specify the GPU device
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
ENV CUDA_VISIBLE_DEVICES=0

# Define the command to run your application
CMD ["python", "gradio_diffbir.py", "--ckpt", "/home/user/app/models/general_full_v1.ckpt", "--config", "/home/user/app/configs/model/cldm.yaml", "--reload_swinir", "--swinir_ckpt", "/home/user/app/models/general_swinir_v1.ckpt"]