Remove grad ckpt from model impl

we apply grad ckpt in train node directly
This commit is contained in:
Kohaku-Blueleaf 2025-06-13 17:51:37 +08:00 committed by GitHub
parent 31c8cc9aa3
commit bbcc65e7e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -796,15 +796,12 @@ class GeneralDITTransformerBlock(nn.Module):
adaln_lora_B_3D: Optional[torch.Tensor] = None, adaln_lora_B_3D: Optional[torch.Tensor] = None,
) -> torch.Tensor: ) -> torch.Tensor:
for block in self.blocks: for block in self.blocks:
if self.training: x = block(
x = torch.utils.checkpoint.checkpoint(block, x, emb_B_D, crossattn_emb, crossattn_mask, rope_emb_L_1_1_D, adaln_lora_B_3D, use_reentrant=False) x,
else: emb_B_D,
x = block( crossattn_emb,
x, crossattn_mask,
emb_B_D, rope_emb_L_1_1_D=rope_emb_L_1_1_D,
crossattn_emb, adaln_lora_B_3D=adaln_lora_B_3D,
crossattn_mask, )
rope_emb_L_1_1_D=rope_emb_L_1_1_D,
adaln_lora_B_3D=adaln_lora_B_3D,
)
return x return x