<jupyter_start><jupyter_text><jupyter_code>!pip install tf-nightly
import tensorflow as tf
tf.__version__
import tensorflow as tf
import numpy as np


features = np.random.uniform(size=[100, 50])
labels = np.random.uniform(size=[100])

linear_model = tf.keras.experimental.LinearModel()
dnn_model = tf.keras.Sequential([tf.keras.layers.Dense(units=1)])
combined_model = tf.keras.experimental.WideDeepModel(linear_model,dnn_model)
# Uncomment the following line to test without compilation:
combined_model.compile(optimizer=['adagrad','rmsprop'], loss='mse')
combined_model.fit([features,features], labels,epochs=10)
#tf.saved_model.save(combined_model, "./saved_model")
# Throwing an error 
tf.saved_model.save(combined_model, "./saved_model")
combined_model.optimizer = []
tf.saved_model.save(combined_model, "./saved_model")
loaded_model = tf.keras.models.load_model('./saved_model')
# compile the loaded model
loaded_model.compile(optimizer=['adagrad','rmsprop'], loss=['mse','mse'])
# restart training
loaded_model.fit([features,features], labels,epochs=10)<jupyter_output>Epoch 1/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2482
Epoch 2/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2386
Epoch 3/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2136
Epoch 4/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2241
Epoch 5/10
4/4 [==============================] - 0s 2ms/step - loss: 0.1990
Epoch 6/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2191
Epoch 7/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2392
Epoch 8/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2283
Epoch 9/10
4/4 [==============================] - 0s 1ms/step - loss: 0.2182
Epoch 10/10
4/4 [==============================] - 0s 2ms/step - loss: 0.2121
{'fraction_non_alphanumeric': 0.29453167298321603, 'fraction_numerical': 0.07255008121277748, 'mean_word_length': 5.72, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '202384', 'license': 'Apache-2.0', 'n_tokens_mistral': 740, 'n_tokens_neox': 636, 'n_words': 130, 'path': 'WideDeepModel_2.ipynb', 'repo_name': 'jvishnuvardhan/Keras_Examples', 'size': '1847'}