MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / tiled_forward

Method tiled_forward

diffsynth/models/sd3_dit.py:339–349  ·  view source on GitHub ↗
(self, hidden_states, timestep, prompt_emb, pooled_prompt_emb, tile_size=128, tile_stride=64)

Source from the content-addressed store, hash-verified

337 self.proj_out = torch.nn.Linear(embed_dim, 64)
338
339 def tiled_forward(self, hidden_states, timestep, prompt_emb, pooled_prompt_emb, tile_size=128, tile_stride=64):
340 # Due to the global positional embedding, we cannot implement layer-wise tiled forward.
341 hidden_states = TileWorker().tiled_forward(
342 lambda x: self.forward(x, timestep, prompt_emb, pooled_prompt_emb),
343 hidden_states,
344 tile_size,
345 tile_stride,
346 tile_device=hidden_states.device,
347 tile_dtype=hidden_states.dtype
348 )
349 return hidden_states
350
351 def forward(self, hidden_states, timestep, prompt_emb, pooled_prompt_emb, tiled=False, tile_size=128, tile_stride=64, use_gradient_checkpointing=False):
352 if tiled:

Callers 7

forwardMethod · 0.95
lets_dance_fluxFunction · 0.45
forwardMethod · 0.45
decode_videoMethod · 0.45
encode_videoMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45

Calls 2

forwardMethod · 0.95
TileWorkerClass · 0.85

Tested by

no test coverage detected