File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -84,10 +84,13 @@ def initialize(
8484 :return: List of data returned from initialization of modifiers
8585 :rtype: List[Any]
8686 """
87- self .state .update (** kwargs )
88- if self .initialized_ : # TODO: do not initialize twice
89- return
87+ if self .initialized_ :
88+ raise ValueError (
89+ "Initialize was called twice. To update state values after "
90+ "initialization, please use `active_session().state.update()`"
91+ )
9092
93+ self .state .update (** kwargs )
9194 logger .debug ("Initializing compression lifecycle" )
9295 self .recipe_container .append (recipe , recipe_stage , recipe_args )
9396 self .modifiers = self .recipe_container .get_modifiers ()
Original file line number Diff line number Diff line change @@ -222,7 +222,9 @@ def create_optimizer(self):
222222 len (self .train_dataset ) / total_batch_size
223223 )
224224
225- initialize (optimizer = self .optimizer , steps_per_epoch = self .total_steps_per_epoch )
225+ active_session ().state .update (
226+ optimizer = self .optimizer , steps_per_epoch = self .total_steps_per_epoch
227+ )
226228
227229 return self .optimizer
228230
You can’t perform that action at this time.
0 commit comments