dlwpt-code icon indicating copy to clipboard operation
dlwpt-code copied to clipboard

SSL: CERTIFICATE_VERIFY_FAILED Solution while downloading CIFAR10

Open naiborhujosua opened this issue 2 years ago • 0 comments

For anyone who is getting errors while downloading CIFAR-10, you can use this trick

## by turning off SSL verification 
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

from torchvision import datasets, transforms
data_path = '../data-unversioned/p1ch7/'
cifar10 = datasets.CIFAR10(
    data_path, train=True, download=True,
    transform=transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize((0.4915, 0.4823, 0.4468),
                             (0.2470, 0.2435, 0.2616))
    ]))

naiborhujosua avatar Mar 20 '22 23:03 naiborhujosua