SYMBOL INDEX (655 symbols across 42 files) FILE: generate.py function _validate_args (line 62) | def _validate_args(args): function _parse_args (line 105) | def _parse_args(): function _init_logging (line 303) | def _init_logging(rank): function generate (line 315) | def generate(args): FILE: wan/animate.py class WanAnimate (line 36) | class WanAnimate: method __init__ (line 38) | def __init__( method _configure_model (line 144) | def _configure_model(self, model, use_sp, dit_fsdp, shard_fn, method inputs_padding (line 201) | def inputs_padding(self, array, target_len): method get_valid_len (line 215) | def get_valid_len(self, real_len, clip_len=81, overlap=1): method get_i2v_mask (line 226) | def get_i2v_mask(self, lat_t, lat_h, lat_w, mask_len=1, mask_pixel_val... method padding_resize (line 237) | def padding_resize(self, img_ori, height=512, width=512, padding_color... method prepare_source (line 269) | def prepare_source(self, src_pose_path, src_face_path, src_ref_path): method prepare_source_for_replace (line 284) | def prepare_source_for_replace(self, src_bg_path, src_mask_path): method generate (line 297) | def generate( FILE: wan/distributed/fsdp.py function shard_model (line 12) | def shard_model( function free_model (line 39) | def free_model(model): FILE: wan/distributed/sequence_parallel.py function pad_freqs (line 10) | def pad_freqs(original_tensor, target_len): function rope_apply (line 24) | def rope_apply(x, grid_sizes, freqs): function sp_dit_forward (line 64) | def sp_dit_forward( function sp_attn_forward (line 147) | def sp_attn_forward(self, x, seq_lens, grid_sizes, freqs, dtype=torch.bf... FILE: wan/distributed/ulysses.py function distributed_attention (line 9) | def distributed_attention( FILE: wan/distributed/util.py function init_distributed_group (line 6) | def init_distributed_group(): function get_rank (line 13) | def get_rank(): function get_world_size (line 17) | def get_world_size(): function all_to_all (line 21) | def all_to_all(x, scatter_dim, gather_dim, group=None, **kwargs): function all_gather (line 34) | def all_gather(tensor): function gather_forward (line 43) | def gather_forward(input, dim): FILE: wan/image2video.py class WanI2V (line 33) | class WanI2V: method __init__ (line 35) | def __init__( method _configure_model (line 128) | def _configure_model(self, model, use_sp, dit_fsdp, shard_fn, method _prepare_model_for_timestep (line 172) | def _prepare_model_for_timestep(self, t, boundary, offload_model): method generate (line 206) | def generate(self, FILE: wan/modules/animate/animate_utils.py function get_loraconfig (line 7) | def get_loraconfig(transformer, rank=128, alpha=128, init_lora_weights="... class TensorList (line 23) | class TensorList(object): method __init__ (line 25) | def __init__(self, tensors): method to (line 36) | def to(self, *args, **kwargs): method size (line 39) | def size(self, dim): method pow (line 43) | def pow(self, *args, **kwargs): method squeeze (line 46) | def squeeze(self, dim): method type (line 52) | def type(self, *args, **kwargs): method type_as (line 55) | def type_as(self, other): method dtype (line 63) | def dtype(self): method device (line 67) | def device(self): method ndim (line 71) | def ndim(self): method __getitem__ (line 74) | def __getitem__(self, index): method __len__ (line 77) | def __len__(self): method __add__ (line 80) | def __add__(self, other): method __radd__ (line 83) | def __radd__(self, other): method __sub__ (line 86) | def __sub__(self, other): method __rsub__ (line 89) | def __rsub__(self, other): method __mul__ (line 92) | def __mul__(self, other): method __rmul__ (line 95) | def __rmul__(self, other): method __floordiv__ (line 98) | def __floordiv__(self, other): method __truediv__ (line 101) | def __truediv__(self, other): method __rfloordiv__ (line 104) | def __rfloordiv__(self, other): method __rtruediv__ (line 107) | def __rtruediv__(self, other): method __pow__ (line 110) | def __pow__(self, other): method __rpow__ (line 113) | def __rpow__(self, other): method __neg__ (line 116) | def __neg__(self): method __iter__ (line 119) | def __iter__(self): method __repr__ (line 123) | def __repr__(self): method _apply (line 126) | def _apply(self, other, op): FILE: wan/modules/animate/clip.py function pos_interpolate (line 22) | def pos_interpolate(pos, seq_len): class QuickGELU (line 41) | class QuickGELU(nn.Module): method forward (line 43) | def forward(self, x): class LayerNorm (line 47) | class LayerNorm(nn.LayerNorm): method forward (line 49) | def forward(self, x): class SelfAttention (line 53) | class SelfAttention(nn.Module): method __init__ (line 55) | def __init__(self, method forward (line 74) | def forward(self, x): class SwiGLU (line 94) | class SwiGLU(nn.Module): method __init__ (line 96) | def __init__(self, dim, mid_dim): method forward (line 106) | def forward(self, x): class AttentionBlock (line 112) | class AttentionBlock(nn.Module): method __init__ (line 114) | def __init__(self, method forward (line 146) | def forward(self, x): class AttentionPool (line 156) | class AttentionPool(nn.Module): method __init__ (line 158) | def __init__(self, method forward (line 186) | def forward(self, x): class VisionTransformer (line 209) | class VisionTransformer(nn.Module): method __init__ (line 211) | def __init__(self, method forward (line 279) | def forward(self, x, interpolation=False, use_31_block=False): class XLMRobertaWithHead (line 303) | class XLMRobertaWithHead(XLMRoberta): method __init__ (line 305) | def __init__(self, **kwargs): method forward (line 315) | def forward(self, ids): class XLMRobertaCLIP (line 328) | class XLMRobertaCLIP(nn.Module): method __init__ (line 330) | def __init__(self, method forward (line 406) | def forward(self, imgs, txt_ids): method param_groups (line 418) | def param_groups(self): function _clip (line 434) | def _clip(pretrained=False, function clip_xlm_roberta_vit_h_14 (line 471) | def clip_xlm_roberta_vit_h_14( class CLIPModel (line 501) | class CLIPModel: method __init__ (line 503) | def __init__(self, dtype, device, checkpoint_path, tokenizer_path): method visual (line 527) | def visual(self, videos): FILE: wan/modules/animate/face_blocks.py function attention (line 32) | def attention( class CausalConv1d (line 112) | class CausalConv1d(nn.Module): method __init__ (line 114) | def __init__(self, chan_in, chan_out, kernel_size=3, stride=1, dilatio... method forward (line 123) | def forward(self, x): class FaceEncoder (line 129) | class FaceEncoder(nn.Module): method __init__ (line 130) | def __init__(self, in_dim: int, hidden_dim: int, num_heads=int, dtype=... method forward (line 150) | def forward(self, x): class RMSNorm (line 180) | class RMSNorm(nn.Module): method __init__ (line 181) | def __init__( method _norm (line 207) | def _norm(self, x): method forward (line 220) | def forward(self, x): function get_norm_layer (line 237) | def get_norm_layer(norm_layer): class FaceAdapter (line 255) | class FaceAdapter(nn.Module): method __init__ (line 256) | def __init__( method forward (line 284) | def forward( class FaceBlock (line 297) | class FaceBlock(nn.Module): method __init__ (line 298) | def __init__( method forward (line 334) | def forward( FILE: wan/modules/animate/model_animate.py class HeadAnimate (line 39) | class HeadAnimate(Head): method forward (line 41) | def forward(self, x, e): class WanAnimateSelfAttention (line 54) | class WanAnimateSelfAttention(WanSelfAttention): method forward (line 56) | def forward(self, x, seq_lens, grid_sizes, freqs): class WanAnimateCrossAttention (line 88) | class WanAnimateCrossAttention(WanSelfAttention): method __init__ (line 89) | def __init__( method forward (line 112) | def forward(self, x, context, context_lens): class WanAnimateAttentionBlock (line 149) | class WanAnimateAttentionBlock(nn.Module): method __init__ (line 150) | def __init__(self, method forward (line 188) | def forward( class MLPProj (line 230) | class MLPProj(torch.nn.Module): method __init__ (line 231) | def __init__(self, in_dim, out_dim): method forward (line 242) | def forward(self, image_embeds): class WanAnimateModel (line 246) | class WanAnimateModel(ModelMixin, ConfigMixin, PeftAdapterMixin): method __init__ (line 250) | def __init__(self, method after_patch_embedding (line 340) | def after_patch_embedding(self, x: List[torch.Tensor], pose_latents, f... method after_transformer_block (line 364) | def after_transformer_block(self, block_idx, x, motion_vec, motion_mas... method forward (line 372) | def forward( method unpatchify (line 453) | def unpatchify(self, x, grid_sizes): method init_weights (line 478) | def init_weights(self): FILE: wan/modules/animate/motion_encoder.py function custom_qr (line 8) | def custom_qr(input_tensor): function fused_leaky_relu (line 15) | def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): function upfirdn2d_native (line 19) | def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0, ... function upfirdn2d (line 39) | def upfirdn2d(input, kernel, up=1, down=1, pad=(0, 0)): function make_kernel (line 43) | def make_kernel(k): class FusedLeakyReLU (line 51) | class FusedLeakyReLU(nn.Module): method __init__ (line 52) | def __init__(self, channel, negative_slope=0.2, scale=2 ** 0.5): method forward (line 58) | def forward(self, input): class Blur (line 63) | class Blur(nn.Module): method __init__ (line 64) | def __init__(self, kernel, pad, upsample_factor=1): method forward (line 76) | def forward(self, input): class ScaledLeakyReLU (line 80) | class ScaledLeakyReLU(nn.Module): method __init__ (line 81) | def __init__(self, negative_slope=0.2): method forward (line 86) | def forward(self, input): class EqualConv2d (line 90) | class EqualConv2d(nn.Module): method __init__ (line 91) | def __init__(self, in_channel, out_channel, kernel_size, stride=1, pad... method forward (line 105) | def forward(self, input): method __repr__ (line 109) | def __repr__(self): class EqualLinear (line 116) | class EqualLinear(nn.Module): method __init__ (line 117) | def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1, ... method forward (line 132) | def forward(self, input): method __repr__ (line 142) | def __repr__(self): class ConvLayer (line 146) | class ConvLayer(nn.Sequential): method __init__ (line 147) | def __init__( class ResBlock (line 186) | class ResBlock(nn.Module): method __init__ (line 187) | def __init__(self, in_channel, out_channel, blur_kernel=[1, 3, 3, 1]): method forward (line 195) | def forward(self, input): class EncoderApp (line 205) | class EncoderApp(nn.Module): method __init__ (line 206) | def __init__(self, size, w_dim=512): method forward (line 235) | def forward(self, x): class Encoder (line 246) | class Encoder(nn.Module): method __init__ (line 247) | def __init__(self, size, dim=512, dim_motion=20): method enc_app (line 261) | def enc_app(self, x): method enc_motion (line 265) | def enc_motion(self, x): class Direction (line 271) | class Direction(nn.Module): method __init__ (line 272) | def __init__(self, motion_dim): method forward (line 276) | def forward(self, input): class Synthesis (line 289) | class Synthesis(nn.Module): method __init__ (line 290) | def __init__(self, motion_dim): class Generator (line 295) | class Generator(nn.Module): method __init__ (line 296) | def __init__(self, size, style_dim=512, motion_dim=20): method get_motion (line 302) | def get_motion(self, img): FILE: wan/modules/animate/preprocess/human_visualization.py function draw_handpose (line 14) | def draw_handpose(canvas, keypoints, hand_score_th=0.6): function draw_handpose_new (line 93) | def draw_handpose_new(canvas, keypoints, stickwidth_type='v2', hand_scor... function draw_ellipse_by_2kp (line 175) | def draw_ellipse_by_2kp(img, keypoint1, keypoint2, color, threshold=0.6): function split_pose2d_kps_to_aa (line 193) | def split_pose2d_kps_to_aa(kp2ds: np.ndarray) -> List[np.ndarray]: function draw_aapose_by_meta (line 211) | def draw_aapose_by_meta(img, meta: AAPoseMeta, threshold=0.5, stick_widt... function draw_aapose_by_meta_new (line 218) | def draw_aapose_by_meta_new(img, meta: AAPoseMeta, threshold=0.5, stickw... function draw_hand_by_meta (line 226) | def draw_hand_by_meta(img, meta: AAPoseMeta, threshold=0.5, stick_width_... function draw_aaface_by_meta (line 234) | def draw_aaface_by_meta(img, meta: AAPoseMeta, threshold=0.5, stick_widt... function draw_aanose_by_meta (line 242) | def draw_aanose_by_meta(img, meta: AAPoseMeta, threshold=0.5, stick_widt... function gen_face_motion_seq (line 250) | def gen_face_motion_seq(img, metas: List[AAPoseMeta], threshold=0.5, sti... function draw_M (line 255) | def draw_M( function draw_nose (line 422) | def draw_nose( function draw_aapose (line 586) | def draw_aapose( function draw_aapose_new (line 750) | def draw_aapose_new( function draw_bbox (line 921) | def draw_bbox(img, bbox, color=(255, 0, 0)): function draw_kp2ds (line 928) | def draw_kp2ds(img, kp2ds, threshold=0, color=(255, 0, 0), skeleton=None... function draw_mask (line 1022) | def draw_mask(img, mask, background=0, return_rgba=False): function draw_pcd (line 1032) | def draw_pcd(pcd_list, save_path=None): function load_image (line 1051) | def load_image(img, reverse=False): function draw_skeleten (line 1061) | def draw_skeleten(meta): function draw_skeleten_with_pncc (line 1085) | def draw_skeleten_with_pncc(pncc: np.ndarray, meta: Dict) -> np.ndarray: function draw_face_kp (line 1147) | def draw_face_kp(img, kps, thickness=2, style=FACE_CUSTOM_STYLE): function draw_traj (line 1168) | def draw_traj(metas: List[AAPoseMeta], threshold=0.6): FILE: wan/modules/animate/preprocess/pose2d.py class SimpleOnnxInference (line 20) | class SimpleOnnxInference(object): method __init__ (line 21) | def __init__(self, checkpoint, device='cuda', reverse_input=False, **k... method __call__ (line 45) | def __call__(self, *args, **kwargs): method get_output_names (line 49) | def get_output_names(self): method set_device (line 56) | def set_device(self, device): class Yolo (line 68) | class Yolo(SimpleOnnxInference): method __init__ (line 69) | def __init__(self, checkpoint, device='cuda', threshold_conf=0.05, thr... method preprocess (line 89) | def preprocess(self, input_image): method postprocess (line 112) | def postprocess(self, output, shape_raw, cat_id=[1]): method process_results (line 207) | def process_results(self, results, shape_raw, cat_id=[1], single_perso... method postprocess_threading (line 283) | def postprocess_threading(self, outputs, shape_raw, person_results, i,... method forward (line 290) | def forward(self, img, shape_raw, **kwargs): class ViTPose (line 309) | class ViTPose(SimpleOnnxInference): method __init__ (line 310) | def __init__(self, checkpoint, device='cuda', **kwargs): method forward (line 313) | def forward(self, img, center, scale, **kwargs): method preprocess (line 324) | def preprocess(img, bbox=None, input_resolution=(256, 192), rescale=1.... class Pose2d (line 346) | class Pose2d: method __init__ (line 347) | def __init__(self, checkpoint, detector_checkpoint=None, device='cuda'... method load_images (line 357) | def load_images(self, inputs): method __call__ (line 396) | def __call__( FILE: wan/modules/animate/preprocess/pose2d_utils.py function box_convert_simple (line 9) | def box_convert_simple(box, convert_type='xyxy2xywh'): function read_img (line 19) | def read_img(image, convert='RGB', check_exist=False): class AAPoseMeta (line 39) | class AAPoseMeta: method __init__ (line 40) | def __init__(self, meta=None, kp2ds=None): method is_valid (line 60) | def is_valid(self, kp, p, threshold): method get_bbox (line 67) | def get_bbox(self, kp, kp_p, threshold=0.5): method crop (line 75) | def crop(self, x0, y0, x1, y1): method resize (line 85) | def resize(self, width, height): method get_kps_body_with_p (line 98) | def get_kps_body_with_p(self, normalize=False): method from_kps_face (line 106) | def from_kps_face(kps_face: np.ndarray, height: int, width: int): method from_kps_body (line 119) | def from_kps_body(kps_body: np.ndarray, height: int, width: int): method from_humanapi_meta (line 128) | def from_humanapi_meta(meta): method load_from_meta (line 144) | def load_from_meta(self, meta, norm_body=True, norm_hand=False): method load_from_kp2ds (line 170) | def load_from_kp2ds(kp2ds: List[np.ndarray], width: int, height: int): method from_dwpose (line 199) | def from_dwpose(dwpose_det_res, height, width): method save_json (line 219) | def save_json(self): method draw_aapose (line 222) | def draw_aapose(self, img, threshold=0.5, stick_width_norm=200, draw_h... method translate (line 227) | def translate(self, x0, y0): method scale (line 234) | def scale(self, sx, sy): method padding_resize2 (line 241) | def padding_resize2(self, height=512, width=512): function transform_preds (line 279) | def transform_preds(coords, center, scale, output_size, use_udp=False): function _calc_distances (line 326) | def _calc_distances(preds, targets, mask, normalize): function _distance_acc (line 358) | def _distance_acc(distances, thr=0.5): function _get_max_preds (line 379) | def _get_max_preds(heatmaps): function _get_max_preds_3d (line 414) | def _get_max_preds_3d(heatmaps): function pose_pck_accuracy (line 452) | def pose_pck_accuracy(output, target, mask, thr=0.05, normalize=None): function keypoint_pck_accuracy (line 495) | def keypoint_pck_accuracy(pred, gt, mask, thr, normalize): function keypoint_auc (line 534) | def keypoint_auc(pred, gt, mask, normalize, num_step=20): function keypoint_nme (line 566) | def keypoint_nme(pred, gt, mask, normalize_factor): function keypoint_epe (line 589) | def keypoint_epe(pred, gt, mask): function _taylor (line 614) | def _taylor(heatmap, coord): function post_dark_udp (line 651) | def post_dark_udp(coords, batch_heatmaps, kernel=3): function _gaussian_blur (line 715) | def _gaussian_blur(heatmaps, kernel=11): function keypoints_from_regression (line 757) | def keypoints_from_regression(regression_preds, center, scale, img_size): function keypoints_from_heatmaps (line 790) | def keypoints_from_heatmaps(heatmaps, function keypoints_from_heatmaps3d (line 941) | def keypoints_from_heatmaps3d(heatmaps, center, scale): function multilabel_classification_accuracy (line 974) | def multilabel_classification_accuracy(pred, gt, mask, thr=0.5): function get_transform (line 1004) | def get_transform(center, scale, res, rot=0): function transform (line 1034) | def transform(pt, center, scale, res, invert=0, rot=0): function bbox_from_detector (line 1044) | def bbox_from_detector(bbox, input_resolution=(224, 224), rescale=1.25): function crop (line 1069) | def crop(img, center, scale, res): function split_kp2ds_for_aa (line 1102) | def split_kp2ds_for_aa(kp2ds, ret_face=False): function load_pose_metas_from_kp2ds_seq_list (line 1111) | def load_pose_metas_from_kp2ds_seq_list(kp2ds_seq, width, height): function load_pose_metas_from_kp2ds_seq (line 1137) | def load_pose_metas_from_kp2ds_seq(kp2ds_seq, width, height): FILE: wan/modules/animate/preprocess/preprocess_data.py function _parse_args (line 7) | def _parse_args(): FILE: wan/modules/animate/preprocess/process_pipepline.py class ProcessPipeline (line 28) | class ProcessPipeline(): method __init__ (line 29) | def __init__(self, det_checkpoint_path, pose2d_checkpoint_path, sam_ch... method __call__ (line 38) | def __call__(self, video_path, refer_image_path, output_path, resoluti... method get_editing_prompts (line 237) | def get_editing_prompts(self, tpl_pose_metas, refer_pose_meta): method get_mask (line 280) | def get_mask(self, frames, th_step, kp2ds_all): method convert_list_to_array (line 345) | def convert_list_to_array(self, metas): FILE: wan/modules/animate/preprocess/retarget_pose.py class Keypoint (line 51) | class Keypoint(NamedTuple): function get_length (line 60) | def get_length(skeleton, limb): function get_handpose_meta (line 80) | def get_handpose_meta(keypoints, delta, src_H, src_W): function deal_hand_keypoints (line 106) | def deal_hand_keypoints(hand_res, r_ratio, l_ratio, hand_score_th = 0.5): function get_scaled_pose (line 159) | def get_scaled_pose(canvas, src_canvas, keypoints, keypoints_hand, bone_... function rescale_skeleton (line 309) | def rescale_skeleton(H, W, keypoints, bone_ratio_list): function fix_lack_keypoints_use_sym (line 369) | def fix_lack_keypoints_use_sym(skeleton): function rescale_shorten_skeleton (line 450) | def rescale_shorten_skeleton(ratio_list, src_length_list, dst_length_list): function check_full_body (line 481) | def check_full_body(keypoints, threshold = 0.4): function check_full_body_both (line 501) | def check_full_body_both(flag1, flag2): function write_to_poses (line 520) | def write_to_poses(data_to_json, none_idx, dst_shape, bone_ratio_list, d... function calculate_scale_ratio (line 551) | def calculate_scale_ratio(skeleton, skeleton_edit, scale_ratio_flag): function retarget_pose (line 571) | def retarget_pose(src_skeleton, dst_skeleton, all_src_skeleton, src_skel... function get_retarget_pose (line 760) | def get_retarget_pose(tpl_pose_meta0, refer_pose_meta, tpl_pose_metas, t... FILE: wan/modules/animate/preprocess/sam_utils.py function _load_img_v2_as_tensor (line 23) | def _load_img_v2_as_tensor(img, image_size): function load_video_frames (line 34) | def load_video_frames( function load_video_frames_v2 (line 89) | def load_video_frames_v2( function build_sam2_video_predictor (line 122) | def build_sam2_video_predictor( FILE: wan/modules/animate/preprocess/utils.py function get_mask_boxes (line 8) | def get_mask_boxes(mask): function get_aug_mask (line 25) | def get_aug_mask(body_mask, w_len=10, h_len=20): function get_mask_body_img (line 44) | def get_mask_body_img(img_copy, hand_mask, k=7, iterations=1): function get_face_bboxes (line 52) | def get_face_bboxes(kp2ds, scale, image_shape, ratio_aug): function calculate_new_size (line 87) | def calculate_new_size(orig_w, orig_h, target_area, divisor=64): function resize_by_area (line 136) | def resize_by_area(image, target_area, keep_aspect_ratio=True, divisor=6... function padding_resize (line 158) | def padding_resize(img_ori, height=512, width=512, padding_color=(0, 0, ... function get_frame_indices (line 191) | def get_frame_indices(frame_num, video_fps, clip_length, train_fps): function get_face_bboxes (line 201) | def get_face_bboxes(kp2ds, scale, image_shape): FILE: wan/modules/animate/preprocess/video_predictor.py class SAM2VideoPredictor (line 14) | class SAM2VideoPredictor(_SAM2VideoPredictor): method __init__ (line 15) | def __init__(self, *args, **kwargs): method init_state (line 20) | def init_state( method init_state_v2 (line 90) | def init_state_v2( FILE: wan/modules/animate/xlm_roberta.py class SelfAttention (line 10) | class SelfAttention(nn.Module): method __init__ (line 12) | def __init__(self, dim, num_heads, dropout=0.1, eps=1e-5): method forward (line 27) | def forward(self, x, mask): class AttentionBlock (line 49) | class AttentionBlock(nn.Module): method __init__ (line 51) | def __init__(self, dim, num_heads, post_norm, dropout=0.1, eps=1e-5): method forward (line 66) | def forward(self, x, mask): class XLMRoberta (line 76) | class XLMRoberta(nn.Module): method __init__ (line 81) | def __init__(self, method forward (line 118) | def forward(self, ids): function xlm_roberta_large (line 146) | def xlm_roberta_large(pretrained=False, FILE: wan/modules/attention.py function flash_attention (line 24) | def flash_attention( function attention (line 133) | def attention( FILE: wan/modules/model.py function sinusoidal_embedding_1d (line 14) | def sinusoidal_embedding_1d(dim, position): function rope_params (line 28) | def rope_params(max_seq_len, dim, theta=10000): function rope_apply (line 39) | def rope_apply(x, grid_sizes, freqs): class WanRMSNorm (line 69) | class WanRMSNorm(nn.Module): method __init__ (line 71) | def __init__(self, dim, eps=1e-5): method forward (line 77) | def forward(self, x): method _norm (line 84) | def _norm(self, x): class WanLayerNorm (line 88) | class WanLayerNorm(nn.LayerNorm): method __init__ (line 90) | def __init__(self, dim, eps=1e-6, elementwise_affine=False): method forward (line 93) | def forward(self, x): class WanSelfAttention (line 101) | class WanSelfAttention(nn.Module): method __init__ (line 103) | def __init__(self, method forward (line 126) | def forward(self, x, seq_lens, grid_sizes, freqs): class WanCrossAttention (line 158) | class WanCrossAttention(WanSelfAttention): method forward (line 160) | def forward(self, x, context, context_lens): class WanAttentionBlock (line 183) | class WanAttentionBlock(nn.Module): method __init__ (line 185) | def __init__(self, method forward (line 219) | def forward( class Head (line 262) | class Head(nn.Module): method __init__ (line 264) | def __init__(self, dim, out_dim, patch_size, eps=1e-6): method forward (line 279) | def forward(self, x, e): class WanModel (line 294) | class WanModel(ModelMixin, ConfigMixin): method __init__ (line 305) | def __init__(self, method forward (line 410) | def forward( method unpatchify (line 499) | def unpatchify(self, x, grid_sizes): method init_weights (line 524) | def init_weights(self): FILE: wan/modules/s2v/audio_encoder.py function get_sample_indices (line 11) | def get_sample_indices(original_fps, function linear_interpolation (line 38) | def linear_interpolation(features, input_fps, output_fps, output_len=None): class AudioEncoder (line 55) | class AudioEncoder(): method __init__ (line 57) | def __init__(self, device='cpu', model_id="facebook/wav2vec2-base-960h"): method extract_audio_feat (line 66) | def extract_audio_feat(self, method get_audio_embed_bucket (line 91) | def get_audio_embed_bucket(self, method get_audio_embed_bucket_fps (line 136) | def get_audio_embed_bucket_fps(self, FILE: wan/modules/s2v/audio_utils.py class CausalAudioEncoder (line 14) | class CausalAudioEncoder(nn.Module): method __init__ (line 16) | def __init__(self, method forward (line 34) | def forward(self, features): class AudioCrossAttention (line 47) | class AudioCrossAttention(WanCrossAttention): method __init__ (line 49) | def __init__(self, *args, **kwargs): class AudioInjector_WAN (line 53) | class AudioInjector_WAN(nn.Module): method __init__ (line 55) | def __init__(self, FILE: wan/modules/s2v/auxi_blocks.py function attention (line 35) | def attention( class CausalConv1d (line 121) | class CausalConv1d(nn.Module): method __init__ (line 123) | def __init__(self, method forward (line 145) | def forward(self, x): class MotionEncoder_tc (line 150) | class MotionEncoder_tc(nn.Module): method __init__ (line 152) | def __init__(self, method forward (line 199) | def forward(self, x): FILE: wan/modules/s2v/model_s2v.py function zero_module (line 35) | def zero_module(module): function torch_dfs (line 44) | def torch_dfs(model: nn.Module, parent_name='root'): function rope_apply (line 62) | def rope_apply(x, grid_sizes, freqs, start=None): function rope_apply_usp (line 80) | def rope_apply_usp(x, grid_sizes, freqs): function sp_attn_forward_s2v (line 98) | def sp_attn_forward_s2v(self, class Head_S2V (line 135) | class Head_S2V(Head): method forward (line 137) | def forward(self, x, e): class WanS2VSelfAttention (line 150) | class WanS2VSelfAttention(WanSelfAttention): method forward (line 152) | def forward(self, x, seq_lens, grid_sizes, freqs): class WanS2VAttentionBlock (line 184) | class WanS2VAttentionBlock(WanAttentionBlock): method __init__ (line 186) | def __init__(self, method forward (line 199) | def forward(self, x, e, seq_lens, grid_sizes, freqs, context, context_... class WanModel_S2V (line 247) | class WanModel_S2V(ModelMixin, ConfigMixin): method __init__ (line 255) | def __init__( method zero_init_weights (line 441) | def zero_init_weights(self): method process_motion (line 455) | def process_motion(self, motion_latents, drop_motion_frames=False): method process_motion_frame_pack (line 484) | def process_motion_frame_pack(self, method process_motion_transformer_motioner (line 496) | def process_motion_transformer_motioner(self, method inject_motion (line 561) | def inject_motion(self, method after_transformer_block (line 601) | def after_transformer_block(self, block_idx, hidden_states): method forward (line 650) | def forward( method unpatchify (line 859) | def unpatchify(self, x, grid_sizes): method init_weights (line 884) | def init_weights(self): FILE: wan/modules/s2v/motioner.py function sinusoidal_embedding_1d (line 17) | def sinusoidal_embedding_1d(dim, position): function rope_params (line 31) | def rope_params(max_seq_len, dim, theta=10000): function rope_apply (line 42) | def rope_apply(x, grid_sizes, freqs, start=None): class RMSNorm (line 114) | class RMSNorm(nn.Module): method __init__ (line 116) | def __init__(self, dim, eps=1e-5): method forward (line 122) | def forward(self, x): method _norm (line 125) | def _norm(self, x): class LayerNorm (line 129) | class LayerNorm(nn.LayerNorm): method __init__ (line 131) | def __init__(self, dim, eps=1e-6, elementwise_affine=False): method forward (line 134) | def forward(self, x): class SelfAttention (line 138) | class SelfAttention(nn.Module): method __init__ (line 140) | def __init__(self, method forward (line 163) | def forward(self, x, seq_lens, grid_sizes, freqs): class SwinSelfAttention (line 188) | class SwinSelfAttention(SelfAttention): method forward (line 190) | def forward(self, x, seq_lens, grid_sizes, freqs): class CasualSelfAttention (line 246) | class CasualSelfAttention(SelfAttention): method forward (line 248) | def forward(self, x, seq_lens, grid_sizes, freqs): class MotionerAttentionBlock (line 328) | class MotionerAttentionBlock(nn.Module): method __init__ (line 330) | def __init__(self, method forward (line 365) | def forward( class Head (line 380) | class Head(nn.Module): method __init__ (line 382) | def __init__(self, dim, out_dim, patch_size, eps=1e-6): method forward (line 394) | def forward(self, x): class MotionerTransformers (line 399) | class MotionerTransformers(nn.Module, PeftAdapterMixin): method __init__ (line 401) | def __init__( method after_patch_embedding (line 492) | def after_patch_embedding(self, x): method forward (line 495) | def forward( method unpatchify (line 621) | def unpatchify(self, x, grid_sizes): method init_weights (line 631) | def init_weights(self): class FramePackMotioner (line 643) | class FramePackMotioner(nn.Module): method __init__ (line 645) | def __init__( method forward (line 679) | def forward(self, motion_latents, add_last_motion=2): function sample_indices (line 765) | def sample_indices(N, stride, expand_ratio, c): FILE: wan/modules/s2v/s2v_utils.py function rope_precompute (line 6) | def rope_precompute(x, grid_sizes, freqs, start=None): FILE: wan/modules/t5.py function fp16_clamp (line 20) | def fp16_clamp(x): function init_weights (line 27) | def init_weights(m): class GELU (line 46) | class GELU(nn.Module): method forward (line 48) | def forward(self, x): class T5LayerNorm (line 53) | class T5LayerNorm(nn.Module): method __init__ (line 55) | def __init__(self, dim, eps=1e-6): method forward (line 61) | def forward(self, x): class T5Attention (line 69) | class T5Attention(nn.Module): method __init__ (line 71) | def __init__(self, dim, dim_attn, num_heads, dropout=0.1): method forward (line 86) | def forward(self, x, context=None, mask=None, pos_bias=None): class T5FeedForward (line 123) | class T5FeedForward(nn.Module): method __init__ (line 125) | def __init__(self, dim, dim_ffn, dropout=0.1): method forward (line 136) | def forward(self, x): class T5SelfAttention (line 144) | class T5SelfAttention(nn.Module): method __init__ (line 146) | def __init__(self, method forward (line 170) | def forward(self, x, mask=None, pos_bias=None): class T5CrossAttention (line 178) | class T5CrossAttention(nn.Module): method __init__ (line 180) | def __init__(self, method forward (line 206) | def forward(self, class T5RelativeEmbedding (line 221) | class T5RelativeEmbedding(nn.Module): method __init__ (line 223) | def __init__(self, num_buckets, num_heads, bidirectional, max_dist=128): method forward (line 233) | def forward(self, lq, lk): method _relative_position_bucket (line 245) | def _relative_position_bucket(self, rel_pos): class T5Encoder (line 267) | class T5Encoder(nn.Module): method __init__ (line 269) | def __init__(self, method forward (line 303) | def forward(self, ids, mask=None): class T5Decoder (line 315) | class T5Decoder(nn.Module): method __init__ (line 317) | def __init__(self, method forward (line 351) | def forward(self, ids, mask=None, encoder_states=None, encoder_mask=No... class T5Model (line 372) | class T5Model(nn.Module): method __init__ (line 374) | def __init__(self, method forward (line 408) | def forward(self, encoder_ids, encoder_mask, decoder_ids, decoder_mask): function _t5 (line 415) | def _t5(name, function umt5_xxl (line 456) | def umt5_xxl(**kwargs): class T5EncoderModel (line 472) | class T5EncoderModel: method __init__ (line 474) | def __init__( method __call__ (line 506) | def __call__(self, texts, device): FILE: wan/modules/tokenizers.py function basic_clean (line 12) | def basic_clean(text): function whitespace_clean (line 18) | def whitespace_clean(text): function canonicalize (line 24) | def canonicalize(text, keep_punctuation_exact_string=None): class HuggingfaceTokenizer (line 37) | class HuggingfaceTokenizer: method __init__ (line 39) | def __init__(self, name, seq_len=None, clean=None, **kwargs): method __call__ (line 49) | def __call__(self, sequence, **kwargs): method _clean (line 75) | def _clean(self, text): FILE: wan/modules/vae2_1.py class CausalConv3d (line 17) | class CausalConv3d(nn.Conv3d): method __init__ (line 22) | def __init__(self, *args, **kwargs): method forward (line 28) | def forward(self, x, cache_x=None): class RMS_norm (line 39) | class RMS_norm(nn.Module): method __init__ (line 41) | def __init__(self, dim, channel_first=True, images=True, bias=False): method forward (line 51) | def forward(self, x): class Upsample (line 57) | class Upsample(nn.Upsample): method forward (line 59) | def forward(self, x): class Resample (line 66) | class Resample(nn.Module): method __init__ (line 68) | def __init__(self, dim, mode): method forward (line 101) | def forward(self, x, feat_cache=None, feat_idx=[0]): method init_weight (line 162) | def init_weight(self, conv): method init_weight2 (line 174) | def init_weight2(self, conv): class ResidualBlock (line 186) | class ResidualBlock(nn.Module): method __init__ (line 188) | def __init__(self, in_dim, out_dim, dropout=0.0): method forward (line 202) | def forward(self, x, feat_cache=None, feat_idx=[0]): class AttentionBlock (line 223) | class AttentionBlock(nn.Module): method __init__ (line 228) | def __init__(self, dim): method forward (line 240) | def forward(self, x): class Encoder3d (line 265) | class Encoder3d(nn.Module): method __init__ (line 267) | def __init__(self, method forward (line 318) | def forward(self, x, feat_cache=None, feat_idx=[0]): class Decoder3d (line 369) | class Decoder3d(nn.Module): method __init__ (line 371) | def __init__(self, method forward (line 423) | def forward(self, x, feat_cache=None, feat_idx=[0]): function count_conv3d (line 475) | def count_conv3d(model): class WanVAE_ (line 483) | class WanVAE_(nn.Module): method __init__ (line 485) | def __init__(self, method forward (line 510) | def forward(self, x): method encode (line 516) | def encode(self, x, scale): method decode (line 544) | def decode(self, z, scale): method reparameterize (line 570) | def reparameterize(self, mu, log_var): method sample (line 575) | def sample(self, imgs, deterministic=False): method clear_cache (line 582) | def clear_cache(self): function _video_vae (line 592) | def _video_vae(pretrained_path=None, z_dim=None, device='cpu', **kwargs): class Wan2_1_VAE (line 619) | class Wan2_1_VAE: method __init__ (line 621) | def __init__(self, method encode (line 647) | def encode(self, videos): method decode (line 657) | def decode(self, zs): FILE: wan/modules/vae2_2.py class CausalConv3d (line 17) | class CausalConv3d(nn.Conv3d): method __init__ (line 22) | def __init__(self, *args, **kwargs): method forward (line 34) | def forward(self, x, cache_x=None): class RMS_norm (line 45) | class RMS_norm(nn.Module): method __init__ (line 47) | def __init__(self, dim, channel_first=True, images=True, bias=False): method forward (line 57) | def forward(self, x): class Upsample (line 62) | class Upsample(nn.Upsample): method forward (line 64) | def forward(self, x): class Resample (line 71) | class Resample(nn.Module): method __init__ (line 73) | def __init__(self, dim, mode): method forward (line 112) | def forward(self, x, feat_cache=None, feat_idx=[0]): method init_weight (line 171) | def init_weight(self, conv): method init_weight2 (line 182) | def init_weight2(self, conv): class ResidualBlock (line 193) | class ResidualBlock(nn.Module): method __init__ (line 195) | def __init__(self, in_dim, out_dim, dropout=0.0): method forward (line 214) | def forward(self, x, feat_cache=None, feat_idx=[0]): class AttentionBlock (line 238) | class AttentionBlock(nn.Module): method __init__ (line 243) | def __init__(self, dim): method forward (line 255) | def forward(self, x): function patchify (line 280) | def patchify(x, patch_size): function unpatchify (line 299) | def unpatchify(x, patch_size): class AvgDown3D (line 316) | class AvgDown3D(nn.Module): method __init__ (line 318) | def __init__( method forward (line 335) | def forward(self, x: torch.Tensor) -> torch.Tensor: class DupUp3D (line 370) | class DupUp3D(nn.Module): method __init__ (line 372) | def __init__( method forward (line 390) | def forward(self, x: torch.Tensor, first_chunk=False) -> torch.Tensor: class Down_ResidualBlock (line 415) | class Down_ResidualBlock(nn.Module): method __init__ (line 417) | def __init__(self, method forward (line 447) | def forward(self, x, feat_cache=None, feat_idx=[0]): class Up_ResidualBlock (line 455) | class Up_ResidualBlock(nn.Module): method __init__ (line 457) | def __init__(self, method forward (line 489) | def forward(self, x, feat_cache=None, feat_idx=[0], first_chunk=False): class Encoder3d (line 500) | class Encoder3d(nn.Module): method __init__ (line 502) | def __init__( method forward (line 559) | def forward(self, x, feat_cache=None, feat_idx=[0]): class Decoder3d (line 616) | class Decoder3d(nn.Module): method __init__ (line 618) | def __init__( method forward (line 672) | def forward(self, x, feat_cache=None, feat_idx=[0], first_chunk=False): function count_conv3d (line 726) | def count_conv3d(model): class WanVAE_ (line 734) | class WanVAE_(nn.Module): method __init__ (line 736) | def __init__( method forward (line 778) | def forward(self, x, scale=[0, 1]): method encode (line 783) | def encode(self, x, scale): method decode (line 812) | def decode(self, z, scale): method reparameterize (line 841) | def reparameterize(self, mu, log_var): method sample (line 846) | def sample(self, imgs, deterministic=False): method clear_cache (line 853) | def clear_cache(self): function _video_vae (line 863) | def _video_vae(pretrained_path=None, z_dim=16, dim=160, device="cpu", **... class Wan2_2_VAE (line 888) | class Wan2_2_VAE: method __init__ (line 890) | def __init__( method encode (line 1024) | def encode(self, videos): method decode (line 1038) | def decode(self, zs): FILE: wan/speech2video.py function load_safetensors (line 39) | def load_safetensors(path): class WanS2V (line 47) | class WanS2V: method __init__ (line 49) | def __init__( method _configure_model (line 146) | def _configure_model(self, model, use_sp, dit_fsdp, shard_fn, method get_size_less_than_area (line 189) | def get_size_less_than_area(self, method prepare_default_cond_input (line 252) | def prepare_default_cond_input(self, method encode_audio (line 283) | def encode_audio(self, audio_path, infer_frames): method read_last_n_frames (line 297) | def read_last_n_frames(self, method load_pose_cond (line 336) | def load_pose_cond(self, pose_video, num_repeat, infer_frames, size): method get_gen_size (line 378) | def get_gen_size(self, size, max_area, ref_image_path, pre_video_path): method generate (line 392) | def generate( method tts (line 681) | def tts(self, tts_prompt_audio, tts_prompt_text, tts_text): method load_tts (line 697) | def load_tts(self): FILE: wan/text2video.py class WanT2V (line 31) | class WanT2V: method __init__ (line 33) | def __init__( method _configure_model (line 125) | def _configure_model(self, model, use_sp, dit_fsdp, shard_fn, method _prepare_model_for_timestep (line 169) | def _prepare_model_for_timestep(self, t, boundary, offload_model): method generate (line 203) | def generate(self, FILE: wan/textimage2video.py class WanTI2V (line 34) | class WanTI2V: method __init__ (line 36) | def __init__( method _configure_model (line 118) | def _configure_model(self, model, use_sp, dit_fsdp, shard_fn, method generate (line 162) | def generate(self, method t2v (line 239) | def t2v(self, method i2v (line 413) | def i2v(self, FILE: wan/utils/fm_solvers.py function get_sampling_sigmas (line 24) | def get_sampling_sigmas(sampling_steps, shift): function retrieve_timesteps (line 31) | def retrieve_timesteps( class FlowDPMSolverMultistepScheduler (line 71) | class FlowDPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin): method __init__ (line 131) | def __init__( method step_index (line 204) | def step_index(self): method begin_index (line 211) | def begin_index(self): method set_begin_index (line 218) | def set_begin_index(self, begin_index: int = 0): method set_timesteps (line 228) | def set_timesteps( method _threshold_sample (line 294) | def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor: method _sigma_to_t (line 332) | def _sigma_to_t(self, sigma): method _sigma_to_alpha_sigma_t (line 335) | def _sigma_to_alpha_sigma_t(self, sigma): method time_shift (line 339) | def time_shift(self, mu: float, sigma: float, t: torch.Tensor): method convert_model_output (line 343) | def convert_model_output( method dpm_solver_first_order_update (line 417) | def dpm_solver_first_order_update( method multistep_dpm_solver_second_order_update (line 488) | def multistep_dpm_solver_second_order_update( method multistep_dpm_solver_third_order_update (line 598) | def multistep_dpm_solver_third_order_update( method index_for_timestep (line 681) | def index_for_timestep(self, timestep, schedule_timesteps=None): method _init_step_index (line 695) | def _init_step_index(self, timestep): method step (line 708) | def step( method scale_model_input (line 802) | def scale_model_input(self, sample: torch.Tensor, *args, method add_noise (line 817) | def add_noise( method __len__ (line 858) | def __len__(self): FILE: wan/utils/fm_solvers_unipc.py class FlowUniPCMultistepScheduler (line 22) | class FlowUniPCMultistepScheduler(SchedulerMixin, ConfigMixin): method __init__ (line 79) | def __init__( method step_index (line 137) | def step_index(self): method begin_index (line 144) | def begin_index(self): method set_begin_index (line 151) | def set_begin_index(self, begin_index: int = 0): method set_timesteps (line 162) | def set_timesteps( method _threshold_sample (line 232) | def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor: method _sigma_to_t (line 271) | def _sigma_to_t(self, sigma): method _sigma_to_alpha_sigma_t (line 274) | def _sigma_to_alpha_sigma_t(self, sigma): method time_shift (line 278) | def time_shift(self, mu: float, sigma: float, t: torch.Tensor): method convert_model_output (line 281) | def convert_model_output( method multistep_uni_p_bh_update (line 352) | def multistep_uni_p_bh_update( method multistep_uni_c_bh_update (line 488) | def multistep_uni_c_bh_update( method index_for_timestep (line 630) | def index_for_timestep(self, timestep, schedule_timesteps=None): method _init_step_index (line 645) | def _init_step_index(self, timestep): method step (line 657) | def step(self, method scale_model_input (line 743) | def scale_model_input(self, sample: torch.Tensor, *args, method add_noise (line 760) | def add_noise( method __len__ (line 801) | def __len__(self): FILE: wan/utils/prompt_extend.py class PromptOutput (line 53) | class PromptOutput(object): method add_custom_field (line 60) | def add_custom_field(self, key: str, value) -> None: class PromptExpander (line 64) | class PromptExpander: method __init__ (line 66) | def __init__(self, model_name, task, is_vl=False, device=0, **kwargs): method extend_with_img (line 72) | def extend_with_img(self, method extend (line 81) | def extend(self, prompt, system_prompt, seed=-1, *args, **kwargs): method decide_system_prompt (line 84) | def decide_system_prompt(self, tar_lang="zh", prompt=None): method __call__ (line 95) | def __call__(self, class DashScopePromptExpander (line 117) | class DashScopePromptExpander(PromptExpander): method __init__ (line 119) | def __init__(self, method extend (line 158) | def extend(self, prompt, system_prompt, seed=-1, *args, **kwargs): method extend_with_img (line 194) | def extend_with_img(self, class QwenPromptExpander (line 262) | class QwenPromptExpander(PromptExpander): method __init__ (line 271) | def __init__(self, method extend (line 337) | def extend(self, prompt, system_prompt, seed=-1, *args, **kwargs): method extend_with_img (line 368) | def extend_with_img(self, function test (line 441) | def test(method, FILE: wan/utils/qwen_vl_utils.py function round_by_factor (line 39) | def round_by_factor(number: int, factor: int) -> int: function ceil_by_factor (line 44) | def ceil_by_factor(number: int, factor: int) -> int: function floor_by_factor (line 49) | def floor_by_factor(number: int, factor: int) -> int: function smart_resize (line 54) | def smart_resize(height: int, function fetch_image (line 85) | def fetch_image(ele: dict[str, str | Image.Image], function smart_nframes (line 133) | def smart_nframes( function _read_video_torchvision (line 177) | def _read_video_torchvision(ele: dict,) -> torch.Tensor: function is_decord_available (line 215) | def is_decord_available() -> bool: function _read_video_decord (line 221) | def _read_video_decord(ele: dict,) -> torch.Tensor: function get_video_reader_backend (line 261) | def get_video_reader_backend() -> str: function fetch_video (line 274) | def fetch_video( function extract_vision_info (line 328) | def extract_vision_info( function process_vision_info (line 344) | def process_vision_info( FILE: wan/utils/utils.py function rand_name (line 17) | def rand_name(length=8, suffix=''): function merge_video_audio (line 26) | def merge_video_audio(video_path: str, audio_path: str): function save_video (line 90) | def save_video(tensor, function save_image (line 123) | def save_image(tensor, save_file, nrow=8, normalize=True, value_range=(-... function str2bool (line 145) | def str2bool(v): function masks_like (line 172) | def masks_like(tensor, zero=False, generator=None, p=0.2): function best_output_size (line 202) | def best_output_size(w, h, dw, dh, expected_area): function download_cosyvoice_repo (line 228) | def download_cosyvoice_repo(repo_path): function download_cosyvoice_model (line 236) | def download_cosyvoice_model(model_name, model_path):