MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / MultiTalkPipeline

Class MultiTalkPipeline

wan/multitalk.py:105–797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105class MultiTalkPipeline:
106
107 def __init__(
108 self,
109 config,
110 checkpoint_dir,
111 quant_dir=None,
112 device_id=0,
113 rank=0,
114 t5_fsdp=False,
115 dit_fsdp=False,
116 use_usp=False,
117 t5_cpu=False,
118 init_on_cpu=True,
119 num_timesteps=1000,
120 use_timestep_transform=True,
121 lora_dir=None,
122 lora_scales=None,
123 quant = None
124 ):
125 r"""
126 Initializes the image-to-video generation model components.
127
128 Args:
129 config (EasyDict):
130 Object containing model parameters initialized from config.py
131 checkpoint_dir (`str`):
132 Path to directory containing model checkpoints
133 device_id (`int`, *optional*, defaults to 0):
134 Id of target GPU device
135 rank (`int`, *optional*, defaults to 0):
136 Process rank for distributed training
137 t5_fsdp (`bool`, *optional*, defaults to False):
138 Enable FSDP sharding for T5 model
139 dit_fsdp (`bool`, *optional*, defaults to False):
140 Enable FSDP sharding for DiT model
141 use_usp (`bool`, *optional*, defaults to False):
142 Enable distribution strategy of USP.
143 t5_cpu (`bool`, *optional*, defaults to False):
144 Whether to place T5 model on CPU. Only works without t5_fsdp.
145 init_on_cpu (`bool`, *optional*, defaults to True):
146 Enable initializing Transformer Model on CPU. Only works without FSDP or USP.
147 quant (`str`, *optional*, defaults to None):
148 Quantization type, must be 'int8' or 'fp8'.
149 """
150 if quant is not None and quant not in ("int8", "fp8"):
151 raise ValueError("quant must be 'int8', 'fp8', or None(default fp32 model)")
152 self.device = torch.device(f"cuda:{device_id}")
153 self.config = config
154 self.rank = rank
155 self.use_usp = use_usp
156 self.t5_cpu = t5_cpu
157
158 self.num_train_timesteps = config.num_train_timesteps
159 self.param_dtype = config.param_dtype
160
161 shard_fn = partial(shard_model, device_id=device_id)
162 self.text_encoder = T5EncoderModel(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected