Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proof-of-concept utility for retrieving a named JSON object from `__metadata__` by passing it and the safetensors filename.
- Loading branch information
ce53e31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a proof of concept utility for retrieving the value of a named object inside
__metadata__
from a safetensors file, with the intention of eventually moving the code intosafetensors_util.py
as its own separatecli.command()
block. I wrote this because so far I haven't seen any other utilities for retrieving these values from safetensors files, e.g. checkingss_network_module
to tell whether a file is LoRA (networks.lora
) or Lycoris (lycoris.kohya
) before trying to install it into a potentially incompatible SD client, or just debugging troublesome safetensors files without having to dump/parse the entire metadata block. Applies_ParseMore
to all output for readability's sake but this could be optionally disabled.Currently depends on the context manager protocol modification to
safetensors_file.py
but could be rewritten to use the conventionalSafeTensorsFile.open_file()
/SafeTensorsFile.close()
methods if that PR isn't approved/merged. I thought I'd reverted that before submitting it.