OSError when downloading files from google drive inside `prediction_setup`

I’m seeking for a way to dynamically load the trained model from web to save my LFS usage.
I end up put my model weights on google drive, and use python urllib and http package to download it when running the CI runner, but I received the following errors:

===========================
Partial run on init: None
All music names on init: ['SS_018', 'SS_008']
Partial run on init: None
All music names on init: ['SS_018', 'SS_008']
Partial run on init: None
All music names on init: ['SS_008', 'SS_018']
Partial run on init: None
All music names on init: ['SS_008', 'SS_018']
Partial run on init: None
All music names on init: ['SS_008', 'SS_018']
Traceback (most recent call last):
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1384, in connect
    super().connect()
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 928, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/srv/conda/envs/notebook/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/srv/conda/envs/notebook/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aicrowd/evaluator/music_demixing.py", line 116, in run
    self.evaluation()
  File "/home/aicrowd/evaluator/music_demixing.py", line 92, in evaluation
    self.prediction_setup()
  File "/home/aicrowd/test_unet.py", line 107, in prediction_setup
    save_path="./models", save_name="unet.pth"
  File "/home/aicrowd/remote.py", line 192, in download_large_file_from_google_drive
    resp = opener.open(url)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>

Traceback (most recent call last):
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 1384, in connect
    super().connect()
  File "/srv/conda/envs/notebook/lib/python3.7/http/client.py", line 928, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/srv/conda/envs/notebook/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/srv/conda/envs/notebook/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "predict.py", line 27, in <module>
    submission.run()
  File "/home/aicrowd/evaluator/music_demixing.py", line 122, in run
    raise e
  File "/home/aicrowd/evaluator/music_demixing.py", line 116, in run
    self.evaluation()
  File "/home/aicrowd/evaluator/music_demixing.py", line 92, in evaluation
    self.prediction_setup()
  File "/home/aicrowd/test_unet.py", line 107, in prediction_setup
    save_path="./models", save_name="unet.pth"
  File "/home/aicrowd/remote.py", line 192, in download_large_file_from_google_drive
    resp = opener.open(url)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/srv/conda/envs/notebook/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>

Is this a problem relates to the CI environment used when evaluating?
I can run prediction succesfully inside docker using the builded image (with aicrowd-repo2docker) on my local machine.

Hi @yoyololicon,

During the evaluations, you do not have access to the internet, due to which downloading from Google failed as visible from your traceback.

You need to save the models using LFS in your GitLab repository for making the submission.

FYI, we don’t limit accounts for LFS storage (except few large enough limits) if that’s what you are worried about. :smiley:

1 Like