File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,10 @@ def compile(
105105 return super ().compile (* args , ** kwargs )
106106
107107 def compile_from_config (self , config ):
108- return self .compile (** deserialize (config ))
108+ self .compile (** deserialize (config ))
109+ if hasattr (self , "optimizer" ) and self .built :
110+ # Create optimizer variables.
111+ self .optimizer .build (self .trainable_variables )
109112
110113 def compute_metrics (
111114 self ,
Original file line number Diff line number Diff line change @@ -119,7 +119,10 @@ def compile(
119119 return super ().compile (* args , ** kwargs )
120120
121121 def compile_from_config (self , config ):
122- return self .compile (** deserialize (config ))
122+ self .compile (** deserialize (config ))
123+ if hasattr (self , "optimizer" ) and self .built :
124+ # Create optimizer variables.
125+ self .optimizer .build (self .trainable_variables )
123126
124127 def compute_metrics (
125128 self ,
You can’t perform that action at this time.
0 commit comments