diff --git a/gordo/machine/model/factories/feedforward_autoencoder.py b/gordo/machine/model/factories/feedforward_autoencoder.py index 1234fc9f5..312d8b69a 100644 --- a/gordo/machine/model/factories/feedforward_autoencoder.py +++ b/gordo/machine/model/factories/feedforward_autoencoder.py @@ -5,7 +5,7 @@ from tensorflow.keras.optimizers import Optimizer from tensorflow.keras import regularizers from tensorflow.keras.layers import Dense -from tensorflow import keras +from tensorflow.python import keras from tensorflow.keras.models import Sequential as KerasSequential from gordo.machine.model.register import register_model_builder @@ -88,7 +88,7 @@ class (e.x. Adam(lr=0.01,beta_1=0.9, beta_2=0.999)). If no arguments are # Instantiate optimizer with kwargs if isinstance(optimizer, str): - Optim = keras.optimizers.get(optimizer) + Optim = getattr(keras.optimizer_v1, optimizer) optimizer = Optim(**optimizer_kwargs) # Final output layer diff --git a/gordo/machine/model/factories/lstm_autoencoder.py b/gordo/machine/model/factories/lstm_autoencoder.py index 4864321a6..a30cedd49 100644 --- a/gordo/machine/model/factories/lstm_autoencoder.py +++ b/gordo/machine/model/factories/lstm_autoencoder.py @@ -3,10 +3,10 @@ from typing import Tuple, Union, Dict, Any import tensorflow -from tensorflow import keras from tensorflow.keras.optimizers import Optimizer from tensorflow.keras.layers import Dense, LSTM from tensorflow.keras.models import Sequential as KerasSequential +from tensorflow.python import keras from gordo.machine.model.register import register_model_builder from gordo.machine.model.factories.utils import hourglass_calc_dims, check_dim_func_len @@ -90,7 +90,7 @@ class (e.x. Adam(lr=0.01,beta_1=0.9, beta_2=0.999)). If no arguments are # output layer if isinstance(optimizer, str): - Optim = keras.optimizers.get(optimizer) + Optim = getattr(keras.optimizer_v1, optimizer) optimizer = Optim(**optimizer_kwargs) model.add(Dense(units=n_features_out, activation=out_func))