following this instruction: the alternative to from keras.datasets import mnist
I am able to load the mnist dataset, with the following lines:
f = gzip.open('C:/.../Datasets/mnist.pkl.gz', 'rb')
if sys.version_info < (3,):
data = pickle.load(f)
else:
data = pickle.load(f, encoding='bytes')
f.close()
(x_train, y_train),(x_test, y_test) = data
But when I try the same for the IMDB dataset, which i saved as tar.gz file, which the following command:
imdb = gzip.open('C:/.../Datasets/aclImdb_v1.tar.gz', 'rb')
if sys.version_info < (3,):
data = pickle.load(imdb)
else:
data = pickle.load(imdb, encoding='bytes')
imdb.close()
I get the error:
UnpicklingError: unpickling stack underflow
I am not allowed to load it with:
imdb = keras.datasets.imdb
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000)
because I am behind a proxy.
Since you are behind a proxy, there are alternatives to download the dataset:
C:\Users\<your_username>\.keras\datasets
keras.datasets.imdb.load_data()
normally.If you get errors about pickle, then look at: How to fix 'Object arrays cannot be loaded when allow_pickle=False' for imdb.load_data() function?