MCPcopy Create free account
hub / github.com/Shakker-Labs/RepText / create_custom_forward

Method create_custom_forward

controlnet_flux.py:323–330  ·  view source on GitHub ↗
(module, return_dict=None)

Source from the content-addressed store, hash-verified

321 if self.training and self.gradient_checkpointing:
322
323 def create_custom_forward(module, return_dict=None):
324 def custom_forward(*inputs):
325 if return_dict is not None:
326 return module(*inputs, return_dict=return_dict)
327 else:
328 return module(*inputs)
329
330 return custom_forward
331
332 ckpt_kwargs: Dict[str, Any] = {"use_reentrant": False} if is_torch_version(">=", "1.11.0") else {}
333 encoder_hidden_states, hidden_states = torch.utils.checkpoint.checkpoint(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected