'use tfds.load download the datasets error

when i want to download the datasets by tfds.load(),just like that

ratings = tfds.load('movielens/100k-ratings', split="train")

the error is:

Downloading and preparing dataset Unknown size (download: Unknown size, generated: Unknown size, total: Unknown size) to C:\Users\samsung\tensorflow_datasets\movielens\100k-ratings\0.1.0...
Dl Completed...: 0%
0/1 [00:21<?, ? url/s]
Dl Size...:
0/0 [00:21<?, ? MiB/s]
Extraction completed...:
0/0 [00:21<?, ? file/s]
HTTPConnectionPool(host='files.grouplens.org', port=80): Max retries exceeded with url: /datasets/movielens/ml-100k.zip (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001E81008F910>: Failed to establish a new connection: [WinError 10060] 

by the way, I use the company computer. could someone help me.help!!!



Solution 1:[1]

Do you have the same dataset at the download floder

It cannot use the shuffle Fn but you can export and updates

ds = tfds.load('movielens/100k-ratings', split='train', shuffle_files=True)
??? ds = ds.shuffle(1024).batch(64).prefetch(tf.data.experimental.AUTOTUNE)
assert isinstance(ds, tf.data.Dataset)

for example in ds.take(1):
    print(example)

# {'bucketized_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=45.0>, 'movie_genres': <tf.Tensor: shape=(1,), dtype=int64, numpy=array([7], dtype=int64)>, 
# 'movie_id': <tf.Tensor: shape=(), dtype=string, numpy=b'357'>, 'movie_title': <tf.Tensor: shape=(), dtype=string, numpy=b"One Flew Over the Cuckoo's Nest (1975)">, 
# 'raw_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=46.0>, 'timestamp': <tf.Tensor: shape=(), dtype=int64, numpy=879024327>, 
# 'user_gender': <tf.Tensor: shape=(), dtype=bool, numpy=True>, 'user_id': <tf.Tensor: shape=(), dtype=string, numpy=b'138'>, 
# 'user_occupation_label': <tf.Tensor: shape=(), dtype=int64, numpy=4>, 'user_occupation_text': <tf.Tensor: shape=(), dtype=string, numpy=b'doctor'>, 
# 'user_rating': <tf.Tensor: shape=(), dtype=float32, numpy=4.0>, 'user_zip_code': <tf.Tensor: shape=(), dtype=string, numpy=b'53211'>}

Dataset downloading...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martijn Pieters