File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -558,19 +558,18 @@ def _parse_ckpt_path(self) -> None:
558
558
if not self .config .get ("subcommand" ):
559
559
return
560
560
ckpt_path = self .config [self .config .subcommand ].get ("ckpt_path" )
561
- if not ckpt_path or not Path (ckpt_path ).is_file ():
562
- return
563
- ckpt = torch .load (ckpt_path , weights_only = True , map_location = "cpu" )
564
- hparams = ckpt .get ("hyper_parameters" , {})
565
- hparams .pop ("_instantiator" , None )
566
- if not hparams :
567
- return
568
- hparams = {self .config .subcommand : {"model" : hparams }}
569
- try :
570
- self .config = self .parser .parse_object (hparams , self .config )
571
- except SystemExit :
572
- sys .stderr .write ("Parsing of ckpt_path hyperparameters failed!\n " )
573
- raise
561
+ if ckpt_path and Path (ckpt_path ).is_file ():
562
+ ckpt = torch .load (ckpt_path , weights_only = True , map_location = "cpu" )
563
+ hparams = ckpt .get ("hyper_parameters" , {})
564
+ hparams .pop ("_instantiator" , None )
565
+ if not hparams :
566
+ return
567
+ hparams = {self .config .subcommand : {"model" : hparams }}
568
+ try :
569
+ self .config = self .parser .parse_object (hparams , self .config )
570
+ except SystemExit :
571
+ sys .stderr .write ("Parsing of ckpt_path hyperparameters failed!\n " )
572
+ raise
574
573
575
574
def _dump_config (self ) -> None :
576
575
if hasattr (self , "config_dump" ):
You can’t perform that action at this time.
0 commit comments