mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-11-05 06:29:14 +00:00
Fixe Sage test
This commit is contained in:
parent
826d5ac84f
commit
1c69191954
12
README.md
12
README.md
@ -19,25 +19,25 @@ In this repository, we present **Wan2.1**, a comprehensive and open suite of vid
|
||||
|
||||
|
||||
## 🔥 Latest News!!
|
||||
* Mar 19 2022: 👋 Wan2.1GP v3.2:
|
||||
* Mar 19 2025: 👋 Wan2.1GP v3.2:
|
||||
- Added Classifier-Free Guidance Zero Star. The video should match better the text prompt (especially with text2video) at no performance cost: many thanks to the **CFG Zero * Team:**\
|
||||
Dont hesitate to give them a star if you appreciate the results: https://github.com/WeichenFan/CFG-Zero-star
|
||||
- Added back support for Pytorch compilation with Loras. It seems it had been broken for some time
|
||||
- Added possibility to keep a number of pregenerated videos in the Video Gallery (useful to compare outputs of different settings)
|
||||
You will need one more *pip install -r requirements.txt*
|
||||
* Mar 19 2022: 👋 Wan2.1GP v3.1: Faster launch and RAM optimizations (should require less RAM to run)\
|
||||
* Mar 19 2025: 👋 Wan2.1GP v3.1: Faster launch and RAM optimizations (should require less RAM to run)\
|
||||
You will need one more *pip install -r requirements.txt*
|
||||
* Mar 18 2022: 👋 Wan2.1GP v3.0:
|
||||
* Mar 18 2025: 👋 Wan2.1GP v3.0:
|
||||
- New Tab based interface, yon can switch from i2v to t2v conversely without restarting the app
|
||||
- Experimental Dual Frames mode for i2v, you can also specify an End frame. It doesn't always work, so you will need a few attempts.
|
||||
- You can save default settings in the files *i2v_settings.json* and *t2v_settings.json* that will be used when launching the app (you can also specify the path to different settings files)
|
||||
- Slight acceleration with loras\
|
||||
You will need one more *pip install -r requirements.txt*
|
||||
Many thanks to *Tophness* who created the framework (and did a big part of the work) of the multitabs and saved settings features
|
||||
* Mar 18 2022: 👋 Wan2.1GP v2.11: Added more command line parameters to prefill the generation settings + customizable output directory and choice of type of metadata for generated videos. Many thanks to *Tophness* for his contributions. You will need one more *pip install -r requirements.txt* to reflect new dependencies\
|
||||
* Mar 18 2022: 👋 Wan2.1GP v2.1: More Loras !: added support for 'Safetensors' and 'Replicate' Lora formats.\
|
||||
* Mar 18 2025: 👋 Wan2.1GP v2.11: Added more command line parameters to prefill the generation settings + customizable output directory and choice of type of metadata for generated videos. Many thanks to *Tophness* for his contributions. You will need one more *pip install -r requirements.txt* to reflect new dependencies\
|
||||
* Mar 18 2025: 👋 Wan2.1GP v2.1: More Loras !: added support for 'Safetensors' and 'Replicate' Lora formats.\
|
||||
You will need to refresh the requirements with a *pip install -r requirements.txt*
|
||||
* Mar 17 2022: 👋 Wan2.1GP v2.0: The Lora festival continues:
|
||||
* Mar 17 2025: 👋 Wan2.1GP v2.0: The Lora festival continues:
|
||||
- Clearer user interface
|
||||
- Download 30 Loras in one click to try them all (expand the info section)
|
||||
- Very to use Loras as now Lora presets can input the subject (or other need terms) of the Lora so that you dont have to modify manually a prompt
|
||||
|
||||
@ -847,14 +847,15 @@ def abort_generation(state):
|
||||
|
||||
def refresh_gallery(state, txt):
|
||||
file_list = state.get("file_list", None)
|
||||
choice = state.get("selected",0)
|
||||
if "in_progress" in state:
|
||||
if state.get("last_selected", True):
|
||||
choice = max(len(file_list) - 1,0)
|
||||
|
||||
prompt = state.get("prompt", "")
|
||||
if len(prompt) == 0:
|
||||
return file_list, gr.Text(visible= False, value="")
|
||||
else:
|
||||
choice = 0
|
||||
if "in_progress" in state:
|
||||
choice = state.get("selected",0)
|
||||
|
||||
prompts_max = state.get("prompts_max",0)
|
||||
prompt_no = state.get("prompt_no",0)
|
||||
if prompts_max >1 :
|
||||
@ -869,7 +870,9 @@ def finalize_gallery(state):
|
||||
if "in_progress" in state:
|
||||
del state["in_progress"]
|
||||
choice = state.get("selected",0)
|
||||
# file_list = state.get("file_list", [])
|
||||
if state.get("last_selected", True):
|
||||
file_list = state.get("file_list", [])
|
||||
choice = len(file_list) - 1
|
||||
|
||||
|
||||
state["extra_orders"] = 0
|
||||
@ -881,7 +884,10 @@ def finalize_gallery(state):
|
||||
def select_video(state , event_data: gr.EventData):
|
||||
data= event_data._data
|
||||
if data!=None:
|
||||
state["selected"] = data.get("index",0)
|
||||
choice = data.get("index",0)
|
||||
file_list = state.get("file_list", [])
|
||||
state["last_selected"] = (choice + 1) >= len(file_list)
|
||||
state["selected"] = choice
|
||||
return
|
||||
|
||||
def expand_slist(slist, num_inference_steps ):
|
||||
@ -1199,6 +1205,7 @@ def generate_video(
|
||||
state["selected"] = choice
|
||||
state["file_list"] = file_list
|
||||
|
||||
|
||||
global save_path
|
||||
os.makedirs(save_path, exist_ok=True)
|
||||
video_no = 0
|
||||
|
||||
@ -409,10 +409,9 @@ class WanI2V:
|
||||
|
||||
|
||||
if (i <= cfg_zero_step):
|
||||
noise_pred = noise_pred_text*0.
|
||||
else:
|
||||
noise_pred = noise_pred_uncond * alpha + guide_scale * (noise_pred_text - noise_pred_uncond * alpha)
|
||||
noise_pred *= 0. # it would be faster not to compute noise_pred...
|
||||
else:
|
||||
noise_pred_uncond *= alpha
|
||||
noise_pred = noise_pred_uncond + guide_scale * (noise_pred_text - noise_pred_uncond)
|
||||
|
||||
del noise_pred_uncond
|
||||
|
||||
@ -39,12 +39,12 @@ import warnings
|
||||
|
||||
try:
|
||||
from sageattention import sageattn
|
||||
from .sage2_core import sageattn as alt_sageattn, is_sage_supported
|
||||
sage_supported = is_sage_supported()
|
||||
from .sage2_core import sageattn as alt_sageattn, is_sage2_supported
|
||||
sage2_supported = is_sage2_supported()
|
||||
except ImportError:
|
||||
sageattn = None
|
||||
alt_sageattn = None
|
||||
sage_supported = False
|
||||
sage2_supported = False
|
||||
# @torch.compiler.disable()
|
||||
def sageattn_wrapper(
|
||||
qkv_list,
|
||||
@ -134,9 +134,7 @@ def get_attention_modes():
|
||||
|
||||
def get_supported_attention_modes():
|
||||
ret = get_attention_modes()
|
||||
if not sage_supported:
|
||||
if "sage" in ret:
|
||||
ret.remove("sage")
|
||||
if not sage2_supported:
|
||||
if "sage2" in ret:
|
||||
ret.remove("sage2")
|
||||
return ret
|
||||
|
||||
@ -53,7 +53,7 @@ from typing import Any, List, Literal, Optional, Tuple, Union
|
||||
import warnings
|
||||
import os
|
||||
|
||||
def is_sage_supported():
|
||||
def is_sage2_supported():
|
||||
device_count = torch.cuda.device_count()
|
||||
for i in range(device_count):
|
||||
major, minor = torch.cuda.get_device_capability(i)
|
||||
|
||||
@ -305,12 +305,10 @@ class WanT2V:
|
||||
alpha = optimized_scale(positive_flat,negative_flat)
|
||||
alpha = alpha.view(batch_size, 1, 1, 1)
|
||||
|
||||
|
||||
if (i <= cfg_zero_step):
|
||||
noise_pred = noise_pred_text*0.
|
||||
else:
|
||||
noise_pred = noise_pred_uncond * alpha + guide_scale * (noise_pred_text - noise_pred_uncond * alpha)
|
||||
noise_pred *= 0. # it would be faster not to compute noise_pred...
|
||||
else:
|
||||
noise_pred_uncond *= alpha
|
||||
noise_pred = noise_pred_uncond + guide_scale * (noise_pred_text - noise_pred_uncond)
|
||||
del noise_pred_uncond
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user