ageron / tf2_course

Notebooks for my "Deep Learning with TensorFlow 2 and Keras" course
Apache License 2.0
1.92k stars 537 forks source link

In Chapter16 Shakespearean dataset load problem #19

Closed klyuhang9 closed 3 years ago

klyuhang9 commented 3 years ago

Hi, I bought your book, then I excitedly tried to complete the task of generating Shakespearean in the book, but I found that. When I ran this code:

shakespeare_url = "https://homl.info/shakespeare"
filepath = keras.utils.get_file("shakespeare.txt", shakespeare_url)

the program would report an error. The error alert is as follows: File "C:\python\lib\site-packages\tensorflow\python\keras\utils\data_utils.py", line 282, in get_file raise Exception(error_msg.format(origin, e.errno, e.reason)) Exception: URL fetch failure on https://homl.info/shakespeare: None -- [Errno 11004] getaddrinfo failed

I could not fine how to fix this. Hope your hope.

ageron commented 3 years ago

Hi @klyuhang9 , Thanks for your question. I just tried this code, and it works fine for me. Looking at the error message, the getaddrinfo failed message probably shows that there was a DNS error. The homl.info domain name was not resolved correctly. This may be due to a temporary DNS issue, so you could retry now. If the problem persists, it might be due to a firewall or VPN issue, or some other network issue. You could also try replacing the URL with this:

shakespeare_url = "https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt"

If that still does not work, then try downloading the file manually (in your web browser) and save it to $HOME/.keras/datasets/shakespeare.txt where $HOME is the path to your home directory (e.g., /Users/your_user_name).

Hope this helps!