Revert "Fix ruff linter (#137)" (#143)

This reverts commit 6b3ad64388.
This commit is contained in:
Chenlei Hu
2024-02-09 02:24:04 +00:00
committed by GitHub
parent b49742354d
commit 388ca351f4
18 changed files with 39 additions and 25 deletions

View File

@@ -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.")

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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