From a70cc8c68bbb37e94809291e35154053072994c5 Mon Sep 17 00:00:00 2001 From: "slavik.fursov" Date: Fri, 22 Nov 2024 07:41:38 -0800 Subject: [PATCH 1/2] add Dockerfile --- docker/Dockerfile | 15 +++++++++++++++ docker/README.md | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..5e1116d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,15 @@ +FROM nvidia/cuda:12.6.2-cudnn-runtime-ubuntu24.04 + +RUN apt-get update \ + && apt-get -y upgrade \ + && apt-get install -y git curl pip \ + && git clone https://github.com/VectorSpaceLab/OmniGen.git \ + && cd OmniGen \ + && pip install --break-system-packages -e . \ + && pip install --break-system-packages gradio spaces \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && sed -i 's/demo\.launch(.*)/demo.launch(server_name="0.0.0.0")/' app.py + +WORKDIR /OmniGen/ +ENTRYPOINT ["python3", "app.py"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..8aadace --- /dev/null +++ b/docker/README.md @@ -0,0 +1,21 @@ +# Build the Docker Image +Run the following commands to build the image: + +```bash +cd docker/ +sudo docker build -t omni1 . +``` + +# Run the Docker Container +Use this command to run the container: + +```bash +mkdir -p ~/Omni/.cache +sudo docker run -p 7860:7860 --name omni --rm --gpus all -it -v ~/Omni/.cache:/root/.cache omni1 +``` + +**Model Storage**: The `/root/.cache` directory in the container is where the model will be saved. Ensure you have at least 18GB of free space. + +**First Run**: The first time you run the container, it may take several minutes to download the model. + +**Subsequent Runs**: Starting the container will take about 10–30 seconds. From 14d101e4fccb843fdcbaa9ea303998bc40c1b733 Mon Sep 17 00:00:00 2001 From: "slavik.fursov" Date: Fri, 22 Nov 2024 08:54:19 -0800 Subject: [PATCH 2/2] add Dockerfile; purge build cache --- docker/Dockerfile | 1 + docker/README.md | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5e1116d..c9e2623 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get update \ && cd OmniGen \ && pip install --break-system-packages -e . \ && pip install --break-system-packages gradio spaces \ + && pip cache purge \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && sed -i 's/demo\.launch(.*)/demo.launch(server_name="0.0.0.0")/' app.py diff --git a/docker/README.md b/docker/README.md index 8aadace..cd50d6a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,6 +6,10 @@ cd docker/ sudo docker build -t omni1 . ``` +**Build Notes**: +- On a machine with a Xeon Silver CPU and an SSD, the build process takes approximately 10 minutes. +- The resulting Docker image is approximately 11GB in size. + # Run the Docker Container Use this command to run the container: @@ -14,8 +18,8 @@ mkdir -p ~/Omni/.cache sudo docker run -p 7860:7860 --name omni --rm --gpus all -it -v ~/Omni/.cache:/root/.cache omni1 ``` -**Model Storage**: The `/root/.cache` directory in the container is where the model will be saved. Ensure you have at least 18GB of free space. +**Model Storage**: The directory `/root/.cache` inside the container is used to store the model. Make sure your system has at least 18GB of free space in the `~/Omni/.cache` directory. **First Run**: The first time you run the container, it may take several minutes to download the model. -**Subsequent Runs**: Starting the container will take about 10–30 seconds. +**Subsequent Runs**: Starting the container will take about 15–40 seconds.