code: def load(
      name: str,
      device: Union[str, torch.device] = "cuda"
      if torch.cuda.is_available()
      else "cpu",
      jit=False,
  ):
      if name in _MODELS:
          model_path = _download(_MODELS[name])
      elif os.path.isfile(name):
          model_path = name
      else:
          raise RuntimeError(
              f"Model {name} not found; available models = {available_models()}"
          )
  
      try:
          # loading JIT archive
          model = torch.jit.load(
              model_path, map_location=device if jit else "cpu"
          ).eval()
          state_dict = None
      except RuntimeError:
          # loading saved state dict
          if jit:
              warnings.warn(
                  f"File {model_path} is not a JIT archive. Loading as a state dict instead"
              )
              jit = False
          state_dict = torch.load(model_path, map_location="cpu")
  
      if not jit:
          model = build_model(state_dict or model.state_dict()).to(
              device
          )
          if str(device) == "cpu":
              model.float()
          return model, _transform(model.visual.input_resolution)
  
      # patch the device names
      device_holder = torch.jit.trace(
          lambda: torch.ones([]).to(torch.device(device)),
          example_inputs=[],
      )
      device_node = [
          n
          for n in device_holder.graph.findAllNodes("prim::Constant")
          if "Device" in repr(n)
      ][-1]
  
      def patch_device(module):
          graphs = [module.graph] if hasattr(module, "graph") else []
          if hasattr(module, "forward1"):
              graphs.append(module.forward1.graph)
  
          for graph in graphs:
              for node in graph.findAllNodes("prim::Constant"):
                  if "value" in node.attributeNames() and str(
                      node["value"]
                  ).startswith("cuda"):
                      node.copyAttributes(device_node)
  
      model.apply(patch_device)
      patch_device(model.encode_image)
      patch_device(model.encode_text)
  
      # patch dtype to float32 on CPU
      if str(device) == "cpu":
          float_holder = torch.jit.trace(
              lambda: torch.ones([]).float(), example_inputs=[]
          )
          float_input = list(
              float_holder.graph.findNode("aten::to").inputs()
          )[1]
          float_node = float_input.node()
  
          def patch_float(module):
              graphs = (
                  [module.graph] if hasattr(module, "graph") else []
              )
              if hasattr(module, "forward1"):
                  graphs.append(module.forward1.graph)
  
              for graph in graphs:
                  for node in graph.findAllNodes("aten::to"):
                      inputs = list(node.inputs())
                      for i in [
                          1,
                          2,
                      ]:  # dtype can be the second or third argument to aten::to()
                          if inputs[i].node()["value"] == 5:
                              inputs[i].node().copyAttributes(
                                  float_node
                              )
  
          model.apply(patch_float)
          patch_float(model.encode_image)
          patch_float(model.encode_text)
  
          model.float()
  
      return model, _transform(model.input_resolution.item())
  
file_path: backprop/backprop/models/clip/clip.py
imports: import hashlib
  import os
  import urllib
  import warnings
  from typing import Union, List
  import torch
  from PIL import Image
  from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
  from tqdm import tqdm
  from .model import build_model
label_desc: Use image node_id 4 for calling a global function with example usage: load(name, device, jit) and returns: model,  _transform, model,  _transform