code: def __init__(self, name, filename):
      self.name = name
      self.filename = filename
      self.metadata = {}
      self.is_safetensors = (
          os.path.splitext(filename)[1].lower() == ".safetensors"
      )
  
      def read_metadata():
          metadata = sd_models.read_metadata_from_safetensors(filename)
          metadata.pop(
              "ssmd_cover_images", None
          )  # those are cover images, and they are too big to display in UI as text
  
          return metadata
  
      if self.is_safetensors:
          try:
              self.metadata = cache.cached_data_for_file(
                  "safetensors-metadata",
                  "lora/" + self.name,
                  filename,
                  read_metadata,
              )
          except Exception as e:
              errors.display(e, f"reading lora {filename}")
  
      if self.metadata:
          m = {}
          for k, v in sorted(
              self.metadata.items(),
              key=lambda x: metadata_tags_order.get(x[0], 999),
          ):
              m[k] = v
  
          self.metadata = m
  
      self.alias = self.metadata.get("ss_output_name", self.name)
  
      self.hash = None
      self.shorthash = None
      self.set_hash(
          self.metadata.get("sshs_model_hash")
          or hashes.sha256_from_cache(
              self.filename,
              "lora/" + self.name,
              use_addnet_hash=self.is_safetensors,
          )
          or ""
      )
  
      self.sd_version = self.detect_version()
  
imports: from __future__ import annotations
  import os
  from collections import namedtuple
  import enum
  from modules import sd_models, cache, errors, hashes, shared
label_desc: Use image node_id 1 to create a new NetworkOnDisk object  with example: obj = NetworkOnDisk(name, filename)