Fixed issue with meta.
This commit is contained in:
parent
e4de8983c9
commit
18077ba265
|
|
@ -13,7 +13,7 @@ import argparse
|
|||
|
||||
from toolkit.lycoris_utils import extract_diff
|
||||
from toolkit.config import get_config
|
||||
from toolkit.metadata import create_meta
|
||||
from toolkit.metadata import create_meta, prep_meta_for_safetensors
|
||||
from toolkit.kohya_model_util import load_models_from_stable_diffusion_checkpoint
|
||||
|
||||
import torch
|
||||
|
|
@ -141,8 +141,7 @@ def main():
|
|||
os.makedirs(output_folder, exist_ok=True)
|
||||
|
||||
# having issues with meta
|
||||
save_file(state_dict, output_path)
|
||||
# save_file(state_dict, output_path, {'meta': json.dumps(save_meta, indent=4)})
|
||||
save_file(state_dict, output_path, prep_meta_for_safetensors(save_meta))
|
||||
|
||||
print(f"Saved to {output_path}")
|
||||
|
||||
|
|
|
|||
|
|
@ -22,3 +22,11 @@ def create_meta(dict_list, name=None):
|
|||
if name is not None:
|
||||
meta_string = meta_string.replace("[name]", name)
|
||||
return json.loads(meta_string)
|
||||
|
||||
|
||||
def prep_meta_for_safetensors(meta):
|
||||
# safetensors can only be one level deep
|
||||
for key, value in meta.items():
|
||||
if isinstance(value, dict):
|
||||
meta[key] = json.dumps(value)
|
||||
return meta
|
||||
|
|
|
|||
Loading…
Reference in New Issue