code: def download_onnx_from_url(
      url: str,
      model_dir: Optional[str] = None,
      progress: bool = True,
      check_hash: bool = False,
      file_name: Optional[str] = None,
  ) -> str:
      r"""Loads the ONNX model at the given URL.
  
      If downloaded file is a zip file, it will be automatically
      decompressed.
  
      If the object is already present in `model_dir`, it's deserialized and
      returned.
      The default value of ``model_dir`` is ``<hub_dir>/checkpoints`` where
      ``hub_dir`` is the directory returned by :func:`~torch.hub.get_dir`.
  
      Args:
          url (str): URL of the object to download
          model_dir (str, optional): directory in which to save the object
          progress (bool, optional): whether or not to display a progress bar to stderr.
              Default: True
          check_hash(bool, optional): If True, the filename part of the URL should follow the naming convention
              ``filename-<sha256>.ext`` where ``<sha256>`` is the first eight or more
              digits of the SHA256 hash of the contents of the file. The hash is used to
              ensure unique names and to verify the contents of the file.
              Default: False
          file_name (str, optional): name for the downloaded file. Filename from ``url`` will be used if not set.
  
      Example:
          >>> model = download_onnx_from_url('https://github.com/fabio-sim/LightGlue-ONNX/releases/download/v1.0.0/disk_lightglue_fused_fp16.onnx')
      """
      if model_dir is None:
          hub_dir = get_dir()
          model_dir = os.path.join(hub_dir, "checkpoints")
  
      os.makedirs(model_dir, exist_ok=True)
  
      parts = urlparse(url)
      filename = os.path.basename(parts.path)
      if file_name is not None:
          filename = file_name
      cached_file = os.path.join(model_dir, filename)
      if not os.path.exists(cached_file):
          sys.stderr.write(f'Downloading: "{url}" to {cached_file}\n')
          hash_prefix = None
          if check_hash:
              r = HASH_REGEX.search(
                  filename
              )  # r is Optional[Match[str]]
              hash_prefix = r.group(1) if r else None
          download_url_to_file(
              url, cached_file, hash_prefix, progress=progress
          )
  
      return cached_file
  
imports: from __future__ import annotations
  import os
  import sys
  from typing import Optional
  from urllib.parse import urlparse
  from torch.hub import HASH_REGEX, download_url_to_file, get_dir
label_desc: Use image node_id 1 for calling a global function with example usage: download_onnx_from_url(url, model_dir, progress, check_hash, file_name) and returns: cached_file