mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-08 22:35:09 +00:00
do not save metadata in .pt/.ckpt
This commit is contained in:
@@ -1975,17 +1975,12 @@ def main(args):
|
||||
network_weight = args.network_weights[i]
|
||||
print("load network weights from:", network_weight)
|
||||
|
||||
metadata = None
|
||||
if os.path.splitext(network_weight)[1] == '.safetensors':
|
||||
from safetensors.torch import safe_open
|
||||
with safe_open(network_weight, framework="pt") as f:
|
||||
metadata = f.metadata()
|
||||
else:
|
||||
with zipfile.ZipFile(network_weight, "r") as zipf:
|
||||
if "sd_scripts_metadata.json" in zipf.namelist():
|
||||
with zipf.open("sd_scripts_metadata.json", "r") as jsfile:
|
||||
metadata = json.load(jsfile)
|
||||
print(f"metadata for: {network_weight}: {metadata}")
|
||||
if metadata is not None:
|
||||
print(f"metadata for: {network_weight}: {metadata}")
|
||||
|
||||
network.load_weights(network_weight)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user