mirror of
https://github.com/vladmandic/automatic
synced 2026-09-07 05:20:47 +02:00
revert meta
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Change Log for SD.Next
|
||||
|
||||
## Update for 2023-08-09
|
||||
## Update for 2023-08-10
|
||||
|
||||
- diffusers:
|
||||
- **pipeline autodetect**
|
||||
|
||||
@@ -522,6 +522,7 @@ class ModelData:
|
||||
|
||||
model_data = ModelData()
|
||||
|
||||
|
||||
def change_backend():
|
||||
shared.log.info(f'Pipeline changed: {shared.backend}')
|
||||
unload_model_weights()
|
||||
@@ -626,7 +627,7 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No
|
||||
sd_model = None
|
||||
|
||||
try:
|
||||
if shared.cmd_opts.ckpt is not None and model_data.initial: # initial load\
|
||||
if shared.cmd_opts.ckpt is not None and model_data.initial: # initial load
|
||||
ckpt_basename = os.path.basename(shared.cmd_opts.ckpt)
|
||||
model_name = modelloader.find_diffuser(ckpt_basename)
|
||||
if model_name is not None:
|
||||
@@ -800,8 +801,7 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No
|
||||
if op == 'refiner' and shared.opts.diffusers_move_refiner and not sd_model.has_accelerate:
|
||||
shared.log.debug('Moving refiner model to CPU')
|
||||
sd_model.to(devices.cpu)
|
||||
elif not sd_model.has_accelerate:
|
||||
# In offload modes, accelerate will move models around.
|
||||
elif not sd_model.has_accelerate: # In offload modes, accelerate will move models around
|
||||
sd_model.to(devices.device)
|
||||
if op == 'refiner' and base_sent_to_cpu:
|
||||
shared.log.debug('Moving base model back to GPU')
|
||||
@@ -1034,18 +1034,18 @@ def unload_model_weights(op='model'):
|
||||
from modules import sd_hijack
|
||||
if op == 'model' or op == 'dict':
|
||||
if model_data.sd_model:
|
||||
model_data.sd_model.to('meta')
|
||||
model_data.sd_model.to(devices.cpu)
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
sd_hijack.model_hijack.undo_hijack(model_data.sd_model)
|
||||
model_data.sd_model = None
|
||||
shared.log.debug(f'Weights unloaded {op}: {memory_stats()}')
|
||||
shared.log.debug(f'Unload weights {op}: {memory_stats()}')
|
||||
else:
|
||||
if model_data.sd_refiner:
|
||||
model_data.sd_refiner.to('meta')
|
||||
model_data.sd_refiner.to(devices.cpu)
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
sd_hijack.model_hijack.undo_hijack(model_data.sd_refiner)
|
||||
model_data.sd_refiner = None
|
||||
shared.log.debug(f'Weights unloaded {op}: {memory_stats()}')
|
||||
shared.log.debug(f'Unload weights {op}: {memory_stats()}')
|
||||
devices.torch_gc(force=True)
|
||||
|
||||
|
||||
|
||||
@@ -151,6 +151,8 @@ def install_extension_from_url(dirname, url, branch_name, search_text, sort_colu
|
||||
normalized_url = normalize_git_url(url)
|
||||
assert len([x for x in extensions.extensions if normalize_git_url(x.remote) == normalized_url]) == 0, 'Extension with this URL is already installed'
|
||||
tmpdir = os.path.join(paths.data_path, "tmp", dirname)
|
||||
if url.endswith('.git'):
|
||||
url = url.replace('.git', '')
|
||||
try:
|
||||
shutil.rmtree(tmpdir, True)
|
||||
if not branch_name:
|
||||
@@ -175,6 +177,8 @@ def install_extension_from_url(dirname, url, branch_name, search_text, sort_colu
|
||||
run_extension_installer(target_dir)
|
||||
extensions.list_extensions()
|
||||
return [refresh_extensions_list_from_data(search_text, sort_column), html.escape(f"Extension installed: {target_dir} | Restart required")]
|
||||
except Exception as e:
|
||||
shared.log.error(f'Error installing extension: {url} {e}')
|
||||
finally:
|
||||
shutil.rmtree(tmpdir, True)
|
||||
|
||||
|
||||
+1
-1
Submodule wiki updated: 2e5c2a156e...581054504c
Reference in New Issue
Block a user