MicrosoftDocs / ml-basics

Exercise notebooks for Machine Learning modules on Microsoft Learn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There is an error with Keras.__version__ in the Tensorflow Notebook

edwinsibarra opened this issue · comments

As of the console output, Keras has no attribute called "version".

Keras has been integrated into Tensorflow and when imported from tensorflow they have the same version.

At least according to StackOverflow:

https://stackoverflow.com/questions/73934025/attributeerror-module-keras-has-no-attribute-version

The resolutions of this issue would consist of deleting one line of code in https://github.com/MicrosoftDocs/ml-basics/blob/master/05a%20-%20Deep%20Neural%20Networks%20(TensorFlow).ipynb right after importing TF.

import tensorflow
from tensorflow import keras
from tensorflow.keras import models
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras import utils
from tensorflow.keras import optimizers

# Set random seed for reproducability
tensorflow.random.set_seed(0)

print("Libraries imported.")
print('Keras version:',keras.__version__) #This line has to go
print('TensorFlow version:',tensorflow.__version__)