MCPcopy
hub / github.com/FareedKhan-dev/train-llm-from-scratch / unwrap

Function unwrap

src/post_training/utils.py:94–96  ·  view source on GitHub ↗

Return the underlying module behind a DDP wrapper (or the model itself).

(model: nn.Module)

Source from the content-addressed store, hash-verified

92
93
94def unwrap(model: nn.Module) -> nn.Module:
95 """Return the underlying module behind a DDP wrapper (or the model itself)."""
96 return model.module if hasattr(model, "module") else model
97
98
99def make_frozen_copy(model: nn.Module, device: str | None = None) -> nn.Module:

Callers 8

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
make_frozen_copyFunction · 0.85
save_stage_ckptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected