[Diffusion] MAGI-2: regional compile coverage (#7174)
Signed-off-by: cr-gao <gaochenrui@sjtu.edu.cn>
This commit is contained in:
7 files changed
+674
-81
No files matched your search
@@ -695,6 +695,24 @@ class Magi2Pipeline(
|
||||
|
||||
return self.video_decoder.module
|
||||
|
||||
def setup_compile(self) -> None:
|
||||
"""Compile the transformer regions; the attention and MoE kernels stay eager."""
|
||||
|
||||
granularity = self.od_config.diffusion_compile_granularity
|
||||
if granularity != "regional":
|
||||
logger.warning(
|
||||
"MAGI-2 compiles the transformer regions itself; diffusion_compile_granularity=%r is ignored.",
|
||||
granularity,
|
||||
)
|
||||
|
||||
# The mHC connections chain bf16 ops that eager rounds after every op.
|
||||
# Emulating those casts keeps the compiled rounding boundaries equal.
|
||||
self.transformer.compile_regions(
|
||||
fullgraph=True,
|
||||
dynamic=self.od_config.diffusion_compile_dynamic,
|
||||
options={"emulate_precision_casts": True},
|
||||
)
|
||||
|
||||
def load_weights(
|
||||
self,
|
||||
weights: Iterable[tuple[str, torch.Tensor]],
|
||||
|
||||
Reference in new issue
Block a user