Skip to content

Commit

Permalink
fix train.py
Browse files Browse the repository at this point in the history
  • Loading branch information
leondgarse committed Jun 21, 2023
1 parent b18888f commit c29260e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def __init_emb_losses__(self, embLossTypes=None, embLossWeights=1):
def __basic_train__(self, epochs, initial_epoch=0):
self.model.compile(optimizer=self.optimizer, loss=self.cur_loss, metrics=self.metrics, loss_weights=self.loss_weights)
cur_optimizer = self.model.optimizer
if not hasattr(cur_optimizer, "_variables") and hasattr(cur_optimizer, "_optimizer"), hasattr(cur_optimizer._optimizer, "_variables"):
if not hasattr(cur_optimizer, "_variables") and hasattr(cur_optimizer, "_optimizer") and hasattr(cur_optimizer._optimizer, "_variables"):
# Bypassing TF 2.11 error AttributeError: 'LossScaleOptimizerV3' object has no attribute '_variables'
# setattr(self.model.optimizer, "_variables", self.model.optimizer._optimizer._variables)
setattr(self.model.optimizer, 'variables', self.model.optimizer._optimizer.variables)
Expand Down

1 comment on commit c29260e

@leondgarse
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #113

Please sign in to comment.