File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -84,10 +84,13 @@ def initialize(
84
84
:return: List of data returned from initialization of modifiers
85
85
:rtype: List[Any]
86
86
"""
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
+ )
90
92
93
+ self .state .update (** kwargs )
91
94
logger .debug ("Initializing compression lifecycle" )
92
95
self .recipe_container .append (recipe , recipe_stage , recipe_args )
93
96
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):
222
222
len (self .train_dataset ) / total_batch_size
223
223
)
224
224
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
+ )
226
228
227
229
return self .optimizer
228
230
You can’t perform that action at this time.
0 commit comments