mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-03-01 19:19:52 +00:00
@@ -71,6 +71,7 @@ def no_clip():
|
||||
|
||||
|
||||
def load_checkpoint_guess_config(sd, output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True):
|
||||
sd_keys = sd.keys()
|
||||
clip = None
|
||||
clipvision = None
|
||||
vae = None
|
||||
@@ -98,6 +99,7 @@ def load_checkpoint_guess_config(sd, output_vae=True, output_clip=True, output_c
|
||||
|
||||
if output_model:
|
||||
inital_load_device = model_management.unet_inital_load_device(parameters, unet_dtype)
|
||||
offload_device = model_management.unet_offload_device()
|
||||
model = model_config.get_model(sd, "model.diffusion_model.", device=inital_load_device)
|
||||
model.load_model_weights(sd, "model.diffusion_model.")
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ def initialize_forge():
|
||||
for bad in bad_list:
|
||||
if bad in sys.argv:
|
||||
print(f'Arg {bad} is removed in Forge.')
|
||||
print('Now memory management is fully automatic and you do not need any command flags.')
|
||||
print('Please just remove this flag.')
|
||||
print('In extreme cases, if you want to force previous lowvram/medvram behaviors, '
|
||||
'please use --always-offload-from-vram')
|
||||
print(f'Now memory management is fully automatic and you do not need any command flags.')
|
||||
print(f'Please just remove this flag.')
|
||||
print(f'In extreme cases, if you want to force previous lowvram/medvram behaviors, '
|
||||
f'please use --always-offload-from-vram')
|
||||
|
||||
from ldm_patched.modules import args_parser
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import time
|
||||
import torch
|
||||
import contextlib
|
||||
from ldm_patched.modules import model_management
|
||||
from ldm_patched.modules.ops import use_patched_ops
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
||||
@@ -29,8 +29,8 @@ def build_loaded(module, loader_name):
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
exp += f'Forge has tried to move the corrupted file to {corrupted_backup_file} \n'
|
||||
exp += 'You may try again now and Forge will download models again. \n'
|
||||
raise ValueError(exp) from e
|
||||
exp += f'You may try again now and Forge will download models again. \n'
|
||||
raise ValueError(exp)
|
||||
return result
|
||||
|
||||
setattr(module, loader_name, loader)
|
||||
|
||||
@@ -34,7 +34,7 @@ def try_load_supported_control_model(ckpt_path):
|
||||
global supported_control_models
|
||||
state_dict = ldm_patched.modules.utils.load_torch_file(ckpt_path, safe_load=True)
|
||||
for supported_type in supported_control_models:
|
||||
state_dict_copy = dict(state_dict)
|
||||
state_dict_copy = {k: v for k, v in state_dict.items()}
|
||||
model = supported_type.try_build_from_state_dict(state_dict_copy, ckpt_path)
|
||||
if model is not None:
|
||||
return model
|
||||
|
||||
Reference in New Issue
Block a user