mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
optimize model loader
This commit is contained in:
Submodule extensions-builtin/sd-extension-steps-animation updated: 9a40ea6ae2...95ebddc2d1
Submodule extensions-builtin/sd-extension-system-info updated: 354478c887...9b07adb37d
Submodule extensions-builtin/seed_travel updated: c43baeeac1...a72c836c57
@@ -86,8 +86,8 @@ def cleanup_models():
|
||||
root_path = script_path
|
||||
src_path = models_path
|
||||
dest_path = os.path.join(models_path, "Stable-diffusion")
|
||||
move_files(src_path, dest_path, ".ckpt")
|
||||
move_files(src_path, dest_path, ".safetensors")
|
||||
# move_files(src_path, dest_path, ".ckpt")
|
||||
# move_files(src_path, dest_path, ".safetensors")
|
||||
src_path = os.path.join(root_path, "ESRGAN")
|
||||
dest_path = os.path.join(models_path, "ESRGAN")
|
||||
move_files(src_path, dest_path)
|
||||
|
||||
+11
-8
@@ -239,14 +239,17 @@ def read_metadata_from_safetensors(filename):
|
||||
|
||||
|
||||
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":
|
||||
buffer = f.read()
|
||||
pl_sd = safetensors.torch.load(buffer)
|
||||
else:
|
||||
buffer = io.BytesIO(f.read())
|
||||
pl_sd = torch.load(buffer, map_location='cpu')
|
||||
if 'v1-5-pruned-emaonly.safetensors' in checkpoint_file:
|
||||
pl_sd = safetensors.torch.load_file(checkpoint_file, device='cpu')
|
||||
else:
|
||||
_, extension = os.path.splitext(checkpoint_file)
|
||||
with rich.progress.open(checkpoint_file, 'rb') as f:
|
||||
if extension.lower() == ".safetensors":
|
||||
buffer = f.read()
|
||||
pl_sd = safetensors.torch.load(buffer)
|
||||
else:
|
||||
buffer = io.BytesIO(f.read())
|
||||
pl_sd = torch.load(buffer, map_location='cpu')
|
||||
|
||||
sd = get_state_dict_from_checkpoint(pl_sd)
|
||||
return sd
|
||||
|
||||
+5
-1
@@ -1533,5 +1533,9 @@
|
||||
"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
|
||||
"customscript/seed_travel.py/img2img/SSIM min threshold/step": 1,
|
||||
"customscript/seed_travel.py/txt2img/Interpolation curve/visible": true,
|
||||
"customscript/seed_travel.py/txt2img/Interpolation curve/value": "Linear",
|
||||
"customscript/seed_travel.py/img2img/Interpolation curve/visible": true,
|
||||
"customscript/seed_travel.py/img2img/Interpolation curve/value": "Linear"
|
||||
}
|
||||
Reference in New Issue
Block a user