hpcaitech / Open-Sora

Open-Sora: Democratizing Efficient Video Production for All
https://hpcaitech.github.io/Open-Sora/
Apache License 2.0
20.77k stars 1.97k forks source link

fatal: destination path 'Open-Sora' already exists and is not an empty directory. #423

Closed Joshua-Donovan closed 1 month ago

Joshua-Donovan commented 1 month ago

Completely new to this project, so it is possible I am just doing something wrong.

When following the installation instructions, for docker the Dockerfile is throwing an error during the git clone portion of the Dockerfile.

(base) user@Josh:~$ docker build -t opensora ./docker
[+] Building 0.7s (11/11) FINISHED                                                           docker:default
 => [internal] load build definition from Dockerfile                                                   0.0s
 => => transferring dockerfile: 992B                                                                   0.0s
 => [internal] load metadata for docker.io/hpcaitech/pytorch-cuda:2.1.0-12.1.0                         0.3s
 => [internal] load .dockerignore                                                                      0.0s
 => => transferring context: 2B                                                                        0.0s
 => [internal] load build context                                                                      0.0s
 => => transferring context: 32B                                                                       0.0s
 => [1/7] FROM docker.io/hpcaitech/pytorch-cuda:2.1.0-12.1.0@sha256:3b03a92d73542ee3259c51ba6f02b9c45  0.0s
 => CACHED [2/7] COPY . /workspace/Open-Sora                                                           0.0s
 => CACHED [3/7] RUN apt-get update && apt-get install ffmpeg libsm6 libxext6  -y                      0.0s
 => CACHED [4/7] RUN pip install flash-attn --no-build-isolation                                       0.0s
 => CACHED [5/7] RUN pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation -  0.0s
 => CACHED [6/7] RUN pip install xformers --index-url https://download.pytorch.org/whl/cu121           0.0s
 => ERROR [7/7] RUN git clone https://github.com/hpcaitech/Open-Sora &&     cd Open-Sora &&     pip i  0.3s
------
 > [7/7] RUN git clone https://github.com/hpcaitech/Open-Sora &&     cd Open-Sora &&     pip install -v .:
0.241 fatal: destination path 'Open-Sora' already exists and is not an empty directory.
------
Dockerfile:23
--------------------
  22 |     # install this project
  23 | >>> RUN git clone https://github.com/hpcaitech/Open-Sora && \
  24 | >>>     cd Open-Sora && \
  25 | >>>     pip install -v .
--------------------
ERROR: failed to solve: process "/bin/bash --login -c git clone https://github.com/hpcaitech/Open-Sora &&     cd Open-Sora &&     pip install -v ." did not complete successfully: exit code: 128

Commenting out the Copy line seemed to fix this issue for me, but I am not sure if that ruins something for running open-sora in a container.

FROM hpcaitech/pytorch-cuda:2.1.0-12.1.0

# metainformation
LABEL org.opencontainers.image.source = "https://github.com/hpcaitech/Open-Sora"
LABEL org.opencontainers.image.licenses = "Apache License 2.0"
LABEL org.opencontainers.image.base.name = "docker.io/library/hpcaitech/pytorch-cuda:2.1.0-12.1.0"

# removes error with git clone, but not sure if it messes up the install
#COPY . /workspace/Open-Sora

# inatall library dependencies
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6  -y

# install flash attention
RUN pip install flash-attn --no-build-isolation

# install apex
RUN pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.git

# install xformers
RUN pip install xformers --index-url https://download.pytorch.org/whl/cu121

# install this project
RUN git clone https://github.com/hpcaitech/Open-Sora && \
    cd Open-Sora && \
    pip install -v .

Running in Ubuntu / WSL 2

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

and Docker 26.1.1

Docker version 26.1.1, build 4cf5afa
joaovit1 commented 1 month ago

I don't think this is the right solution, but I started to remove the old folder before cloning again, changing line 23:

RUN rm -rf Open-Sora && git clone https://github.com/hpcaitech/Open-Sora || echo "Directory already exists" && \

However since I haven't ever used docker or trained models before, I am having problems to execute a prompt after this, if you manage to make this work, please share your solution!

JThh commented 1 month ago

That would not affect the docker building correctness as long as your open-sora repo is up-to-date.

Joshua-Donovan commented 1 month ago

thanks @JThh and I see there is a pull request out to fix this, I'll close this issue since that is in the works.