You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Hi! When I tried to initialize weights of the model from checkpoint using configs and excluding some parts of it I get an error that model_path is not defined
I looked a the code at https://github.com/NVIDIA/NeMo/blob/main/nemo/core/classes/modelPT.py and indeed there is an initialized variable ckpt_path, but model_path is initialized for init_from_nemo_model
Could you check if it was just accidental copy-paste and there should be ckpt_path instead of model_path
self.load_part_of_state_dict(
ckpt['state_dict'], include, exclude, f'nemo file with path **{model_path**}'
)
in this snippet of the code
if 'init_from_ptl_ckpt' in cfg and cfg.init_from_ptl_ckpt is not None:
with open_dict(cfg):
if isinstance(cfg.init_from_ptl_ckpt, str):
# Restore checkpoint
ckpt_path = cfg.pop('init_from_ptl_ckpt')
ckpt = torch.load(ckpt_path, map_location=map_location)
# Restore checkpoint into current model
self.load_state_dict(ckpt['state_dict'], strict=False)
logging.info(
f'Model checkpoint restored from pytorch lightning chackpoint with path : `{ckpt_path}`'
)
del ckpt
elif isinstance(cfg.init_from_ptl_ckpt, (DictConfig, dict)):
model_load_dict = cfg.init_from_ptl_ckpt
for model_load_cfg in model_load_dict.values():
ckpt_path = model_load_cfg.path
# Restore model
ckpt = torch.load(ckpt_path, map_location=map_location)
include = model_load_cfg.pop('include', [""])
exclude = model_load_cfg.pop('exclude', [])
self.load_part_of_state_dict(
ckpt['state_dict'], include, exclude, f'nemo file with path `{model_path}`'
)
The text was updated successfully, but these errors were encountered:
Describe the bug
![image](https://user-images.githubusercontent.com/53433879/186564873-4faebdc0-a4bc-4f65-b9d3-7e0024025780.png)
Hi! When I tried to initialize weights of the model from checkpoint using configs and excluding some parts of it I get an error that model_path is not defined
I looked a the code at https://github.com/NVIDIA/NeMo/blob/main/nemo/core/classes/modelPT.py and indeed there is an initialized variable ckpt_path, but model_path is initialized for init_from_nemo_model
Could you check if it was just accidental copy-paste and there should be ckpt_path instead of model_path
self.load_part_of_state_dict(
ckpt['state_dict'], include, exclude, f'nemo file with path
**{model_path**}
')
in this snippet of the code
The text was updated successfully, but these errors were encountered: