-
Notifications
You must be signed in to change notification settings - Fork 576
/
Dockerfile-for-Mainland-China
39 lines (27 loc) · 1.29 KB
/
Dockerfile-for-Mainland-China
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
FROM nvcr.io/nvidia/pytorch:24.07-py3
EXPOSE 28000
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && apt update && apt install python3-tk -y
RUN mkdir /app
WORKDIR /app
RUN git clone --recurse-submodules https://github.com/Akegarasu/lora-scripts
WORKDIR /app/lora-scripts
# 设置 Python pip 软件包国内镜像代理
RUN pip config set global.index-url 'https://pypi.tuna.tsinghua.edu.cn/simple' && \
pip config set install.trusted-host 'pypi.tuna.tsinghua.edu.cn'
# 初次安装依赖
RUN pip install xformers==0.0.27.post2 --no-deps && pip install -r requirements.txt
# 更新 训练程序 stable 版本依赖
WORKDIR /app/lora-scripts/scripts/stable
RUN pip install -r requirements.txt
# 更新 训练程序 dev 版本依赖
WORKDIR /app/lora-scripts/scripts/dev
RUN pip install -r requirements.txt
WORKDIR /app/lora-scripts
# 修正运行报错以及底包缺失的依赖
# ref
# - https://soulteary.com/2024/01/07/fix-opencv-dependency-errors-opencv-fixer.html
# - https://blog.csdn.net/qq_50195602/article/details/124188467
RUN pip install opencv-fixer==0.2.5 && python -c "from opencv_fixer import AutoFix; AutoFix()" \
pip install opencv-python-headless && apt install ffmpeg libsm6 libxext6 libgl1 -y
CMD ["python", "gui.py", "--listen"]