From dbb2d55d77ec80aebaf0394a1d89a14061a4640d Mon Sep 17 00:00:00 2001 From: Victor Skvortsov Date: Tue, 26 Aug 2025 15:01:54 +0500 Subject: [PATCH 1/3] Add Wan2.2 example --- examples/models/wan22/README.md | 41 ++++++++++++++++++++++++ examples/models/wan22/dev-env.dstack.yml | 17 ++++++++++ 2 files changed, 58 insertions(+) create mode 100644 examples/models/wan22/README.md create mode 100644 examples/models/wan22/dev-env.dstack.yml diff --git a/examples/models/wan22/README.md b/examples/models/wan22/README.md new file mode 100644 index 0000000000..a42d942fac --- /dev/null +++ b/examples/models/wan22/README.md @@ -0,0 +1,41 @@ +# Wan2.2 + +[Wan2.2](https://github.com/Wan-Video/Wan2.2) is an open-source SOTA foundational video model. This example shows how to run the T2V-A14B model variant via `dstack` for text-to-video generation. + +??? info "Prerequisites" + Once `dstack` is [installed](https://dstack.ai/docs/installation), clone the repo with examples. + +
+ + ```shell + $ git clone https://github.com/dstackai/dstack + $ cd dstack + ``` + +
+ +Apply the [configuration](https://github.com/dstackai/dstack/blob/master/examples/models/wan22/dev-env.dstack.yml) to provision a GPU instance and run a dev environment with all the Wan2.2 dependencies installed: + +
+ +```shell +$ dstack apply -f examples/models/wan22/dev-env.dstack.yml +Provisioning... +---> 100% +``` + +
+ +Then you can attach to the dev environment and generate videos: + +
+ +```shell +$ torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." + +[2025-08-26 05:41:54,911] INFO: Input prompt: Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage. +[2025-08-26 05:41:54,912] INFO: Creating WanT2V pipeline. +[2025-08-26 05:42:50,296] INFO: loading ./Wan2.2-T2V-A14B/models_t5_umt5-xxl-enc-bf16.pth +``` + +
diff --git a/examples/models/wan22/dev-env.dstack.yml b/examples/models/wan22/dev-env.dstack.yml new file mode 100644 index 0000000000..aa035c1df5 --- /dev/null +++ b/examples/models/wan22/dev-env.dstack.yml @@ -0,0 +1,17 @@ +type: dev-environment +name: wan22 +ide: vscode +nvcc: true +repos: + - https://github.com/Wan-Video/Wan2.2.git +init: + - | + pip install torch + pip install -r requirements.txt + pip install "huggingface_hub[cli]" + huggingface-cli download Wan-AI/Wan2.2-T2V-A14B --local-dir ./Wan2.2-T2V-A14B +resources: + gpu: + name: H100 + count: 8 # Set to 1.. if 8 GPUs not available trading inferece speed + disk: 200GB From 8bebb07ac84e07610ba0d0991464d762b10c2e31 Mon Sep 17 00:00:00 2001 From: peterschmidt85 Date: Wed, 27 Aug 2025 12:28:32 +0200 Subject: [PATCH 2/3] Replaced the dev environment with a task; improved configuration (uv, cache), single/multiple gpus supports; also added more details; added the example into the docs. --- docs/examples.md | 16 +++ docs/examples/models/wan22/index.md | 0 docs/overrides/main.html | 1 + examples/models/wan22/.dstack.yml | 63 ++++++++++++ examples/models/wan22/README.md | 119 +++++++++++++++++++++-- examples/models/wan22/dev-env.dstack.yml | 17 ---- 6 files changed, 190 insertions(+), 26 deletions(-) create mode 100644 docs/examples/models/wan22/index.md create mode 100644 examples/models/wan22/.dstack.yml delete mode 100644 examples/models/wan22/dev-env.dstack.yml diff --git a/docs/examples.md b/docs/examples.md index dd93af7532..a4e147dc05 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -230,6 +230,22 @@ hide: +## Models + + + + 100% + +Uploaded 1 file, 8 375 523 bytes + +wget https://bashupload.com/fIo7l/wan22.mp4 ``` -Then you can attach to the dev environment and generate videos: +If you want you can override the default GPU, spot policy, and even the prompt via the CLI.
```shell -$ torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." +$ PROMPT=... +$ dstack apply -f examples/models/wan22/.dstack.yml --spot --gpu H100,H200:8 -[2025-08-26 05:41:54,911] INFO: Input prompt: Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage. -[2025-08-26 05:41:54,912] INFO: Creating WanT2V pipeline. -[2025-08-26 05:42:50,296] INFO: loading ./Wan2.2-T2V-A14B/models_t5_umt5-xxl-enc-bf16.pth + # BACKEND RESOURCES INSTANCE TYPE PRICE + 1 aws (us-east-2) cpu=192 mem=2048GB disk=300GB H100:80GB:8 (spot) p5.48xlarge $6.963 + 2 datacrunch (FIN-02) cpu=176 mem=1480GB disk=300GB H100:80GB:8 (spot) 8H100.80S.176V $7.93 + 3 datacrunch (ICE-01) cpu=176 mem=1450GB disk=300GB H200:141GB:8 (spot) 8H200.141S.176V $7.96 + +---> 100% + +Uploaded 1 file, 8 375 523 bytes + +wget https://bashupload.com/fIo7l/wan22.mp4 ```
+ +## Source code + +The source-code of this example can be found in +[`examples/models/wan22` :material-arrow-top-right-thin:{ .external }](https://github.com/dstackai/dstack/blob/master/examples/models/wan22){:target="_blank"}. diff --git a/examples/models/wan22/dev-env.dstack.yml b/examples/models/wan22/dev-env.dstack.yml deleted file mode 100644 index aa035c1df5..0000000000 --- a/examples/models/wan22/dev-env.dstack.yml +++ /dev/null @@ -1,17 +0,0 @@ -type: dev-environment -name: wan22 -ide: vscode -nvcc: true -repos: - - https://github.com/Wan-Video/Wan2.2.git -init: - - | - pip install torch - pip install -r requirements.txt - pip install "huggingface_hub[cli]" - huggingface-cli download Wan-AI/Wan2.2-T2V-A14B --local-dir ./Wan2.2-T2V-A14B -resources: - gpu: - name: H100 - count: 8 # Set to 1.. if 8 GPUs not available trading inferece speed - disk: 200GB From a6d11d1c78ac9e5bf62195ac7a2cf2a8964030d7 Mon Sep 17 00:00:00 2001 From: peterschmidt85 Date: Wed, 27 Aug 2025 12:30:00 +0200 Subject: [PATCH 3/3] Forgotten change --- mkdocs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkdocs.yml b/mkdocs.yml index 7d93d96239..df2ea690e4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -292,6 +292,8 @@ nav: - TPU: examples/accelerators/tpu/index.md - Intel Gaudi: examples/accelerators/intel/index.md - Tenstorrent: examples/accelerators/tenstorrent/index.md + - Models: + - Wan2.2: examples/models/wan22/index.md - Changelog: blog/changelog.md - Case studies: blog/case-studies.md - Benchmarks: blog/benchmarks.md