Added rescaling, locon, sdxl, all kinds of stuff. sdxl is still weird

This commit is contained in:
Jaret Burkett
2023-07-26 16:19:50 -06:00
parent 40e60fa021
commit d3ad195b51
11 changed files with 548 additions and 45 deletions

View File

@@ -1,5 +1,8 @@
import json
from collections import OrderedDict
from safetensors import safe_open
from info import software_meta
@@ -25,4 +28,10 @@ def parse_metadata_from_safetensors(meta: OrderedDict) -> OrderedDict:
parsed_meta[key] = json.loads(value)
except json.decoder.JSONDecodeError:
parsed_meta[key] = value
return meta
return parsed_meta
def load_metadata_from_safetensors(file_path: str) -> OrderedDict:
with safe_open(file_path, framework="pt") as f:
metadata = f.metadata()
return parse_metadata_from_safetensors(metadata)