본문 바로가기
각종공부/파이썬 오류 해결 & 팁

[파이썬] pytoch mnist urllib.error.HTTPError: HTTP Error 503: Service Unavailable

by 달슬 2021. 3. 23.
반응형

MNIST dataset을 제공해주던 LeCun's website에서 오류가 발생하여 데이터셋 다운로드가 안되고 있다.

(urlib.error.HTTPError: HTTP Error 503: Service Unavailable 발생!)

 

이를 해결하는 여러 방법이 있지만, 수동으로 해결하는 방법을 적어보겠다.

(다른 방법은 하단 링크 참조)

 

train_dataset = torchvision.datasets.MNIST(root='./data', train=True, transform=transforms.ToTensor(), download=True)
test_dataset = torchvision.datasets.MNIST(root='./data', train=False, transform=transforms.ToTensor())

 

위 코드와 같이 MNIST 데이터셋을 넣어 줄 폴더를 정하게 되는데, 이 폴더에 아래 파일 4개를 모두 넣어주면 된다.

(MNIST 데이터셋 파일)

t10k-images-idx3-ubyte.gz
1.57MB
t10k-labels-idx1-ubyte.gz
0.00MB
train-images-idx3-ubyte.gz
9.45MB
train-labels-idx1-ubyte.gz
0.03MB

 

 

문제 해결~!

 

다른방법으로 문제 해결하는 법 참고

stackoverflow.com/questions/66467005/torchvision-mnist-httperror-http-error-403-forbidden

 

torchvision MNIST HTTPError: HTTP Error 403: Forbidden

I am trying to replicate this experiment presented in this webpage https://adversarial-ml-tutorial.org/adversarial_examples/ I got the jupyter notebook and loaded in my localhost and open it using

stackoverflow.com

github.com/pytorch/vision/issues/3500

 

Download dataset return 403 · Issue #3500 · pytorch/vision

🐛 Bug To Reproduce Steps to reproduce the behavior: import torch.backends.cudnn import torch.utils.data import torchvision # prepare parameters n_epochs = 1 # 3 batch_size_train = 64 batch_size_tes...

github.com

stackoverflow.com/questions/66646604/http-error-503-service-unavailable-whan-trying-to-download-mnist-data

 

HTTP Error 503: Service Unavailable whan trying to download MNIST data

I'm trying to run code that I wrote a week ago on Google Colab (and it worked), but I'm getting this error now for some reason. #libraries import torch import torchvision from torchvision import da...

stackoverflow.com

discuss.pytorch.org/t/mnist-server-down/114433/15

 

MNIST server down

Manually download mnist files from yann lecun 's homepage. Replace class MNIST with code below(class MNIST_local). It works for me. import torch from torchvision.datasets import MNIST from torchvision.datasets.mnist import read_image_file,read_label_file f

discuss.pytorch.org

 

반응형

댓글