ForgeSpecter AI commited on
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +17 -0
- .gitignore +7 -0
- INSTALL.md +55 -0
- LICENSE.txt +201 -0
- Makefile +5 -0
- README.md +512 -3
- Tugra_Wan2.2_Colab.ipynb +158 -0
- assets/comp_effic.png +3 -0
- assets/logo.png +3 -0
- assets/moe_2.png +3 -0
- assets/moe_arch.png +0 -0
- assets/performance.png +3 -0
- assets/vae.png +3 -0
- examples/Five Hundred Miles.MP3 +3 -0
- examples/Five Hundred Miles.png +3 -0
- examples/i2v_input.JPG +3 -0
- examples/pose.mp4 +3 -0
- examples/pose.png +3 -0
- examples/sing.MP3 +3 -0
- examples/talk.wav +3 -0
- examples/wan_animate/animate/image.jpeg +3 -0
- examples/wan_animate/animate/video.mp4 +3 -0
- examples/wan_animate/replace/image.jpeg +3 -0
- examples/wan_animate/replace/video.mp4 +3 -0
- examples/zero_shot_prompt.wav +3 -0
- generate.py +575 -0
- pyproject.toml +66 -0
- requirements.txt +16 -0
- requirements_animate.txt +8 -0
- requirements_s2v.txt +19 -0
- test.html +46 -0
- tests/README.md +6 -0
- tests/test.sh +91 -0
- tugra/__init__.py +7 -0
- tugra/__pycache__/__init__.cpython-314.pyc +0 -0
- tugra/animate.py +648 -0
- tugra/configs/__init__.py +51 -0
- tugra/configs/__pycache__/__init__.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/shared_config.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/tugra_animate_14B.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/tugra_i2v_A14B.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/tugra_s2v_14B.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/tugra_t2v_A14B.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/tugra_ti2v_5B.cpython-314.pyc +0 -0
- tugra/configs/__pycache__/wan_i2v_A14B.cpython-314.pyc +0 -0
- tugra/configs/shared_config.py +20 -0
- tugra/configs/tugra_animate_14B.py +41 -0
- tugra/configs/tugra_i2v_A14B.py +37 -0
- tugra/configs/tugra_s2v_14B.py +59 -0
- tugra/configs/tugra_t2v_A14B.py +37 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,20 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
assets/comp_effic.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/logo.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
assets/moe_2.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
assets/performance.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
assets/vae.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
examples/Five[[:space:]]Hundred[[:space:]]Miles.MP3 filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
examples/Five[[:space:]]Hundred[[:space:]]Miles.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
examples/i2v_input.JPG filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
examples/pose.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
examples/pose.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
examples/sing.MP3 filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
examples/talk.wav filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
examples/wan_animate/animate/image.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
examples/wan_animate/animate/video.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
examples/wan_animate/replace/image.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
examples/wan_animate/replace/video.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
examples/zero_shot_prompt.wav filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
.DS_Store
|
| 3 |
+
.vscode*
|
| 4 |
+
tmp_examples*
|
| 5 |
+
new_checkpoint*
|
| 6 |
+
batch_test*
|
| 7 |
+
nohup*
|
INSTALL.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation Guide
|
| 2 |
+
|
| 3 |
+
## Install with pip
|
| 4 |
+
|
| 5 |
+
```bash
|
| 6 |
+
pip install .
|
| 7 |
+
pip install .[dev] # Installe aussi les outils de dev
|
| 8 |
+
```
|
| 9 |
+
|
| 10 |
+
## Install with Poetry
|
| 11 |
+
|
| 12 |
+
Ensure you have [Poetry](https://python-poetry.org/docs/#installation) installed on your system.
|
| 13 |
+
|
| 14 |
+
To install all dependencies:
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
poetry install
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
### Handling `flash-attn` Installation Issues
|
| 21 |
+
|
| 22 |
+
If `flash-attn` fails due to **PEP 517 build issues**, you can try one of the following fixes.
|
| 23 |
+
|
| 24 |
+
#### No-Build-Isolation Installation (Recommended)
|
| 25 |
+
```bash
|
| 26 |
+
poetry run pip install --upgrade pip setuptools wheel
|
| 27 |
+
poetry run pip install flash-attn --no-build-isolation
|
| 28 |
+
poetry install
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
#### Install from Git (Alternative)
|
| 32 |
+
```bash
|
| 33 |
+
poetry run pip install git+https://github.com/Dao-AILab/flash-attention.git
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
### Running the Model
|
| 39 |
+
|
| 40 |
+
Once the installation is complete, you can run **TUĞRA** using:
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
poetry run python generate.py --task t2v-A14B --size '1280*720' --ckpt_dir ./TUĞRA-T2V-A14B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
#### Test
|
| 47 |
+
```bash
|
| 48 |
+
bash tests/test.sh
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
#### Format
|
| 52 |
+
```bash
|
| 53 |
+
black .
|
| 54 |
+
isort .
|
| 55 |
+
```
|
LICENSE.txt
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
Makefile
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.PHONY: format
|
| 2 |
+
|
| 3 |
+
format:
|
| 4 |
+
isort generate.py tugra
|
| 5 |
+
yapf -i -r *.py generate.py tugra
|
README.md
CHANGED
|
@@ -1,3 +1,512 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TUĞRA
|
| 2 |
+
|
| 3 |
+
**TUĞRA: Teknolojik Ulusal Grafik ve Render Algoritması**
|
| 4 |
+
|
| 5 |
+
<p align="center">
|
| 6 |
+
<img src="assets/logo.png" width="400"/>
|
| 7 |
+
<p>
|
| 8 |
+
|
| 9 |
+
<p align="center">
|
| 10 |
+
💜 <a href="https://modelscope.cn/models?page=1&page_type=2&owner=Tugra-AI"><b>WAN</b></a>    |    🖥️ <a href="https://github.com/Tugra-Video/TUĞRA">GitHub</a>    |   🤗 <a href="https://huggingface.co/Tugra-AI/">Hugging Face</a>   |   🤖 <a href="https://modelscope.cn/organization/Tugra-AI">ModelScope</a>   |    📑 <a href="https://arxiv.org/abs/2503.20314">Paper</a>    |    📑 <a href="https://wan.video/welcome?spm=a2ty_o02.30011076.0.0.6c9ee41eCcluqg">Blog</a>    |    💬 <a href="https://discord.gg/AKNgpMK4Yj">Discord</a>  
|
| 11 |
+
<br>
|
| 12 |
+
📕 <a href="https://alidocs.dingtalk.com/i/nodes/jb9Y4gmKWrx9eo4dCql9LlbYJGXn6lpz">使用指南(中文)</a>   |    📘 <a href="https://alidocs.dingtalk.com/i/nodes/EpGBa2Lm8aZxe5myC99MelA2WgN7R35y">User Guide(English)</a>   |   💬 <a href="https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg">WeChat(微信)</a>  
|
| 13 |
+
<br>
|
| 14 |
+
|
| 15 |
+
-----
|
| 16 |
+
|
| 17 |
+
[**TUĞRA: Open and Advanced Large-Scale Video Generative Models**](https://arxiv.org/abs/2503.20314) <be>
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
We are excited to introduce **TUĞRA**, a major upgrade to our foundational video models. With **TUĞRA**, we have focused on incorporating the following innovations:
|
| 21 |
+
|
| 22 |
+
- 👍 **Effective MoE Architecture**: TUĞRA introduces a Mixture-of-Experts (MoE) architecture into video diffusion models. By separating the denoising process cross timesteps with specialized powerful expert models, this enlarges the overall model capacity while maintaining the same computational cost.
|
| 23 |
+
|
| 24 |
+
- 👍 **Cinematic-level Aesthetics**: TUĞRA incorporates meticulously curated aesthetic data, complete with detailed labels for lighting, composition, contrast, color tone, and more. This allows for more precise and controllable cinematic style generation, facilitating the creation of videos with customizable aesthetic preferences.
|
| 25 |
+
|
| 26 |
+
- 👍 **Complex Motion Generation**: Compared to previous versions, TUĞRA is trained on a significantly larger data, with +65.6% more images and +83.2% more videos. This expansion notably enhances the model's generalization across multiple dimensions such as motions, semantics, and aesthetics, achieving TOP performance among all open-sourced and closed-sourced models.
|
| 27 |
+
|
| 28 |
+
- 👍 **Efficient High-Definition Hybrid TI2V**: TUĞRA open-sources a 5B model built with our advanced TUĞRA-VAE that achieves a compression ratio of **16×16×4**. This model supports both text-to-video and image-to-video generation at 720P resolution with 24fps and can also run on consumer-grade graphics cards like 4090. It is one of the fastest **720P@24fps** models currently available, capable of serving both the industrial and academic sectors simultaneously.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
## Video Demos
|
| 32 |
+
|
| 33 |
+
<div align="center">
|
| 34 |
+
<video src="https://github.com/user-attachments/assets/b63bfa58-d5d7-4de6-a1a2-98970b06d9a7" width="70%" poster=""> </video>
|
| 35 |
+
</div>
|
| 36 |
+
|
| 37 |
+
## 🔥 Latest News!!
|
| 38 |
+
* Nov 13, 2025: 👋 TUĞRA-Animate-14B has been integrated into Diffusers ([PR](https://github.com/huggingface/diffusers/pull/12526),[Weights](https://huggingface.co/Tugra-AI/TUĞRA-Animate-14B-Diffusers)). Thanks to all community contributors. Enjoy!
|
| 39 |
+
|
| 40 |
+
* Sep 19, 2025: 💃 We introduct **[TUĞRA-Animate-14B](https://humanaigc.github.io/wan-animate)**, an unified model for character animation and replacement with holistic movement and expression replication. We released the [model weights](#model-download) and [inference code](#run-wan-animate). And you can try it on [wan.video](https://wan.video/), [ModelScope Studio](https://www.modelscope.cn/studios/Tugra-AI/TUĞRA-Animate) or [HuggingFace Space](https://huggingface.co/spaces/Tugra-AI/TUĞRA-Animate)!
|
| 41 |
+
* Aug 26, 2025: 🎵 We introduce **[TUĞRA-S2V-14B](https://humanaigc.github.io/wan-s2v-webpage)**, an audio-driven cinematic video generation model, including [inference code](#run-speech-to-video-generation), [model weights](#model-download), and [technical report](https://humanaigc.github.io/wan-s2v-webpage/content/wan-s2v.pdf)! Now you can try it on [wan.video](https://wan.video/), [ModelScope Gradio](https://www.modelscope.cn/studios/Tugra-AI/TUĞRA-S2V) or [HuggingFace Gradio](https://huggingface.co/spaces/Tugra-AI/TUĞRA-S2V)!
|
| 42 |
+
* Jul 28, 2025: 👋 We have open a [HF space](https://huggingface.co/spaces/Tugra-AI/Wan-2.2-5B) using the TI2V-5B model. Enjoy!
|
| 43 |
+
* Jul 28, 2025: 👋 TUĞRA has been integrated into ComfyUI ([CN](https://docs.comfy.org/zh-CN/tutorials/video/wan/wan2_2) | [EN](https://docs.comfy.org/tutorials/video/wan/wan2_2)). Enjoy!
|
| 44 |
+
* Jul 28, 2025: 👋 TUĞRA's T2V, I2V and TI2V have been integrated into Diffusers ([T2V-A14B](https://huggingface.co/Tugra-AI/TUĞRA-T2V-A14B-Diffusers) | [I2V-A14B](https://huggingface.co/Tugra-AI/TUĞRA-I2V-A14B-Diffusers) | [TI2V-5B](https://huggingface.co/Tugra-AI/TUĞRA-TI2V-5B-Diffusers)). Feel free to give it a try!
|
| 45 |
+
* Jul 28, 2025: 👋 We've released the inference code and model weights of **TUĞRA**.
|
| 46 |
+
* Sep 5, 2025: 👋 We add text-to-speech synthesis support with [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) for Speech-to-Video generation task.
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
## Community Works
|
| 50 |
+
If your research or project builds upon [**Tugra v2.1**](https://github.com/Tugra-Video/Tugra v2.1) or [**TUĞRA**](https://github.com/Tugra-Video/TUĞRA), and you would like more people to see it, please inform us.
|
| 51 |
+
|
| 52 |
+
- [Prompt Relay](https://github.com/GordonChen19/Prompt-Relay), a plug-and-play, inference-time method for temporal control in video generation. Prompt Relay improves video quality and gives users precise control over what happens at each moment in the video. Visit their [webpage](https://gordonchen19.github.io/Prompt-Relay/) for more details.
|
| 53 |
+
- [Helios](https://github.com/PKU-YuanGroup/Helios), a breakthrough video generation model base on **Tugra v2.1** that achieves minute-scale, high-quality video synthesis at 19.5 FPS on a single H100 GPU (about 10 FPS on a single Ascend NPU) —without relying on conventional long video anti-drifting strategies or standard video acceleration techniques. Visit their [webpage](https://pku-yuangroup.github.io/Helios-Page/) for more details.
|
| 54 |
+
- [LightX2V](https://github.com/ModelTC/LightX2V), a lightweight and efficient video generation framework that integrates **Tugra v2.1** and **TUĞRA**, supporting multiple engineering acceleration techniques for fast inference. [LightX2V-HuggingFace](https://huggingface.co/lightx2v), offers a variety of Wan-based step-distillation models, quantized models, and lightweight VAE models.
|
| 55 |
+
- [HuMo](https://github.com/Phantom-video/HuMo) proposed a unified, human-centric framework based on **Wan** to produce high-quality, fine-grained, and controllable human videos from multimodal inputs—including text, images, and audio. Visit their [webpage](https://phantom-video.github.io/HuMo/) for more details.
|
| 56 |
+
- [FastVideo](https://github.com/hao-ai-lab/FastVideo) includes distilled **Wan** models with sparse attention that significanly speed up the inference time.
|
| 57 |
+
- [Cache-dit](https://github.com/vipshop/cache-dit) offers Fully Cache Acceleration support for **TUĞRA** MoE with DBCache, TaylorSeer and Cache CFG. Visit their [example](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_wan_2.2.py) for more details.
|
| 58 |
+
- [Kijai's ComfyUI WanVideoWrapper](https://github.com/kijai/ComfyUI-WanVideoWrapper) is an alternative implementation of **Wan** models for ComfyUI. Thanks to its Wan-only focus, it's on the frontline of getting cutting edge optimizations and hot research features, which are often hard to integrate into ComfyUI quickly due to its more rigid structure.
|
| 59 |
+
- [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) provides comprehensive support for **Wan 2.2**, including low-GPU-memory layer-by-layer offload, FP8 quantization, sequence parallelism, LoRA training, full training.
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
## 📑 Todo List
|
| 63 |
+
- TUĞRA Text-to-Video
|
| 64 |
+
- [x] Multi-GPU Inference code of the A14B and 14B models
|
| 65 |
+
- [x] Checkpoints of the A14B and 14B models
|
| 66 |
+
- [x] ComfyUI integration
|
| 67 |
+
- [x] Diffusers integration
|
| 68 |
+
- TUĞRA Image-to-Video
|
| 69 |
+
- [x] Multi-GPU Inference code of the A14B model
|
| 70 |
+
- [x] Checkpoints of the A14B model
|
| 71 |
+
- [x] ComfyUI integration
|
| 72 |
+
- [x] Diffusers integration
|
| 73 |
+
- TUĞRA Text-Image-to-Video
|
| 74 |
+
- [x] Multi-GPU Inference code of the 5B model
|
| 75 |
+
- [x] Checkpoints of the 5B model
|
| 76 |
+
- [x] ComfyUI integration
|
| 77 |
+
- [x] Diffusers integration
|
| 78 |
+
- TUĞRA-S2V Speech-to-Video
|
| 79 |
+
- [x] Inference code of TUĞRA-S2V
|
| 80 |
+
- [x] Checkpoints of TUĞRA-S2V-14B
|
| 81 |
+
- [x] ComfyUI integration
|
| 82 |
+
- [x] Diffusers integration
|
| 83 |
+
- TUĞRA-Animate Character Animation and Replacement
|
| 84 |
+
- [x] Inference code of TUĞRA-Animate
|
| 85 |
+
- [x] Checkpoints of TUĞRA-Animate
|
| 86 |
+
- [x] ComfyUI integration
|
| 87 |
+
- [x] Diffusers integration
|
| 88 |
+
|
| 89 |
+
## Run TUĞRA
|
| 90 |
+
|
| 91 |
+
#### Installation
|
| 92 |
+
Clone the repo:
|
| 93 |
+
```sh
|
| 94 |
+
git clone https://github.com/Tugra-Video/TUĞRA.git
|
| 95 |
+
cd TUĞRA
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Install dependencies:
|
| 99 |
+
```sh
|
| 100 |
+
# Ensure torch >= 2.4.0
|
| 101 |
+
# If the installation of `flash_attn` fails, try installing the other packages first and install `flash_attn` last
|
| 102 |
+
pip install -r requirements.txt
|
| 103 |
+
# If you want to use CosyVoice to synthesize speech for Speech-to-Video Generation, please install requirements_s2v.txt additionally
|
| 104 |
+
pip install -r requirements_s2v.txt
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
#### Model Download
|
| 109 |
+
|
| 110 |
+
| Models | Download Links | Description |
|
| 111 |
+
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-------------|
|
| 112 |
+
| T2V-A14B | 🤗 [Huggingface](https://huggingface.co/Tugra-AI/TUĞRA-T2V-A14B) �� [ModelScope](https://modelscope.cn/models/Tugra-AI/TUĞRA-T2V-A14B) | Text-to-Video MoE model, supports 480P & 720P |
|
| 113 |
+
| I2V-A14B | 🤗 [Huggingface](https://huggingface.co/Tugra-AI/TUĞRA-I2V-A14B) 🤖 [ModelScope](https://modelscope.cn/models/Tugra-AI/TUĞRA-I2V-A14B) | Image-to-Video MoE model, supports 480P & 720P |
|
| 114 |
+
| TI2V-5B | 🤗 [Huggingface](https://huggingface.co/Tugra-AI/TUĞRA-TI2V-5B) 🤖 [ModelScope](https://modelscope.cn/models/Tugra-AI/TUĞRA-TI2V-5B) | High-compression VAE, T2V+I2V, supports 720P |
|
| 115 |
+
| S2V-14B | 🤗 [Huggingface](https://huggingface.co/Tugra-AI/TUĞRA-S2V-14B) 🤖 [ModelScope](https://modelscope.cn/models/Tugra-AI/TUĞRA-S2V-14B) | Speech-to-Video model, supports 480P & 720P |
|
| 116 |
+
| Animate-14B | 🤗 [Huggingface](https://huggingface.co/Tugra-AI/TUĞRA-Animate-14B) 🤖 [ModelScope](https://www.modelscope.cn/models/Tugra-AI/TUĞRA-Animate-14B) | Character animation and replacement | |
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
> 💡Note:
|
| 121 |
+
> The TI2V-5B model supports 720P video generation at **24 FPS**.
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
Download models using huggingface-cli:
|
| 125 |
+
``` sh
|
| 126 |
+
pip install "huggingface_hub[cli]"
|
| 127 |
+
huggingface-cli download Tugra-AI/TUĞRA-T2V-A14B --local-dir ./TUĞRA-T2V-A14B
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
Download models using modelscope-cli:
|
| 131 |
+
``` sh
|
| 132 |
+
pip install modelscope
|
| 133 |
+
modelscope download Tugra-AI/TUĞRA-T2V-A14B --local_dir ./TUĞRA-T2V-A14B
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
#### Run Text-to-Video Generation
|
| 137 |
+
|
| 138 |
+
This repository supports the `TUĞRA-T2V-A14B` Text-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
##### (1) Without Prompt Extension
|
| 142 |
+
|
| 143 |
+
To facilitate implementation, we will start with a basic version of the inference process that skips the [prompt extension](#2-using-prompt-extention) step.
|
| 144 |
+
|
| 145 |
+
- Single-GPU inference
|
| 146 |
+
|
| 147 |
+
``` sh
|
| 148 |
+
python generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-T2V-A14B --offload_model True --convert_model_dtype --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
> 💡 This command can run on a GPU with at least 80GB VRAM.
|
| 152 |
+
|
| 153 |
+
> 💡If you encounter OOM (Out-of-Memory) issues, you can use the `--offload_model True`, `--convert_model_dtype` and `--t5_cpu` options to reduce GPU memory usage.
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 157 |
+
|
| 158 |
+
We use [PyTorch FSDP](https://docs.pytorch.org/docs/stable/fsdp.html) and [DeepSpeed Ulysses](https://arxiv.org/abs/2309.14509) to accelerate inference.
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
``` sh
|
| 162 |
+
torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-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."
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
##### (2) Using Prompt Extension
|
| 167 |
+
|
| 168 |
+
Extending the prompts can effectively enrich the details in the generated videos, further enhancing the video quality. Therefore, we recommend enabling prompt extension. We provide the following two methods for prompt extension:
|
| 169 |
+
|
| 170 |
+
- Use the Dashscope API for extension.
|
| 171 |
+
- Apply for a `dashscope.api_key` in advance ([EN](https://www.alibabacloud.com/help/en/model-studio/getting-started/first-api-call-to-qwen) | [CN](https://help.aliyun.com/zh/model-studio/getting-started/first-api-call-to-qwen)).
|
| 172 |
+
- Configure the environment variable `DASH_API_KEY` to specify the Dashscope API key. For users of Alibaba Cloud's international site, you also need to set the environment variable `DASH_API_URL` to 'https://dashscope-intl.aliyuncs.com/api/v1'. For more detailed instructions, please refer to the [dashscope document](https://www.alibabacloud.com/help/en/model-studio/developer-reference/use-qwen-by-calling-api?spm=a2c63.p38356.0.i1).
|
| 173 |
+
- Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks.
|
| 174 |
+
- You can modify the model used for extension with the parameter `--prompt_extend_model`. For example:
|
| 175 |
+
```sh
|
| 176 |
+
DASH_API_KEY=your_key torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-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" --use_prompt_extend --prompt_extend_method 'dashscope' --prompt_extend_target_lang 'zh'
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
- Using a local model for extension.
|
| 180 |
+
|
| 181 |
+
- By default, the Qwen model on HuggingFace is used for this extension. Users can choose Qwen models or other models based on the available GPU memory size.
|
| 182 |
+
- For text-to-video tasks, you can use models like `Qwen/Qwen2.5-14B-Instruct`, `Qwen/Qwen2.5-7B-Instruct` and `Qwen/Qwen2.5-3B-Instruct`.
|
| 183 |
+
- For image-to-video tasks, you can use models like `Qwen/Qwen2.5-VL-7B-Instruct` and `Qwen/Qwen2.5-VL-3B-Instruct`.
|
| 184 |
+
- Larger models generally provide better extension results but require more GPU memory.
|
| 185 |
+
- You can modify the model used for extension with the parameter `--prompt_extend_model` , allowing you to specify either a local model path or a Hugging Face model. For example:
|
| 186 |
+
|
| 187 |
+
``` sh
|
| 188 |
+
torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-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" --use_prompt_extend --prompt_extend_method 'local_qwen' --prompt_extend_target_lang 'zh'
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
#### Run Image-to-Video Generation
|
| 193 |
+
|
| 194 |
+
This repository supports the `TUĞRA-I2V-A14B` Image-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
- Single-GPU inference
|
| 198 |
+
```sh
|
| 199 |
+
python generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-I2V-A14B --offload_model True --convert_model_dtype --image examples/i2v_input.JPG --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
> This command can run on a GPU with at least 80GB VRAM.
|
| 203 |
+
|
| 204 |
+
> 💡For the Image-to-Video task, the `size` parameter represents the area of the generated video, with the aspect ratio following that of the original input image.
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 208 |
+
|
| 209 |
+
```sh
|
| 210 |
+
torchrun --nproc_per_node=8 generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-I2V-A14B --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
- Image-to-Video Generation without prompt
|
| 214 |
+
|
| 215 |
+
```sh
|
| 216 |
+
DASH_API_KEY=your_key torchrun --nproc_per_node=8 generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./TUĞRA-I2V-A14B --prompt '' --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --use_prompt_extend --prompt_extend_method 'dashscope'
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
+
> 💡The model can generate videos solely from the input image. You can use prompt extension to generate prompt from the image.
|
| 220 |
+
|
| 221 |
+
> The process of prompt extension can be referenced [here](#2-using-prompt-extention).
|
| 222 |
+
|
| 223 |
+
#### Run Text-Image-to-Video Generation
|
| 224 |
+
|
| 225 |
+
This repository supports the `TUĞRA-TI2V-5B` Text-Image-to-Video model and can support video generation at 720P resolutions.
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
- Single-GPU Text-to-Video inference
|
| 229 |
+
```sh
|
| 230 |
+
python generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./TUĞRA-TI2V-5B --offload_model True --convert_model_dtype --t5_cpu --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage"
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
> 💡Unlike other tasks, the 720P resolution of the Text-Image-to-Video task is `1280*704` or `704*1280`.
|
| 234 |
+
|
| 235 |
+
> This command can run on a GPU with at least 24GB VRAM (e.g, RTX 4090 GPU).
|
| 236 |
+
|
| 237 |
+
> 💡If you are running on a GPU with at least 80GB VRAM, you can remove the `--offload_model True`, `--convert_model_dtype` and `--t5_cpu` options to speed up execution.
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
- Single-GPU Image-to-Video inference
|
| 241 |
+
```sh
|
| 242 |
+
python generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./TUĞRA-TI2V-5B --offload_model True --convert_model_dtype --t5_cpu --image examples/i2v_input.JPG --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
> 💡If the image parameter is configured, it is an Image-to-Video generation; otherwise, it defaults to a Text-to-Video generation.
|
| 246 |
+
|
| 247 |
+
> 💡Similar to Image-to-Video, the `size` parameter represents the area of the generated video, with the aspect ratio following that of the original input image.
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 251 |
+
|
| 252 |
+
```sh
|
| 253 |
+
torchrun --nproc_per_node=8 generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./TUĞRA-TI2V-5B --dit_fsdp --t5_fsdp --ulysses_size 8 --image examples/i2v_input.JPG --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
> The process of prompt extension can be referenced [here](#2-using-prompt-extention).
|
| 257 |
+
|
| 258 |
+
#### Run Speech-to-Video Generation
|
| 259 |
+
|
| 260 |
+
This repository supports the `TUĞRA-S2V-14B` Speech-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
|
| 261 |
+
|
| 262 |
+
- Single-GPU Speech-to-Video inference
|
| 263 |
+
|
| 264 |
+
```sh
|
| 265 |
+
python generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./TUĞRA-S2V-14B/ --offload_model True --convert_model_dtype --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard." --image "examples/i2v_input.JPG" --audio "examples/talk.wav"
|
| 266 |
+
# Without setting --num_clip, the generated video length will automatically adjust based on the input audio length
|
| 267 |
+
|
| 268 |
+
# You can use CosyVoice to generate audio with --enable_tts
|
| 269 |
+
python generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./TUĞRA-S2V-14B/ --offload_model True --convert_model_dtype --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard." --image "examples/i2v_input.JPG" --enable_tts --tts_prompt_audio "examples/zero_shot_prompt.wav" --tts_prompt_text "希望你以后能够做的比我还好呦。" --tts_text "收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐,笑容如花儿般绽放。"
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
> 💡 This command can run on a GPU with at least 80GB VRAM.
|
| 273 |
+
|
| 274 |
+
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 275 |
+
|
| 276 |
+
```sh
|
| 277 |
+
torchrun --nproc_per_node=8 generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./TUĞRA-S2V-14B/ --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard." --image "examples/i2v_input.JPG" --audio "examples/talk.wav"
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
- Pose + Audio driven generation
|
| 281 |
+
|
| 282 |
+
```sh
|
| 283 |
+
torchrun --nproc_per_node=8 generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./TUĞRA-S2V-14B/ --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "a person is singing" --image "examples/pose.png" --audio "examples/sing.MP3" --pose_video "./examples/pose.mp4"
|
| 284 |
+
```
|
| 285 |
+
|
| 286 |
+
> 💡For the Speech-to-Video task, the `size` parameter represents the area of the generated video, with the aspect ratio following that of the original input image.
|
| 287 |
+
|
| 288 |
+
> 💡The model can generate videos from audio input combined with reference image and optional text prompt.
|
| 289 |
+
|
| 290 |
+
> 💡The `--pose_video` parameter enables pose-driven generation, allowing the model to follow specific pose sequences while generating videos synchronized with audio input.
|
| 291 |
+
|
| 292 |
+
> 💡The `--num_clip` parameter controls the number of video clips generated, useful for quick preview with shorter generation time.
|
| 293 |
+
|
| 294 |
+
Please visit our project page to see more examples and learn about the scenarios suitable for this model.
|
| 295 |
+
|
| 296 |
+
#### Run Tugra-Animate
|
| 297 |
+
|
| 298 |
+
Tugra-Animate takes a video and a character image as input, and generates a video in either "animation" or "replacement" mode.
|
| 299 |
+
|
| 300 |
+
1. animation mode: The model generates a video of the character image that mimics the human motion in the input video.
|
| 301 |
+
2. replacement mode: The model replaces the character image with the input video.
|
| 302 |
+
|
| 303 |
+
Please visit our [project page](https://humanaigc.github.io/wan-animate) to see more examples and learn about the scenarios suitable for this model.
|
| 304 |
+
|
| 305 |
+
##### (1) Preprocessing
|
| 306 |
+
The input video should be preprocessed into several materials before be feed into the inference process. Please refer to the following processing flow, and more details about preprocessing can be found in [UserGuider](https://github.com/Tugra-Video/TUĞRA/blob/main/wan/modules/animate/preprocess/UserGuider.md).
|
| 307 |
+
|
| 308 |
+
* For animation
|
| 309 |
+
```bash
|
| 310 |
+
python ./wan/modules/animate/preprocess/preprocess_data.py \
|
| 311 |
+
--ckpt_path ./TUĞRA-Animate-14B/process_checkpoint \
|
| 312 |
+
--video_path ./examples/wan_animate/animate/video.mp4 \
|
| 313 |
+
--refer_path ./examples/wan_animate/animate/image.jpeg \
|
| 314 |
+
--save_path ./examples/wan_animate/animate/process_results \
|
| 315 |
+
--resolution_area 1280 720 \
|
| 316 |
+
--retarget_flag \
|
| 317 |
+
--use_flux
|
| 318 |
+
```
|
| 319 |
+
* For replacement
|
| 320 |
+
```bash
|
| 321 |
+
python ./wan/modules/animate/preprocess/preprocess_data.py \
|
| 322 |
+
--ckpt_path ./TUĞRA-Animate-14B/process_checkpoint \
|
| 323 |
+
--video_path ./examples/wan_animate/replace/video.mp4 \
|
| 324 |
+
--refer_path ./examples/wan_animate/replace/image.jpeg \
|
| 325 |
+
--save_path ./examples/wan_animate/replace/process_results \
|
| 326 |
+
--resolution_area 1280 720 \
|
| 327 |
+
--iterations 3 \
|
| 328 |
+
--k 7 \
|
| 329 |
+
--w_len 1 \
|
| 330 |
+
--h_len 1 \
|
| 331 |
+
--replace_flag
|
| 332 |
+
```
|
| 333 |
+
##### (2) Run in animation mode
|
| 334 |
+
|
| 335 |
+
* Single-GPU inference
|
| 336 |
+
|
| 337 |
+
```bash
|
| 338 |
+
python generate.py --task animate-14B --ckpt_dir ./TUĞRA-Animate-14B/ --src_root_path ./examples/wan_animate/animate/process_results/ --refert_num 1
|
| 339 |
+
```
|
| 340 |
+
|
| 341 |
+
* Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 342 |
+
|
| 343 |
+
```bash
|
| 344 |
+
python -m torch.distributed.run --nnodes 1 --nproc_per_node 8 generate.py --task animate-14B --ckpt_dir ./TUĞRA-Animate-14B/ --src_root_path ./examples/wan_animate/animate/process_results/ --refert_num 1 --dit_fsdp --t5_fsdp --ulysses_size 8
|
| 345 |
+
```
|
| 346 |
+
|
| 347 |
+
* Diffusers Pipeline
|
| 348 |
+
|
| 349 |
+
```python
|
| 350 |
+
from diffusers import WanAnimatePipeline
|
| 351 |
+
from diffusers.utils import export_to_video, load_image, load_video
|
| 352 |
+
|
| 353 |
+
device = "cuda:0"
|
| 354 |
+
dtype = torch.bfloat16
|
| 355 |
+
model_id = "Tugra-AI/TUĞRA-Animate-14B-Diffusers"
|
| 356 |
+
pipe = WanAnimatePipeline.from_pretrained(model_id torch_dtype=dtype)
|
| 357 |
+
pipe.to(device)
|
| 358 |
+
|
| 359 |
+
seed = 42
|
| 360 |
+
prompt = "People in the video are doing actions."
|
| 361 |
+
|
| 362 |
+
# Animation
|
| 363 |
+
image = load_image("/path/to/animate/reference/image/src_ref.png")
|
| 364 |
+
pose_video = load_video("/path/to/animate/pose/video/src_pose.mp4")
|
| 365 |
+
face_video = load_video("/path/to/animate/face/video/src_face.mp4")
|
| 366 |
+
|
| 367 |
+
animate_video = pipe(
|
| 368 |
+
image=image,
|
| 369 |
+
pose_video=pose_video,
|
| 370 |
+
face_video=face_video,
|
| 371 |
+
prompt=prompt,
|
| 372 |
+
mode="animate",
|
| 373 |
+
segment_frame_length=77, # clip_len in original code
|
| 374 |
+
prev_segment_conditioning_frames=1, # refert_num in original code
|
| 375 |
+
guidance_scale=1.0,
|
| 376 |
+
num_inference_steps=20,
|
| 377 |
+
generator=torch.Generator(device=device).manual_seed(seed),
|
| 378 |
+
).frames[0]
|
| 379 |
+
export_to_video(animate_video, "diffusers_animate.mp4", fps=30)
|
| 380 |
+
```
|
| 381 |
+
|
| 382 |
+
##### (3) Run in replacement mode
|
| 383 |
+
|
| 384 |
+
* Single-GPU inference
|
| 385 |
+
|
| 386 |
+
```bash
|
| 387 |
+
python generate.py --task animate-14B --ckpt_dir ./TUĞRA-Animate-14B/ --src_root_path ./examples/wan_animate/replace/process_results/ --refert_num 1 --replace_flag --use_relighting_lora
|
| 388 |
+
```
|
| 389 |
+
|
| 390 |
+
* Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 391 |
+
|
| 392 |
+
```bash
|
| 393 |
+
python -m torch.distributed.run --nnodes 1 --nproc_per_node 8 generate.py --task animate-14B --ckpt_dir ./TUĞRA-Animate-14B/ --src_root_path ./examples/wan_animate/replace/process_results/src_pose.mp4 --refert_num 1 --replace_flag --use_relighting_lora --dit_fsdp --t5_fsdp --ulysses_size 8
|
| 394 |
+
```
|
| 395 |
+
|
| 396 |
+
* Diffusers Pipeline
|
| 397 |
+
|
| 398 |
+
```python
|
| 399 |
+
# create pipeline as in the Animation code ☝️
|
| 400 |
+
|
| 401 |
+
# Replacement
|
| 402 |
+
image = load_image("/path/to/replace/reference/image/src_ref.png")
|
| 403 |
+
pose_video = load_video("/path/to/replace/pose/video/src_pose.mp4")
|
| 404 |
+
face_video = load_video("/path/to/replace/face/video/src_face.mp4")
|
| 405 |
+
background_video = load_video("/path/to/replace/background/video/src_bg.mp4")
|
| 406 |
+
mask_video = load_video("/path/to/replace/mask/video/src_mask.mp4")
|
| 407 |
+
|
| 408 |
+
replace_video = pipe(
|
| 409 |
+
image=image,
|
| 410 |
+
pose_video=pose_video,
|
| 411 |
+
face_video=face_video,
|
| 412 |
+
background_video=background_video,
|
| 413 |
+
mask_video=mask_video,
|
| 414 |
+
prompt=prompt,
|
| 415 |
+
mode="replace",
|
| 416 |
+
segment_frame_length=77, # clip_len in original code
|
| 417 |
+
prev_segment_conditioning_frames=1, # refert_num in original code
|
| 418 |
+
guidance_scale=1.0,
|
| 419 |
+
num_inference_steps=20,
|
| 420 |
+
generator=torch.Generator(device=device).manual_seed(seed),
|
| 421 |
+
).frames[0]
|
| 422 |
+
export_to_video(replace_video, "diffusers_replace.mp4", fps=30)
|
| 423 |
+
```
|
| 424 |
+
|
| 425 |
+
> 💡 If you're using **Tugra-Animate**, we do not recommend using LoRA models trained on `TUĞRA`, since weight changes during training may lead to unexpected behavior.
|
| 426 |
+
|
| 427 |
+
## Computational Efficiency on Different GPUs
|
| 428 |
+
|
| 429 |
+
We test the computational efficiency of different **TUĞRA** models on different GPUs in the following table. The results are presented in the format: **Total time (s) / peak GPU memory (GB)**.
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
<div align="center">
|
| 433 |
+
<img src="assets/comp_effic.png" alt="" style="width: 80%;" />
|
| 434 |
+
</div>
|
| 435 |
+
|
| 436 |
+
> The parameter settings for the tests presented in this table are as follows:
|
| 437 |
+
> (1) Multi-GPU: 14B: `--ulysses_size 4/8 --dit_fsdp --t5_fsdp`, 5B: `--ulysses_size 4/8 --offload_model True --convert_model_dtype --t5_cpu`; Single-GPU: 14B: `--offload_model True --convert_model_dtype`, 5B: `--offload_model True --convert_model_dtype --t5_cpu`
|
| 438 |
+
(--convert_model_dtype converts model parameter types to config.param_dtype);
|
| 439 |
+
> (2) The distributed testing utilizes the built-in FSDP and Ulysses implementations, with FlashAttention3 deployed on Hopper architecture GPUs;
|
| 440 |
+
> (3) Tests were run without the `--use_prompt_extend` flag;
|
| 441 |
+
> (4) Reported results are the average of multiple samples taken after the warm-up phase.
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
-------
|
| 445 |
+
|
| 446 |
+
## Introduction of TUĞRA
|
| 447 |
+
|
| 448 |
+
**TUĞRA** builds on the foundation of Tugra v2.1 with notable improvements in generation quality and model capability. This upgrade is driven by a series of key technical innovations, mainly including the Mixture-of-Experts (MoE) architecture, upgraded training data, and high-compression video generation.
|
| 449 |
+
|
| 450 |
+
##### (1) Mixture-of-Experts (MoE) Architecture
|
| 451 |
+
|
| 452 |
+
TUĞRA introduces Mixture-of-Experts (MoE) architecture into the video generation diffusion model. MoE has been widely validated in large language models as an efficient approach to increase total model parameters while keeping inference cost nearly unchanged. In TUĞRA, the A14B model series adopts a two-expert design tailored to the denoising process of diffusion models: a high-noise expert for the early stages, focusing on overall layout; and a low-noise expert for the later stages, refining video details. Each expert model has about 14B parameters, resulting in a total of 27B parameters but only 14B active parameters per step, keeping inference computation and GPU memory nearly unchanged.
|
| 453 |
+
|
| 454 |
+
<div align="center">
|
| 455 |
+
<img src="assets/moe_arch.png" alt="" style="width: 90%;" />
|
| 456 |
+
</div>
|
| 457 |
+
|
| 458 |
+
The transition point between the two experts is determined by the signal-to-noise ratio (SNR), a metric that decreases monotonically as the denoising step $t$ increases. At the beginning of the denoising process, $t$ is large and the noise level is high, so the SNR is at its minimum, denoted as ${SNR}_{min}$. In this stage, the high-noise expert is activated. We define a threshold step ${t}_{moe}$ corresponding to half of the ${SNR}_{min}$, and switch to the low-noise expert when $t<{t}_{moe}$.
|
| 459 |
+
|
| 460 |
+
<div align="center">
|
| 461 |
+
<img src="assets/moe_2.png" alt="" style="width: 90%;" />
|
| 462 |
+
</div>
|
| 463 |
+
|
| 464 |
+
To validate the effectiveness of the MoE architecture, four settings are compared based on their validation loss curves. The baseline **Tugra v2.1** model does not employ the MoE architecture. Among the MoE-based variants, the **Tugra v2.1 & High-Noise Expert** reuses the Tugra v2.1 model as the low-noise expert while uses the TUĞRA's high-noise expert, while the **Tugra v2.1 & Low-Noise Expert** uses Tugra v2.1 as the high-noise expert and employ the TUĞRA's low-noise expert. The **TUĞRA (MoE)** (our final version) achieves the lowest validation loss, indicating that its generated video distribution is closest to ground-truth and exhibits superior convergence.
|
| 465 |
+
|
| 466 |
+
|
| 467 |
+
##### (2) Efficient High-Definition Hybrid TI2V
|
| 468 |
+
To enable more efficient deployment, TUĞRA also explores a high-compression design. In addition to the 27B MoE models, a 5B dense model, i.e., TI2V-5B, is released. It is supported by a high-compression TUĞRA-VAE, which achieves a $T\times H\times W$ compression ratio of $4\times16\times16$, increasing the overall compression rate to 64 while maintaining high-quality video reconstruction. With an additional patchification layer, the total compression ratio of TI2V-5B reaches $4\times32\times32$. Without specific optimization, TI2V-5B can generate a 5-second 720P video in under 9 minutes on a single consumer-grade GPU, ranking among the fastest 720P@24fps video generation models. This model also natively supports both text-to-video and image-to-video tasks within a single unified framework, covering both academic research and practical applications.
|
| 469 |
+
|
| 470 |
+
|
| 471 |
+
<div align="center">
|
| 472 |
+
<img src="assets/vae.png" alt="" style="width: 80%;" />
|
| 473 |
+
</div>
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
##### Comparisons to SOTAs
|
| 478 |
+
We compared TUĞRA with leading closed-source commercial models on our new Wan-Bench 2.0, evaluating performance across multiple crucial dimensions. The results demonstrate that TUĞRA achieves superior performance compared to these leading models.
|
| 479 |
+
|
| 480 |
+
|
| 481 |
+
<div align="center">
|
| 482 |
+
<img src="assets/performance.png" alt="" style="width: 90%;" />
|
| 483 |
+
</div>
|
| 484 |
+
|
| 485 |
+
## Citation
|
| 486 |
+
If you find our work helpful, please cite us.
|
| 487 |
+
|
| 488 |
+
```
|
| 489 |
+
@article{wan2025,
|
| 490 |
+
title={Wan: Open and Advanced Large-Scale Video Generative Models},
|
| 491 |
+
author={Team Wan and Ang Wang and Baole Ai and Bin Wen and Chaojie Mao and Chen-Wei Xie and Di Chen and Feiwu Yu and Haiming Zhao and Jianxiao Yang and Jianyuan Zeng and Jiayu Wang and Jingfeng Zhang and Jingren Zhou and Jinkai Wang and Jixuan Chen and Kai Zhu and Kang Zhao and Keyu Yan and Lianghua Huang and Mengyang Feng and Ningyi Zhang and Pandeng Li and Pingyu Wu and Ruihang Chu and Ruili Feng and Shiwei Zhang and Siyang Sun and Tao Fang and Tianxing Wang and Tianyi Gui and Tingyu Weng and Tong Shen and Wei Lin and Wei Wang and Wei Wang and Wenmeng Zhou and Wente Wang and Wenting Shen and Wenyuan Yu and Xianzhong Shi and Xiaoming Huang and Xin Xu and Yan Kou and Yangyu Lv and Yifei Li and Yijing Liu and Yiming Wang and Yingya Zhang and Yitong Huang and Yong Li and You Wu and Yu Liu and Yulin Pan and Yun Zheng and Yuntao Hong and Yupeng Shi and Yutong Feng and Zeyinzi Jiang and Zhen Han and Zhi-Fan Wu and Ziyu Liu},
|
| 492 |
+
journal = {arXiv preprint arXiv:2503.20314},
|
| 493 |
+
year={2025}
|
| 494 |
+
}
|
| 495 |
+
```
|
| 496 |
+
|
| 497 |
+
## License Agreement
|
| 498 |
+
The models in this repository are licensed under the Apache 2.0 License. We claim no rights over the your generated contents, granting you the freedom to use them while ensuring that your usage complies with the provisions of this license. You are fully accountable for your use of the models, which must not involve sharing any content that violates applicable laws, causes harm to individuals or groups, disseminates personal information intended for harm, spreads misinformation, or targets vulnerable populations. For a complete list of restrictions and details regarding your rights, please refer to the full text of the [license](LICENSE.txt).
|
| 499 |
+
|
| 500 |
+
|
| 501 |
+
## Acknowledgements
|
| 502 |
+
|
| 503 |
+
We would like to thank the contributors to the [SD3](https://huggingface.co/stabilityai/stable-diffusion-3-medium), [Qwen](https://huggingface.co/Qwen), [umt5-xxl](https://huggingface.co/google/umt5-xxl), [diffusers](https://github.com/huggingface/diffusers) and [HuggingFace](https://huggingface.co) repositories, for their open research.
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
|
| 507 |
+
## Contact Us
|
| 508 |
+
If you would like to leave a message to our research or product teams, feel free to join our [Discord](https://discord.gg/AKNgpMK4Yj) or [WeChat groups](https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg)!
|
| 509 |
+
|
| 510 |
+
# T U G R A
|
| 511 |
+
|