code: def load_offloaded_weight(weight_file, weight_info):
      shape = tuple(weight_info["shape"])
      if shape == ():
          # NumPy memory-mapped arrays can't have 0 dims so it was saved as 1d tensor
          shape = (1,)
  
      dtype = weight_info["dtype"]
      if dtype == "bfloat16":
          # NumPy does not support bfloat16 so this was saved as a int16
          dtype = "int16"
  
      weight = np.memmap(
          weight_file, dtype=dtype, shape=shape, mode="r"
      )
  
      if len(weight_info["shape"]) == 0:
          weight = weight[0]
      weight = torch.tensor(weight)
      if weight_info["dtype"] == "bfloat16":
          weight = weight.view(torch.bfloat16)
  
      return weight
  
imports: import json
  import os
  from collections.abc import Mapping
  from typing import Dict, List, Optional, Union
  import numpy
  import torch
  from safetensors import safe_open
label_desc: Use image node_id 2 for calling a global function with example usage: load_offloaded_weight(weight_file, weight_info) and returns: weight