背景: 直接按官网的(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000) 下载失败
-
windows
方法: 将imdb.npz文件下载到本地文件夹,然后指定path,如下:
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(path=r"D:\pywork\18.minist\data\imdb.npz",
num_words=10000) -
linux
方法: 下载的npz文件放在,keras.datasets.imdb下面,然后,执行如下,下载太慢了:
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000)方法2:
1)windows上,先按 (train_data, train_labels), (test_data, test_labels) = imdb.load_data(path=r"D:\pywork\18.minist\data\imdb.npz", num_words=10000) 读取对应文件
2)利用np.savez(“my_imdb.npz”, train_data=train_data, train_labels=train_labels, test_data=test_data, test_labels=test_labels)
3) rz到linux 上,用numpy进行读取
: