MCPcopy Index your code
hub / github.com/InternLM/InternLM / load_context

Function load_context

internlm/utils/model_checkpoint.py:236–241  ·  view source on GitHub ↗
(ckpt_path: str, train_dl, train_state: TrainState)

Source from the content-addressed store, hash-verified

234
235
236def load_context(ckpt_path: str, train_dl, train_state: TrainState):
237 context_stuffs = llm_load(os.path.join(ckpt_path, "context.pt"))
238 train_state.load_state_dict(context_stuffs, train_dl)
239 if gpc.is_rank_for_log():
240 logger.info(f"reload train_state:{train_state}")
241 torch.cuda.empty_cache()
242
243
244def load_scheduler(ckpt_path: str, lr_scheduler, optimizer, learning_rate, train_state: TrainState):

Callers 1

try_resume_trainingMethod · 0.85

Calls 3

llm_loadFunction · 0.90
is_rank_for_logMethod · 0.80
load_state_dictMethod · 0.45

Tested by

no test coverage detected