intel / certified-developer

Official repository of the Intel Certified Developer Program
https://www.intel.com/content/www/us/en/developer/certification/mlops.html?
BSD 3-Clause "New" or "Revised" License
35 stars 34 forks source link

Lab5 - Cannot download dataset in JupyterLab #22

Closed paleze closed 1 week ago

paleze commented 7 months ago

Following Lab5 HTML instructions and running python IntelPyTorch_Optimizations.py -dtype "fp32" in JupiterLabs returns an exception as the server cannot access the internet to download the dataset from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz

Full exception stack:

(pytorch) uc5f62fcc4ffc586c8ccfa883d539cbf@idc-beta-batch-pvc-node-20:~$ python IntelPyTorch_Optimizations.py -dtype "fp32"
Traceback (most recent call last):
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/ssl.py", line 1074, in _create
    self.do_handshake()
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/ssl.py", line 1343, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/uc5f62fcc4ffc586c8ccfa883d539cbf/Training/certified-developer/MLOps_Professional/lab5/sample/IntelPyTorch_Optimizations.py", line 138, in <module>
    main(FLAGS)
  File "/home/uc5f62fcc4ffc586c8ccfa883d539cbf/Training/certified-developer/MLOps_Professional/lab5/sample/IntelPyTorch_Optimizations.py", line 108, in main
    train_dataset = torchvision.datasets.CIFAR10(
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/site-packages/torchvision/datasets/cifar.py", line 65, in __init__
    self.download()
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/site-packages/torchvision/datasets/cifar.py", line 139, in download
    download_and_extract_archive(self.url, self.root, filename=self.filename, md5=self.tgz_md5)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/site-packages/torchvision/datasets/utils.py", line 434, in download_and_extract_archive
    download_url(url, download_root, filename, md5)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/site-packages/torchvision/datasets/utils.py", line 134, in download_url
    url = _get_redirect_url(url, max_hops=max_redirect_hops)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/site-packages/torchvision/datasets/utils.py", line 82, in _get_redirect_url
    with urllib.request.urlopen(urllib.request.Request(url, headers=headers)) as response:
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/opt/intel/oneapi/intelpython/envs/pytorch/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 104] Connection reset by peer>
paleze commented 7 months ago

As a workaround I downloaded the dataset locally to my laptop (~170 MB) and then I uploaded it into the JupiterLab.