Commit 236df981 authored by Musisoul's avatar Musisoul Committed by GitHub
Browse files

Support Magcache (#219)

* Add magcache

* fix

* lint

* fix

* update script

* Support cfg infer

* support cfg parallel

* update cfgsp/t2v config

* support magcache calibration

* calibration
parent 53787c69
{
"infer_steps": 40,
"target_video_length": 81,
"target_height": 480,
"target_width": 832,
"self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3",
"seed": 42,
"sample_guide_scale": 5,
"sample_shift": 5,
"enable_cfg": true,
"cpu_offload": false,
"parallel": {
"seq_p_size": 4,
"seq_p_attn_type": "ulysses",
"cfg_p_size": 2
},
"feature_caching": "Mag",
"magcache_calibration": false,
"magcache_K": 6,
"magcache_thresh": 0.24,
"magcache_retention_ratio": 0.2,
"magcache_ratios": [[1.0, 0.98783, 0.97559, 0.98311, 0.98202, 0.9888, 0.98762, 0.98957, 0.99052, 0.99383, 0.98857, 0.99065, 0.98845, 0.99057, 0.98957, 0.98601, 0.98823, 0.98756, 0.98808, 0.98721, 0.98571, 0.98543, 0.98157, 0.98411, 0.97952, 0.98149, 0.9774, 0.97825, 0.97355, 0.97085, 0.97056, 0.96588, 0.96113, 0.9567, 0.94961, 0.93973, 0.93217, 0.91878, 0.90955, 0.92617], [1.0, 0.98993, 0.97593, 0.98319, 0.98225, 0.98878, 0.98759, 0.98971, 0.99043, 0.99384, 0.9886, 0.99068, 0.98847, 0.99057, 0.98961, 0.9861, 0.98823, 0.98759, 0.98814, 0.98724, 0.98572, 0.98544, 0.98165, 0.98413, 0.97953, 0.9815, 0.97742, 0.97826, 0.97361, 0.97087, 0.97055, 0.96587, 0.96124, 0.95681, 0.94969, 0.93988, 0.93224, 0.91896, 0.90954, 0.92616]]
}
{
"infer_steps": 40,
"target_video_length": 81,
"target_height": 480,
"target_width": 832,
"self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3",
"seed": 42,
"sample_guide_scale": 5,
"sample_shift": 5,
"enable_cfg": true,
"cpu_offload": false,
"feature_caching": "Mag",
"magcache_calibration": false,
"magcache_K": 6,
"magcache_thresh": 0.24,
"magcache_retention_ratio": 0.2,
"magcache_ratios": [[1.0, 0.98783, 0.97559, 0.98311, 0.98202, 0.9888, 0.98762, 0.98957, 0.99052, 0.99383, 0.98857, 0.99065, 0.98845, 0.99057, 0.98957, 0.98601, 0.98823, 0.98756, 0.98808, 0.98721, 0.98571, 0.98543, 0.98157, 0.98411, 0.97952, 0.98149, 0.9774, 0.97825, 0.97355, 0.97085, 0.97056, 0.96588, 0.96113, 0.9567, 0.94961, 0.93973, 0.93217, 0.91878, 0.90955, 0.92617], [1.0, 0.98993, 0.97593, 0.98319, 0.98225, 0.98878, 0.98759, 0.98971, 0.99043, 0.99384, 0.9886, 0.99068, 0.98847, 0.99057, 0.98961, 0.9861, 0.98823, 0.98759, 0.98814, 0.98724, 0.98572, 0.98544, 0.98165, 0.98413, 0.97953, 0.9815, 0.97742, 0.97826, 0.97361, 0.97087, 0.97055, 0.96587, 0.96124, 0.95681, 0.94969, 0.93988, 0.93224, 0.91896, 0.90954, 0.92616]]
}
{
"infer_steps": 40,
"target_video_length": 81,
"target_height": 480,
"target_width": 832,
"self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3",
"seed": 42,
"sample_guide_scale": 5,
"sample_shift": 5,
"enable_cfg": true,
"cpu_offload": false,
"feature_caching": "Mag",
"magcache_calibration": true,
"magcache_K": 6,
"magcache_thresh": 0.24,
"magcache_retention_ratio": 0.2,
"magcache_ratios": [[1.0, 0.98783, 0.97559, 0.98311, 0.98202, 0.9888, 0.98762, 0.98957, 0.99052, 0.99383, 0.98857, 0.99065, 0.98845, 0.99057, 0.98957, 0.98601, 0.98823, 0.98756, 0.98808, 0.98721, 0.98571, 0.98543, 0.98157, 0.98411, 0.97952, 0.98149, 0.9774, 0.97825, 0.97355, 0.97085, 0.97056, 0.96588, 0.96113, 0.9567, 0.94961, 0.93973, 0.93217, 0.91878, 0.90955, 0.92617], [1.0, 0.98993, 0.97593, 0.98319, 0.98225, 0.98878, 0.98759, 0.98971, 0.99043, 0.99384, 0.9886, 0.99068, 0.98847, 0.99057, 0.98961, 0.9861, 0.98823, 0.98759, 0.98814, 0.98724, 0.98572, 0.98544, 0.98165, 0.98413, 0.97953, 0.9815, 0.97742, 0.97826, 0.97361, 0.97087, 0.97055, 0.96587, 0.96124, 0.95681, 0.94969, 0.93988, 0.93224, 0.91896, 0.90954, 0.92616]]
}
{
"infer_steps": 50,
"target_video_length": 81,
"text_len": 512,
"target_height": 480,
"target_width": 832,
"self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3",
"seed": 42,
"sample_guide_scale": 6,
"sample_shift": 8,
"enable_cfg": true,
"cpu_offload": false,
"parallel": {
"seq_p_size": 4,
"seq_p_attn_type": "ulysses",
"cfg_p_size": 2
},
"feature_caching": "Mag",
"magcache_calibration": false,
"magcache_K": 4,
"magcache_thresh": 0.12,
"magcache_retention_ratio": 0.2,
"magcache_ratios": [[1.0, 1.0124, 1.00166, 0.99791, 0.99682, 0.99634, 0.99567, 0.99416, 0.99578, 0.9957, 0.99511, 0.99535, 0.99552, 0.99541, 0.9954, 0.99489, 0.99518, 0.99484, 0.99481, 0.99415, 0.99419, 0.99396, 0.99388, 0.99349, 0.99309, 0.9927, 0.99228, 0.99171, 0.99137, 0.99068, 0.99005, 0.98944, 0.98849, 0.98758, 0.98644, 0.98504, 0.9836, 0.98202, 0.97977, 0.97717, 0.9741, 0.97003, 0.96538, 0.9593, 0.95086, 0.94013, 0.92402, 0.90241, 0.86821, 0.81838], [1.0, 1.02213, 1.0041, 1.00061, 0.99762, 0.99685, 0.99586, 0.99422, 0.99575, 0.99563, 0.99506, 0.99531, 0.99549, 0.99539, 0.99536, 0.99485, 0.99514, 0.99478, 0.99479, 0.99413, 0.99416, 0.99393, 0.99386, 0.99349, 0.99304, 0.9927, 0.99226, 0.9917, 0.99135, 0.99063, 0.99003, 0.98942, 0.98849, 0.98757, 0.98643, 0.98503, 0.98359, 0.98201, 0.97978, 0.97718, 0.97411, 0.97002, 0.96541, 0.95933, 0.95089, 0.94019, 0.92414, 0.9026, 0.86868, 0.81939]]
}
{
"infer_steps": 50,
"target_video_length": 81,
"text_len": 512,
"target_height": 480,
"target_width": 832,
"self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3",
"seed": 42,
"sample_guide_scale": 6,
"sample_shift": 8,
"enable_cfg": true,
"cpu_offload": false,
"feature_caching": "Mag",
"magcache_calibration": false,
"magcache_K": 4,
"magcache_thresh": 0.12,
"magcache_retention_ratio": 0.2,
"magcache_ratios": [[1.0, 1.0124, 1.00166, 0.99791, 0.99682, 0.99634, 0.99567, 0.99416, 0.99578, 0.9957, 0.99511, 0.99535, 0.99552, 0.99541, 0.9954, 0.99489, 0.99518, 0.99484, 0.99481, 0.99415, 0.99419, 0.99396, 0.99388, 0.99349, 0.99309, 0.9927, 0.99228, 0.99171, 0.99137, 0.99068, 0.99005, 0.98944, 0.98849, 0.98758, 0.98644, 0.98504, 0.9836, 0.98202, 0.97977, 0.97717, 0.9741, 0.97003, 0.96538, 0.9593, 0.95086, 0.94013, 0.92402, 0.90241, 0.86821, 0.81838], [1.0, 1.02213, 1.0041, 1.00061, 0.99762, 0.99685, 0.99586, 0.99422, 0.99575, 0.99563, 0.99506, 0.99531, 0.99549, 0.99539, 0.99536, 0.99485, 0.99514, 0.99478, 0.99479, 0.99413, 0.99416, 0.99393, 0.99386, 0.99349, 0.99304, 0.9927, 0.99226, 0.9917, 0.99135, 0.99063, 0.99003, 0.98942, 0.98849, 0.98757, 0.98643, 0.98503, 0.98359, 0.98201, 0.97978, 0.97718, 0.97411, 0.97002, 0.96541, 0.95933, 0.95089, 0.94019, 0.92414, 0.9026, 0.86868, 0.81939]]
}
{
"infer_steps": 50,
"target_video_length": 81,
"text_len": 512,
"target_height": 480,
"target_width": 832,
"self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3",
"seed": 42,
"sample_guide_scale": 6,
"sample_shift": 8,
"enable_cfg": true,
"cpu_offload": false,
"feature_caching": "Mag",
"magcache_calibration": true,
"magcache_K": 4,
"magcache_thresh": 0.12,
"magcache_retention_ratio": 0.2,
"magcache_ratios": [[1.0, 1.0124, 1.00166, 0.99791, 0.99682, 0.99634, 0.99567, 0.99416, 0.99578, 0.9957, 0.99511, 0.99535, 0.99552, 0.99541, 0.9954, 0.99489, 0.99518, 0.99484, 0.99481, 0.99415, 0.99419, 0.99396, 0.99388, 0.99349, 0.99309, 0.9927, 0.99228, 0.99171, 0.99137, 0.99068, 0.99005, 0.98944, 0.98849, 0.98758, 0.98644, 0.98504, 0.9836, 0.98202, 0.97977, 0.97717, 0.9741, 0.97003, 0.96538, 0.9593, 0.95086, 0.94013, 0.92402, 0.90241, 0.86821, 0.81838], [1.0, 1.02213, 1.0041, 1.00061, 0.99762, 0.99685, 0.99586, 0.99422, 0.99575, 0.99563, 0.99506, 0.99531, 0.99549, 0.99539, 0.99536, 0.99485, 0.99514, 0.99478, 0.99479, 0.99413, 0.99416, 0.99393, 0.99386, 0.99349, 0.99304, 0.9927, 0.99226, 0.9917, 0.99135, 0.99063, 0.99003, 0.98942, 0.98849, 0.98757, 0.98643, 0.98503, 0.98359, 0.98201, 0.97978, 0.97718, 0.97411, 0.97002, 0.96541, 0.95933, 0.95089, 0.94019, 0.92414, 0.9026, 0.86868, 0.81939]]
}
import gc
import json
import numpy as np
import torch
import torch.nn.functional as F
from lightx2v.common.transformer_infer.transformer_infer import BaseTaylorCachingTransformerInfer
......@@ -986,3 +988,115 @@ class WanTransformerInferDynamicBlock(WanTransformerInferCaching):
self.block_in_cache_odd[i] = None
self.block_residual_cache_odd[i] = None
torch.cuda.empty_cache()
class WanTransformerInferMagCaching(WanTransformerInferCaching):
def __init__(self, config):
super().__init__(config)
self.magcache_thresh = config.magcache_thresh
self.K = config.magcache_K
self.retention_ratio = config.magcache_retention_ratio
self.mag_ratios = np.array(config.magcache_ratios)
# {True: cond_param, False: uncond_param}
self.accumulated_err = {True: 0.0, False: 0.0}
self.accumulated_steps = {True: 0, False: 0}
self.accumulated_ratio = {True: 1.0, False: 1.0}
self.residual_cache = {True: None, False: None}
# calibration args
self.norm_ratio = [[1.0], [1.0]] # mean of magnitude ratio
self.norm_std = [[0.0], [0.0]] # std of magnitude ratio
self.cos_dis = [[0.0], [0.0]] # cosine distance of residual features
def infer_main_blocks(self, weights, pre_infer_out):
skip_forward = False
step_index = self.scheduler.step_index
infer_condition = self.scheduler.infer_condition
if self.config.magcache_calibration:
skip_forward = False
else:
if step_index >= int(self.config.infer_steps * self.retention_ratio):
# conditional and unconditional in one list
cur_mag_ratio = self.mag_ratios[0][step_index] if infer_condition else self.mag_ratios[1][step_index]
# magnitude ratio between current step and the cached step
self.accumulated_ratio[infer_condition] = self.accumulated_ratio[infer_condition] * cur_mag_ratio
self.accumulated_steps[infer_condition] += 1 # skip steps plus 1
# skip error of current steps
cur_skip_err = np.abs(1 - self.accumulated_ratio[infer_condition])
# accumulated error of multiple steps
self.accumulated_err[infer_condition] += cur_skip_err
if self.accumulated_err[infer_condition] < self.magcache_thresh and self.accumulated_steps[infer_condition] <= self.K:
skip_forward = True
else:
self.accumulated_err[infer_condition] = 0
self.accumulated_steps[infer_condition] = 0
self.accumulated_ratio[infer_condition] = 1.0
if not skip_forward:
x = self.infer_calculating(weights, pre_infer_out)
else:
x = self.infer_using_cache(pre_infer_out.x)
if self.clean_cuda_cache:
torch.cuda.empty_cache()
return x
def infer_calculating(self, weights, pre_infer_out):
step_index = self.scheduler.step_index
infer_condition = self.scheduler.infer_condition
ori_x = pre_infer_out.x.clone()
x = super().infer_main_blocks(weights, pre_infer_out)
previous_residual = x - ori_x
if self.config["cpu_offload"]:
previous_residual = previous_residual.cpu()
if self.config.magcache_calibration and step_index >= 1:
norm_ratio = ((previous_residual.norm(dim=-1) / self.residual_cache[infer_condition].norm(dim=-1)).mean()).item()
norm_std = (previous_residual.norm(dim=-1) / self.residual_cache[infer_condition].norm(dim=-1)).std().item()
cos_dis = (1 - F.cosine_similarity(previous_residual, self.residual_cache[infer_condition], dim=-1, eps=1e-8)).mean().item()
_index = int(not infer_condition)
self.norm_ratio[_index].append(round(norm_ratio, 5))
self.norm_std[_index].append(round(norm_std, 5))
self.cos_dis[_index].append(round(cos_dis, 5))
print(f"time: {step_index}, infer_condition: {infer_condition}, norm_ratio: {norm_ratio}, norm_std: {norm_std}, cos_dis: {cos_dis}")
self.residual_cache[infer_condition] = previous_residual
if self.config["cpu_offload"]:
ori_x = ori_x.to("cpu")
del ori_x
torch.cuda.empty_cache()
gc.collect()
return x
def infer_using_cache(self, x):
residual_x = self.residual_cache[self.scheduler.infer_condition]
x.add_(residual_x.cuda())
return x
def clear(self):
self.accumulated_err = {True: 0.0, False: 0.0}
self.accumulated_steps = {True: 0, False: 0}
self.accumulated_ratio = {True: 1.0, False: 1.0}
self.residual_cache = {True: None, False: None}
if self.config.magcache_calibration:
print("norm ratio")
print(self.norm_ratio)
print("norm std")
print(self.norm_std)
print("cos_dis")
print(self.cos_dis)
def save_json(filename, obj_list):
with open(filename + ".json", "w") as f:
json.dump(obj_list, f)
save_json("wan2_1_mag_ratio", self.norm_ratio)
save_json("wan2_1_mag_std", self.norm_std)
save_json("wan2_1_cos_dis", self.cos_dis)
torch.cuda.empty_cache()
......@@ -14,6 +14,7 @@ from lightx2v.models.networks.wan.infer.feature_caching.transformer_infer import
WanTransformerInferDualBlock,
WanTransformerInferDynamicBlock,
WanTransformerInferFirstBlock,
WanTransformerInferMagCaching,
WanTransformerInferTaylorCaching,
WanTransformerInferTeaCaching,
)
......@@ -104,6 +105,8 @@ class WanModel:
self.transformer_infer_class = WanTransformerInferDualBlock
elif self.config["feature_caching"] == "DynamicBlock":
self.transformer_infer_class = WanTransformerInferDynamicBlock
elif self.config["feature_caching"] == "Mag":
self.transformer_infer_class = WanTransformerInferMagCaching
else:
raise NotImplementedError(f"Unsupported feature_caching type: {self.config['feature_caching']}")
......
......@@ -182,7 +182,7 @@ class WanRunner(DefaultRunner):
scheduler_class = WanScheduler
elif self.config.feature_caching == "TaylorSeer":
scheduler_class = WanSchedulerTaylorCaching
elif self.config.feature_caching in ["Tea", "Ada", "Custom", "FirstBlock", "DualBlock", "DynamicBlock"]:
elif self.config.feature_caching in ["Tea", "Ada", "Custom", "FirstBlock", "DualBlock", "DynamicBlock", "Mag"]:
scheduler_class = WanSchedulerCaching
else:
raise NotImplementedError(f"Unsupported feature_caching type: {self.config.feature_caching}")
......
#!/bin/bash
# set path and first
lightx2v_path=
model_path=
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
torchrun --nproc_per_node=8 -m lightx2v.infer \
--model_cls wan2.1 \
--task i2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/caching/magcache/wan_i2v_dist_cfg_ulysses_mag_480p.json \
--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." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--image_path ${lightx2v_path}/assets/inputs/imgs/img_0.jpg \
--save_video_path ${lightx2v_path}/save_results/output_lightx2v_wan_i2v_dist_cfg_ulysses_mag.mp4
#!/bin/bash
# set path and first
lightx2v_path=
model_path=
export CUDA_VISIBLE_DEVICES=0
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls wan2.1 \
--task i2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/caching/magcache/wan_i2v_mag_480p.json \
--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." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--image_path ${lightx2v_path}/assets/inputs/imgs/img_0.jpg \
--save_video_path ${lightx2v_path}/save_results/output_lightx2v_wan_i2v_mag.mp4
#!/bin/bash
# set path and first
lightx2v_path=
model_path=
export CUDA_VISIBLE_DEVICES=0
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls wan2.1 \
--task i2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/caching/magcache/wan_i2v_mag_calibration_480p.json \
--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." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--image_path ${lightx2v_path}/assets/inputs/imgs/img_0.jpg \
--save_video_path ${lightx2v_path}/save_results/output_lightx2v_wan_i2v_mag.mp4
#!/bin/bash
# set path and first
lightx2v_path=
model_path=
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
torchrun --nproc_per_node=8 -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/caching/magcache/wan_t2v_dist_cfg_ulysses_mag_1_3b.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_video_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_dist_cfg_ulysses_mag.mp4
#!/bin/bash
# set path and first
lightx2v_path=
model_path=
export CUDA_VISIBLE_DEVICES=0
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/caching/magcache/wan_t2v_mag_1_3b.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_video_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_mag.mp4
#!/bin/bash
# set path and first
lightx2v_path=
model_path=
export CUDA_VISIBLE_DEVICES=0
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/caching/magcache/wan_t2v_mag_calibration_1_3b.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_video_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_mag.mp4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment