aboutsummaryrefslogtreecommitdiff
path: root/modules/sd_models.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-04-29 22:23:21 +0300
committerAUTOMATIC <16777216c@gmail.com>2023-04-29 22:23:21 +0300
commite23063610f4695ce12f963e06e78154f5ce128d1 (patch)
treeeeab6971022d4ee0e1bfd6a8b603b0e950a6c868 /modules/sd_models.py
parent22bcc7be428c94e9408f589966c2040187245d81 (diff)
parentcd7f2b19f45a28c8eeb88994c8972c61c8a3c63d (diff)
Merge branch 'dev' into release_candidate
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r--modules/sd_models.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index 6ea874df..4f7613a1 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -52,6 +52,15 @@ class CheckpointInfo:
self.ids = [self.hash, self.model_name, self.title, name, f'{name} [{self.hash}]'] + ([self.shorthash, self.sha256, f'{self.name} [{self.shorthash}]'] if self.shorthash else [])
+ self.metadata = {}
+
+ _, ext = os.path.splitext(self.filename)
+ if ext.lower() == ".safetensors":
+ try:
+ self.metadata = read_metadata_from_safetensors(filename)
+ except Exception as e:
+ errors.display(e, f"reading checkpoint metadata: {filename}")
+
def register(self):
checkpoints_list[self.title] = self
for id in self.ids:
@@ -544,4 +553,4 @@ def unload_model_weights(sd_model=None, info=None):
print(f"Unloaded weights {timer.summary()}.")
- return sd_model \ No newline at end of file
+ return sd_model