the-full-stack / fsdl-text-recognizer-2021-labs

Complete deep learning project developed in Full Stack Deep Learning, Spring 2021
https://bit.ly/berkeleyfsdl
MIT License
452 stars 281 forks source link

TorchMNIST download gives 403 HTTP Error #15

Closed DenysMenfredy closed 3 years ago

DenysMenfredy commented 3 years ago

I've run the code for lab1 in colab and get a 403 Forbidden code. After some "googling", I just found out that this is a known bug in torchvision see here. Maybe if someone is facing the same problem, can just follow the instructions to solve it, or the contributors fix it directly in the repository...

jason2133 commented 3 years ago

Hi, I also got 403 HTTP error, but I solved that problem by adding this code to util.py. (text_recognizer -> util.py)

from six.moves import urllib
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
DenysMenfredy commented 3 years ago

Hi, I also got 403 HTTP error, but I solved that problem by adding this code to util.py. (text_recognizer -> util.py)

from six.moves import urllib
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)

Hi! I also added this code, in my case I added it in the top of the MNIST class, I don't know if it's the best place, but it worked...

jason2133 commented 3 years ago

I added that code in the top of the util.py. Anyway it works, doesn't it? I think that's enough :)

DenysMenfredy commented 3 years ago

I added that code in the top of the util.py. Anyway it works, doesn't it? I think that's enough :)

Yes, it works :)

minhdang241 commented 3 years ago

Hi, Do you guys work on local or Colab? Since I tried to add the snipet in colab, and it still doesn't work though :(

DenysMenfredy commented 3 years ago

Hi, Do you guys work on local or Colab? Since I tried to add the snipet in colab, and it still doesn't work though :(

I'm using colab. Did you added it to the .ypnb file or one of the classes that uses TorchMNIST?

minhdang241 commented 3 years ago

Hi, now it works nicely! no worries, it's just my silly mistake of messing up the folders :) Thanks

sergeyk commented 3 years ago

Should be fixed, as the suggestion from @jason2133 was implemented

Karti-bell commented 3 years ago

So this solution worked for me. Just wanted to know how did you know this snippet would fix it. just curious honestly lol