remove variables

This commit is contained in:
Vladimir Mandic
2023-03-21 16:29:28 -04:00
parent b58b55aac5
commit 6f0f72c7c9
4 changed files with 82 additions and 10 deletions
+1 -1
View File
@@ -204,7 +204,7 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
if bake_in_vae_filename is not None:
print(f"Baking in VAE from {bake_in_vae_filename}")
shared.state.textinfo = 'Baking in VAE'
vae_dict = sd_vae.load_vae_dict(bake_in_vae_filename, map_location='cpu')
vae_dict = sd_vae.load_vae_dict(bake_in_vae_filename)
for key in vae_dict.keys():
theta_0_key = 'first_stage_model.' + key
+2 -6
View File
@@ -238,7 +238,7 @@ def read_metadata_from_safetensors(filename):
return res
def read_state_dict(checkpoint_file, print_global_state=False, map_location=None):
def read_state_dict(checkpoint_file):
_, extension = os.path.splitext(checkpoint_file)
with rich.progress.open(checkpoint_file, 'rb') as f:
if extension.lower() == ".safetensors":
@@ -247,14 +247,10 @@ def read_state_dict(checkpoint_file, print_global_state=False, map_location=None
pl_sd = safetensors.torch.load(buffer)
elif extension.lower() == ".ckpt":
buffer = io.BytesIO(f.read())
# map_location is mostly superfluous as its always None or `cpu`, bue keeping for backwads compatibility
pl_sd = torch.load(buffer, map_location)
pl_sd = torch.load(buffer)
else:
raise Exception(f"Unknown model type: {extension}")
if print_global_state and "global_step" in pl_sd:
print(f"Global Step: {pl_sd['global_step']}")
sd = get_state_dict_from_checkpoint(pl_sd)
return sd
+2 -2
View File
@@ -119,8 +119,8 @@ def resolve_vae(checkpoint_file):
return None, None
def load_vae_dict(filename, map_location):
vae_ckpt = sd_models.read_state_dict(filename, map_location=map_location)
def load_vae_dict(filename):
vae_ckpt = sd_models.read_state_dict(filename)
vae_dict_1 = {k: v for k, v in vae_ckpt.items() if k[0:4] != "loss" and k not in vae_ignore_keys}
return vae_dict_1
+77 -1
View File
@@ -1457,5 +1457,81 @@
"customscript/movie2movie.py/txt2img/Save preprocessed/visible": true,
"customscript/movie2movie.py/txt2img/Save preprocessed/value": false,
"customscript/movie2movie.py/img2img/Save preprocessed/visible": true,
"customscript/movie2movie.py/img2img/Save preprocessed/value": false
"customscript/movie2movie.py/img2img/Save preprocessed/value": false,
"customscript/seed_travel.py/txt2img/Destination seeds/visible": true,
"customscript/seed_travel.py/txt2img/Destination seeds/value": "",
"customscript/seed_travel.py/txt2img/Use random seeds/visible": true,
"customscript/seed_travel.py/txt2img/Use random seeds/value": false,
"customscript/seed_travel.py/txt2img/Number of random seeds/visible": true,
"customscript/seed_travel.py/txt2img/Number of random seeds/value": 4.0,
"customscript/seed_travel.py/txt2img/Steps/visible": true,
"customscript/seed_travel.py/txt2img/Steps/value": 10.0,
"customscript/seed_travel.py/txt2img/FPS/visible": true,
"customscript/seed_travel.py/txt2img/FPS/value": 30.0,
"customscript/seed_travel.py/txt2img/Lead in/out/visible": true,
"customscript/seed_travel.py/txt2img/Lead in/out/value": 0.0,
"customscript/seed_travel.py/txt2img/SSIM threshold/visible": true,
"customscript/seed_travel.py/txt2img/SSIM threshold/value": 0.0,
"customscript/seed_travel.py/txt2img/SSIM threshold/minimum": 0.0,
"customscript/seed_travel.py/txt2img/SSIM threshold/maximum": 1.0,
"customscript/seed_travel.py/txt2img/SSIM threshold/step": 0.01,
"customscript/seed_travel.py/txt2img/SSIM CenterCrop%/visible": true,
"customscript/seed_travel.py/txt2img/SSIM CenterCrop%/value": 0,
"customscript/seed_travel.py/txt2img/SSIM CenterCrop%/minimum": 0,
"customscript/seed_travel.py/txt2img/SSIM CenterCrop%/maximum": 100,
"customscript/seed_travel.py/txt2img/SSIM CenterCrop%/step": 1,
"customscript/seed_travel.py/txt2img/Allow default sampler/visible": true,
"customscript/seed_travel.py/txt2img/Allow default sampler/value": false,
"customscript/seed_travel.py/txt2img/Compare paths/visible": true,
"customscript/seed_travel.py/txt2img/Compare paths/value": false,
"customscript/seed_travel.py/txt2img/Bump seed/visible": true,
"customscript/seed_travel.py/txt2img/Bump seed/value": 0.0,
"customscript/seed_travel.py/txt2img/Bump seed/minimum": 0,
"customscript/seed_travel.py/txt2img/Bump seed/maximum": 0.5,
"customscript/seed_travel.py/txt2img/Bump seed/step": 0.001,
"customscript/seed_travel.py/txt2img/SSIM min substep/visible": true,
"customscript/seed_travel.py/txt2img/SSIM min substep/value": 0.001,
"customscript/seed_travel.py/txt2img/SSIM min threshold/visible": true,
"customscript/seed_travel.py/txt2img/SSIM min threshold/value": 75,
"customscript/seed_travel.py/txt2img/SSIM min threshold/minimum": 0,
"customscript/seed_travel.py/txt2img/SSIM min threshold/maximum": 100,
"customscript/seed_travel.py/txt2img/SSIM min threshold/step": 1,
"customscript/seed_travel.py/img2img/Destination seeds/visible": true,
"customscript/seed_travel.py/img2img/Destination seeds/value": "",
"customscript/seed_travel.py/img2img/Use random seeds/visible": true,
"customscript/seed_travel.py/img2img/Use random seeds/value": false,
"customscript/seed_travel.py/img2img/Number of random seeds/visible": true,
"customscript/seed_travel.py/img2img/Number of random seeds/value": 4.0,
"customscript/seed_travel.py/img2img/Steps/visible": true,
"customscript/seed_travel.py/img2img/Steps/value": 10.0,
"customscript/seed_travel.py/img2img/FPS/visible": true,
"customscript/seed_travel.py/img2img/FPS/value": 30.0,
"customscript/seed_travel.py/img2img/Lead in/out/visible": true,
"customscript/seed_travel.py/img2img/Lead in/out/value": 0.0,
"customscript/seed_travel.py/img2img/SSIM threshold/visible": true,
"customscript/seed_travel.py/img2img/SSIM threshold/value": 0.0,
"customscript/seed_travel.py/img2img/SSIM threshold/minimum": 0.0,
"customscript/seed_travel.py/img2img/SSIM threshold/maximum": 1.0,
"customscript/seed_travel.py/img2img/SSIM threshold/step": 0.01,
"customscript/seed_travel.py/img2img/SSIM CenterCrop%/visible": true,
"customscript/seed_travel.py/img2img/SSIM CenterCrop%/value": 0,
"customscript/seed_travel.py/img2img/SSIM CenterCrop%/minimum": 0,
"customscript/seed_travel.py/img2img/SSIM CenterCrop%/maximum": 100,
"customscript/seed_travel.py/img2img/SSIM CenterCrop%/step": 1,
"customscript/seed_travel.py/img2img/Allow default sampler/visible": true,
"customscript/seed_travel.py/img2img/Allow default sampler/value": false,
"customscript/seed_travel.py/img2img/Compare paths/visible": true,
"customscript/seed_travel.py/img2img/Compare paths/value": false,
"customscript/seed_travel.py/img2img/Bump seed/visible": true,
"customscript/seed_travel.py/img2img/Bump seed/value": 0.0,
"customscript/seed_travel.py/img2img/Bump seed/minimum": 0,
"customscript/seed_travel.py/img2img/Bump seed/maximum": 0.5,
"customscript/seed_travel.py/img2img/Bump seed/step": 0.001,
"customscript/seed_travel.py/img2img/SSIM min substep/visible": true,
"customscript/seed_travel.py/img2img/SSIM min substep/value": 0.001,
"customscript/seed_travel.py/img2img/SSIM min threshold/visible": true,
"customscript/seed_travel.py/img2img/SSIM min threshold/value": 75,
"customscript/seed_travel.py/img2img/SSIM min threshold/minimum": 0,
"customscript/seed_travel.py/img2img/SSIM min threshold/maximum": 100,
"customscript/seed_travel.py/img2img/SSIM min threshold/step": 1
}