Hello,
I want to build a simple neural network but get an SSL error and google searches did not yield a solution. The error is the following and the line is the one below my comment in the source code:
Error downloading train-images-idx3-ubyte.gz:
Tried http://yann.lecun.com/exdb/mnist/, got:
HTTP Error 404: Not Found
Tried https://ossci-datasets.s3.amazonaws.com/mnist/, got:
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
import torch
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision.transforms import ToTensor
from utils import *
import ssl
ssl._create_default_https_context = ssl._create_stdlib_context
"""
Here we fetch the dataset.
"""
# the error is in this line below.
train_set = datasets.MNIST(root="data", download=True, transform=ToTensor())
test_set = datasets.MNIST(root="data",
download=True,
transform=ToTensor(),
train=False)
"""
Here we have specified a batch size of 64.
"""
train_loader = DataLoader(train_set, batch_size=32, shuffle=False)
test_loader = DataLoader(test_set, batch_size=32, shuffle=False)
"""
These lines of code simply start iterating through the dataloader, visualize
the first 4 images of the first batch, and then terminate the iteration.
"""
for batch, labels in train_loader:
print(
"""Tensor dimension of a single batch
(batch_size x channels x height x width):""", list(batch.shape))
visualize_first_4(batch, labels)
break
I would be very grateful if someone knew a solution ![]()