I have a problem with keras dataset imports. When I try to use
from tensorflow.python.keras.datasets import mnist
It says: ModuleNotFoundError: No module named ‘tensorflow.python.keras.datasets’
I reinstalled keras and TF withoutr success. I tried below command in VSCode:
python -c "import tensorflow as tf; from tensorflow.keras.datasets import mnist; (x_train, y_train), (x_test, y_test) = mnist.load_data(); print(x_train.shape);"
and I received below response :
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
11490434/11490434 ━━━━━━━━━━━━━━━━━━━━ 1s 0us/step
(60000, 28, 28)
So it connected to the repo and showed shape of the array. I downloaded this npz file, created directory called datasets and placed this file into it and now error message is like that:
ImportError: cannot import name ‘mnist’ from ‘tensorflow.python.keras.datasets’ (unknown location).
I tried to load file with np.load(‘C:path’) but this ended with the following error:
SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated UXXXXXXXX escape
Please help me with fixing that.
Regards
Piotr