Skip to content
Snippets Groups Projects
Unverified Commit 46add351 authored by whcao's avatar whcao Committed by GitHub
Browse files

[Fis] Set `_is_init` to True when `pretrained` is True (#555)

* set _is_init to True when pretrained is True

* fix comments
parent 62456217
No related branches found
No related tags found
No related merge requests found
...@@ -80,4 +80,8 @@ def get_model(cfg_path: str, pretrained: bool = False, **kwargs): ...@@ -80,4 +80,8 @@ def get_model(cfg_path: str, pretrained: bool = False, **kwargs):
model = MODELS.build(cfg.model, default_args=kwargs) model = MODELS.build(cfg.model, default_args=kwargs)
if pretrained: if pretrained:
load_checkpoint(model, cfg.model_path) load_checkpoint(model, cfg.model_path)
# Hack to use pretrained weights.
# If we do not set _is_init here, Runner will call
# `model.init_weights()` to overwrite the pretrained model.
model._is_init = True
return model return model
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment