MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / create_custom_forward

Method create_custom_forward

models/modeling_moss.py:529–534  ·  view source on GitHub ↗
(module)

Source from the content-addressed store, hash-verified

527 if self.gradient_checkpointing and self.training:
528
529 def create_custom_forward(module):
530 def custom_forward(*inputs):
531 # None for past_key_value
532 return module(*inputs, use_cache, output_attentions)
533
534 return custom_forward
535
536 outputs = torch.utils.checkpoint.checkpoint(
537 create_custom_forward(block),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected