code: def split_safetensor(fn):
      _, json_len, metadata = safe_load_metadata(fn)
      text_model_offset = 3772703308
      chunk_size = 536870912
  
      for k in metadata:
          # safetensor is in fp16, except for text moel
          if metadata[k]["data_offsets"][0] < text_model_offset:
              metadata[k]["data_offsets"][0] = int(
                  metadata[k]["data_offsets"][0] / 2
              )
              metadata[k]["data_offsets"][1] = int(
                  metadata[k]["data_offsets"][1] / 2
              )
  
      last_offset = 0
      part_end_offsets = []
  
      for k in metadata:
          offset = metadata[k]["data_offsets"][0]
  
          if offset == text_model_offset:
              break
  
          part_offset = offset - last_offset
  
          if part_offset >= chunk_size:
              part_end_offsets.append(8 + json_len + offset)
              last_offset = offset
  
      text_model_start = int(text_model_offset / 2)
      net_bytes = bytes(open(fn, "rb").read())
      part_end_offsets.append(text_model_start + 8 + json_len)
      cur_pos = 0
  
      for i, end_pos in enumerate(part_end_offsets):
          with open(f"./net_part{i}.safetensors", "wb+") as f:
              f.write(net_bytes[cur_pos:end_pos])
              cur_pos = end_pos
  
      with open(f"./net_textmodel.safetensors", "wb+") as f:
          f.write(net_bytes[text_model_start + 8 + json_len :])
  
      return part_end_offsets
  
file_path: tinygrad/examples/webgpu/stable_diffusion/compile.py
imports: import os
  from extra.export_model import compile_net, jit_model
  from examples.stable_diffusion import StableDiffusion
  from tinygrad.nn.state import get_state_dict, safe_save, safe_load_metadata, torch_load, load_state_dict
  from tinygrad.tensor import Tensor
  from tinygrad import Device
  from tinygrad.helpers import fetch
  from typing import NamedTuple, Any, List
  from pathlib import Path
  import argparse
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: split_safetensor(fn) and returns: part_end_offsets