code: def _make_load_state_dict_from_url_monkey_patcher(
      entrypoint, model_dir
  ):
      """Monkey patches all instances of ``load_state_dict_from_url()`` that are
      reachable from the given ``entrypoint`` function in the
      :mod:`torchvision:torchvision.models` namespace so that models will be
      loaded from ``model_dir`` and not from the Torch Hub cache directory.
      """
      if version.parse(torchvision.__version__) >= version.parse(
          "0.12.0"
      ):
          entrypoint_module = torchvision._internally_replaced_utils
      else:
          entrypoint_module = inspect.getmodule(entrypoint)
  
      load_state_dict_from_url = (
          entrypoint_module.load_state_dict_from_url
      )
  
      def custom_load_state_dict_from_url(url, **kwargs):
          return load_state_dict_from_url(
              url, model_dir=model_dir, **kwargs
          )
  
      return fou.MonkeyPatchFunction(
          entrypoint_module,
          custom_load_state_dict_from_url,
          fcn_name=load_state_dict_from_url.__name__,
          namespace=torchvision.models,
      )
  
file_path: fiftyone/fiftyone/zoo/models/torch.py
imports: import contextlib
  import inspect
  import logging
  from packaging import version
  import fiftyone
  import fiftyone.core.utils
  import fiftyone.utils.torch
  import fiftyone.zoo.models
  import torchvision
label_desc: Use image node_id 1 for calling a global function with example usage: _make_load_state_dict_from_url_monkey_patcher(entrypoint, model_dir) and returns: fou, load_state_dict_from_url