From d418eba0946e49eb1fe8059bf99a82460b85160a Mon Sep 17 00:00:00 2001 From: jiaxingli <43110891+li126com@users.noreply.github.com> Date: Wed, 20 Dec 2023 16:43:27 +0800 Subject: [PATCH] fix(model): add ckpt_type constraint when loading ckpts (#542) * support hf llama * support hf llama * support hf llama * support hf llama * importerror * importerror * modeling * modeling * fix bug * add assert --- internlm/utils/model_checkpoint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internlm/utils/model_checkpoint.py b/internlm/utils/model_checkpoint.py index 234944c..9b64e3b 100644 --- a/internlm/utils/model_checkpoint.py +++ b/internlm/utils/model_checkpoint.py @@ -912,6 +912,11 @@ class CheckpointManager: and "ckpt_type" in self.load_ckpt_info ), "please set content in ckpt setting, eg: ckpt = dict(path='', content=['model'], ckpt_type='internlm')" + if self.load_ckpt_info["content"] != ("model",): + assert ( + self.load_ckpt_info["ckpt_type"] == "internlm" + ), "Only 'internlm' ckpt supports loading states other than 'model' !" + # replace load_ckpt self.load_ckpt_info["content"] = CheckpointLoadMask(self.load_ckpt_info["content"]) self.load_ckpt_info["ckpt_type"] = CheckpointLoadMethod.convert_load_type(self.load_ckpt_info["ckpt_type"])