From f1ed5bfe18272ce1d5fa21c073c00e3d136878be Mon Sep 17 00:00:00 2001 From: gnebie Date: Sun, 2 Mar 2025 11:54:45 +0100 Subject: [PATCH] Add a pyproject and a detailled separate installation file with a poetry installation to not overcharge the readme --- .gitignore | 1 + INSTALL.md | 54 ++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 INSTALL.md create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 1f975d8..deeef7a 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ Wan2.1-T2V-14B/ Wan2.1-T2V-1.3B/ Wan2.1-I2V-14B-480P/ Wan2.1-I2V-14B-720P/ +poetry.lock \ No newline at end of file diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..7f47d6a --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,54 @@ +# Installation Guide + +## Install with pip + +```bash +pip install . +pip install .[dev] # Installe aussi les outils de dev +``` + +## Install with Poetry + +Ensure you have [Poetry](https://python-poetry.org/docs/#installation) installed on your system. + +To install all dependencies: + +```bash +poetry install +``` + +### Handling `flash-attn` Installation Issues + +If `flash-attn` fails due to **PEP 517 build issues**, you can try one of the following fixes. + +#### No-Build-Isolation Installation (Recommended) +```bash +poetry run pip install --upgrade pip setuptools wheel +poetry run pip install flash-attn --no-build-isolation +poetry install +``` + +#### Install from Git (Alternative) +```bash +poetry run pip install git+https://github.com/Dao-AILab/flash-attention.git +``` + +--- + +### Running the Model + +Once the installation is complete, you can run **Wan2.1** using: + +```bash +poetry run python generate.py --task t2v-14B --size '1280x720' --ckpt_dir ./Wan2.1-T2V-14B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." +``` + +#### Test +```bash +pytest tests/ +``` +#### Format +```bash +black . +isort . +``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4d3ff04 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,64 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "wan" +version = "2.1.0" +description = "Wan: Open and Advanced Large-Scale Video Generative Models" +authors = [ + { name = "Wan Team", discord = "https://discord.gg/p5XbdQV7" } +] +license = { file = "LICENSE.txt" } +readme = "README.md" +requires-python = ">=3.10,<4.0" +dependencies = [ + "torch>=2.4.0", + "torchvision>=0.19.0", + "opencv-python>=4.9.0.80", + "diffusers>=0.31.0", + "transformers>=4.49.0", + "tokenizers>=0.20.3", + "accelerate>=1.1.1", + "tqdm", + "imageio", + "easydict", + "ftfy", + "dashscope", + "imageio-ffmpeg", + "flash_attn", + "gradio>=5.0.0", + "numpy>=1.23.5,<2" +] + +[project.optional-dependencies] +dev = [ + "pytest", + "black", + "flake8", + "isort", + "mypy", + "huggingface-hub[cli]" +] + +[project.urls] +homepage = "https://wanxai.com" +documentation = "https://github.com/Wan-Video/Wan2.1" +repository = "https://github.com/Wan-Video/Wan2.1" +huggingface = "https://huggingface.co/Wan-AI/" +modelscope = "https://modelscope.cn/organization/Wan-AI" +discord = "https://discord.gg/p5XbdQV7" + +[tool.setuptools] +packages = ["wan"] + +[tool.black] +line-length = 88 + +[tool.isort] +profile = "black" + +[tool.mypy] +strict = true + +