Spaces:
Configuration error
Configuration error
Commit
·
f5cd881
1
Parent(s):
e93d21d
docker
Browse files- Dockerfile +48 -0
- environmental.yaml +0 -88
Dockerfile
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
|
| 2 |
+
|
| 3 |
+
# 设置非交互模式
|
| 4 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
+
|
| 6 |
+
# 安装必要的系统依赖
|
| 7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
wget \
|
| 9 |
+
curl \
|
| 10 |
+
git \
|
| 11 |
+
ca-certificates \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
|
| 14 |
+
# 安装 Miniconda
|
| 15 |
+
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
|
| 16 |
+
bash /tmp/miniconda.sh -b -p /opt/conda && \
|
| 17 |
+
rm /tmp/miniconda.sh
|
| 18 |
+
ENV PATH=/opt/conda/bin:$PATH
|
| 19 |
+
|
| 20 |
+
# 创建 conda 环境 “videograin”,指定 Python 3.10
|
| 21 |
+
RUN conda create -n videograin python=3.10 -y
|
| 22 |
+
|
| 23 |
+
# 在 “videograin” 环境中安装 PyTorch、CUDA 支持及 Xformers
|
| 24 |
+
RUN conda install -n videograin pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=12.1 -c pytorch -c nvidia -y && \
|
| 25 |
+
conda run -n videograin pip install --pre -U xformers==0.0.27
|
| 26 |
+
|
| 27 |
+
# 创建非 root 用户(uid=1000)
|
| 28 |
+
RUN useradd -m -u 1000 user
|
| 29 |
+
USER user
|
| 30 |
+
ENV HOME=/home/user
|
| 31 |
+
WORKDIR ${HOME}/app
|
| 32 |
+
|
| 33 |
+
# 将本地 requirements.txt 复制进容器,并在 “videograin” 环境中安装 pip 依赖
|
| 34 |
+
COPY --chown=user:user requirements.txt /tmp/requirements.txt
|
| 35 |
+
RUN conda run -n videograin pip install --no-cache-dir -r /tmp/requirements.txt
|
| 36 |
+
|
| 37 |
+
# 复制应用代码
|
| 38 |
+
COPY --chown=user:user . ${HOME}/app
|
| 39 |
+
|
| 40 |
+
# 设置环境变量,使后续运行默认使用 “videograin” 环境中的 Python
|
| 41 |
+
ENV PATH=/opt/conda/envs/videograin/bin:$PATH \
|
| 42 |
+
PYTHONUNBUFFERED=1
|
| 43 |
+
|
| 44 |
+
# 如有需要可开放端口(例如使用 gradio 的情况)
|
| 45 |
+
# EXPOSE 7860
|
| 46 |
+
|
| 47 |
+
# 默认启动命令
|
| 48 |
+
CMD ["python", "app.py"]
|
environmental.yaml
DELETED
|
@@ -1,88 +0,0 @@
|
|
| 1 |
-
name: videograin
|
| 2 |
-
channels:
|
| 3 |
-
- pytorch
|
| 4 |
-
- defaults
|
| 5 |
-
dependencies:
|
| 6 |
-
- ffmpeg=4.3
|
| 7 |
-
- numpy=1.24.3
|
| 8 |
-
- python=3.10.0
|
| 9 |
-
- pytorch=2.3.1
|
| 10 |
-
- pytorch-cuda=12.1
|
| 11 |
-
- pyyaml=6.0.2=
|
| 12 |
-
- torchvision=0.18.1
|
| 13 |
-
- yaml=0.2.5
|
| 14 |
-
- huggingface-hub==0.17.3
|
| 15 |
-
- xformers==0.0.27
|
| 16 |
-
- gradio==3.44.4
|
| 17 |
-
- pip:
|
| 18 |
-
- absl-py==2.1.0
|
| 19 |
-
- accelerate==0.24.1
|
| 20 |
-
- antlr4-python3-runtime==4.9.3
|
| 21 |
-
- asttokens==2.4.1
|
| 22 |
-
- bitsandbytes==0.35.4
|
| 23 |
-
- click==8.1.7
|
| 24 |
-
- coloredlogs==15.0.1
|
| 25 |
-
- contourpy==1.2.1
|
| 26 |
-
- cycler==0.12.1
|
| 27 |
-
- decorator==5.1.1
|
| 28 |
-
- decord==0.6.0
|
| 29 |
-
- diffusers==0.19.0
|
| 30 |
-
- einops==0.8.0
|
| 31 |
-
- exceptiongroup==1.2.1
|
| 32 |
-
- executing==2.0.1
|
| 33 |
-
- flatbuffers==24.3.25
|
| 34 |
-
- fonttools==4.53.1
|
| 35 |
-
- fsspec==2024.6.1
|
| 36 |
-
- ftfy==6.2.0
|
| 37 |
-
- grpcio==1.65.0
|
| 38 |
-
- humanfriendly==10.0
|
| 39 |
-
- imageio==2.34.2
|
| 40 |
-
- imageio-ffmpeg==0.5.1
|
| 41 |
-
- importlib-metadata==8.0.0
|
| 42 |
-
- ipython==8.26.0
|
| 43 |
-
- jedi==0.19.1
|
| 44 |
-
- kiwisolver==1.4.5
|
| 45 |
-
- markdown==3.6
|
| 46 |
-
- matplotlib==3.9.1
|
| 47 |
-
- matplotlib-inline==0.1.7
|
| 48 |
-
- modelcards==0.1.6
|
| 49 |
-
- omegaconf==2.3.0
|
| 50 |
-
- onnxruntime==1.18.1
|
| 51 |
-
- onnxruntime-gpu==1.18.1
|
| 52 |
-
- opencv-python==4.10.0.84
|
| 53 |
-
- packaging==24.1
|
| 54 |
-
- parso==0.8.4
|
| 55 |
-
- pexpect==4.9.0
|
| 56 |
-
- prompt-toolkit==3.0.47
|
| 57 |
-
- protobuf==4.25.3
|
| 58 |
-
- psutil==6.0.0
|
| 59 |
-
- ptyprocess==0.7.0
|
| 60 |
-
- pure-eval==0.2.2
|
| 61 |
-
- pyav==12.2.0
|
| 62 |
-
- pygments==2.18.0
|
| 63 |
-
- pyparsing==3.1.2
|
| 64 |
-
- python-dateutil==2.9.0.post0
|
| 65 |
-
- regex==2024.5.15
|
| 66 |
-
- safetensors==0.4.3
|
| 67 |
-
- six==1.16.0
|
| 68 |
-
- stack-data==0.6.3
|
| 69 |
-
- tensorboard==2.17.0
|
| 70 |
-
- tensorboard-data-server==0.7.2
|
| 71 |
-
- tokenizers==0.14.1
|
| 72 |
-
- tqdm==4.66.4
|
| 73 |
-
- traitlets==5.14.3
|
| 74 |
-
- transformers==4.35.0
|
| 75 |
-
- triton==2.3.1
|
| 76 |
-
- wcwidth==0.2.13
|
| 77 |
-
- werkzeug==3.0.3
|
| 78 |
-
- zipp==3.19.2
|
| 79 |
-
- scipy==1.14.0
|
| 80 |
-
- scikit-learn==1.2.2
|
| 81 |
-
- nltk==3.8.1
|
| 82 |
-
- timm==0.6.7
|
| 83 |
-
- scikit-image==0.24.0
|
| 84 |
-
- gdown==5.1.0
|
| 85 |
-
- basicsr-fixed
|
| 86 |
-
- datasets==2.11.0 # 强制使用旧版本的 datasets,确保与 huggingface-hub==0.17.3 兼容
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|