Skip to content

MotherNetClassifier fails silently on network-restricted environments with no offline fallback #26

@hmnshsn

Description

@hmnshsn

When instantiating MotherNetClassifier in an environment without internet access, the model attempts to download weights from Azure Blob Storage at init time with no way to provide a local path as an alternative, resulting in a hard crash.
Environment:

  • Python 3.11.14
  • PyTorch 2.10.0+cu128
  • ticl 0.1.0
Downloading model from https://amuellermothernet.blob.core.windows.net/models/mn_Dclass_average_03_25_2024_17_14_32_epoch_3970.cpkt to /home/toolkit/hmnshpl/TFM/external/TICL/ticl/models_diff/mn_Dclass_average_03_25_2024_17_14_32_epoch_3970.cpkt. This can take a bit.
mn_Dclass_average_03_25_2024_17_14_32_epoch_3970.cpkt: 0.00B [00:00, ?B/s]
2026-02-25 06:51:37,794 - ERROR - Error running MotherNet: <urlopen error [Errno -2] Name or service not known>
Traceback (most recent call last):
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 1303, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 1349, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 1298, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 1058, in _send_output
    self.send(msg)
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 996, in send
    self.connect()
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 1468, in connect
    super().connect()
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/http/client.py", line 962, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/socket.py", line 839, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/socket.py", line 974, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/toolkit/hmnshpl/TFM/main.py", line 164, in run_model
    model = create_model(
            ^^^^^^^^^^^^^
  File "/home/toolkit/hmnshpl/TFM/models.py", line 923, in create_model
    return MotherNetModel(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/hmnshpl/TFM/models.py", line 812, in __init__
    self.model = MotherNetClassifier(device=self.device)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/hmnshpl/TFM/external/TICL/ticl/prediction/mothernet.py", line 231, in __init__
    path = fetch_model(model_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/hmnshpl/TFM/external/TICL/ticl/utils.py", line 35, in fetch_model
    urllib.request.urlretrieve(url, filename=model_path, reporthook=t.update_to)
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 241, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
                            ^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toolkit/.local/share/uv/python/cpython-3.11.14-linux-x86_64-gnu/lib/python3.11/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions