fix crashing in saving lora with clipskip

This commit is contained in:
Kohya S
2023-08-08 21:03:16 +09:00
parent 7ea38f90d7
commit 6f80fe17fc
2 changed files with 18 additions and 14 deletions

View File

@@ -215,7 +215,11 @@ def build_metadata(
metadata["modelspec.prediction_type"] = PRED_TYPE_EPSILON
if timesteps is not None:
metadata["modelspec.timestep_range"] = timesteps
if isinstance(timesteps, str) or isinstance(timesteps, int):
timesteps = (timesteps, timesteps)
if len(timesteps) == 1:
timesteps = (timesteps[0], timesteps[0])
metadata["modelspec.timestep_range"] = f"{timesteps[0]},{timesteps[1]}"
else:
del metadata["modelspec.timestep_range"]

View File

@@ -2546,15 +2546,15 @@ def get_sai_model_spec(
lora,
textual_inversion,
timestamp,
title,
reso,
is_stable_diffusion_ckpt,
args.metadata_author,
args.metadata_description,
args.metadata_license,
args.metadata_tags,
timesteps,
args.clip_skip, # None or int
title=title,
reso=reso,
is_stable_diffusion_ckpt=is_stable_diffusion_ckpt,
author=args.metadata_author,
description=args.metadata_description,
license=args.metadata_license,
tags=args.metadata_tags,
timesteps=timesteps,
clip_skip=args.clip_skip, # None or int
)
return metadata