mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
Revert SD_LORA_DIFFUSERS
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import torch
|
||||
import networks
|
||||
from modules import patches, shared
|
||||
@@ -19,7 +18,7 @@ class LoraPatches:
|
||||
self.MultiheadAttention_load_state_dict = None
|
||||
|
||||
def apply(self):
|
||||
if self.active or os.environ.get('SD_LORA_DIFFUSERS', None): # OpenVINO only works with Diffusers LoRa loading
|
||||
if self.active or (shared.opts.cuda_compile and shared.opts.cuda_compile_backend == "openvino_fx"): # OpenVINO only works with Diffusers LoRa loading
|
||||
return
|
||||
self.Linear_forward = patches.patch(__name__, torch.nn.Linear, 'forward', networks.network_Linear_forward)
|
||||
self.Linear_load_state_dict = patches.patch(__name__, torch.nn.Linear, '_load_from_state_dict', networks.network_Linear_load_state_dict)
|
||||
@@ -37,7 +36,7 @@ class LoraPatches:
|
||||
self.active = True
|
||||
|
||||
def undo(self):
|
||||
if not self.active or os.environ.get('SD_LORA_DIFFUSERS', None): # OpenVINO only works with Diffusers LoRa loading
|
||||
if not self.active or (shared.opts.cuda_compile and shared.opts.cuda_compile_backend == "openvino_fx"): # OpenVINO only works with Diffusers LoRa loading
|
||||
return
|
||||
self.Linear_forward = patches.undo(__name__, torch.nn.Linear, 'forward') # pylint: disable=E1128
|
||||
self.Linear_load_state_dict = patches.undo(__name__, torch.nn.Linear, '_load_from_state_dict') # pylint: disable=E1128
|
||||
|
||||
@@ -166,10 +166,12 @@ def load_networks(names, te_multipliers=None, unet_multipliers=None, dyn_dims=No
|
||||
try:
|
||||
if recompile_model:
|
||||
shared.compiled_model_state.lora_model.append(f"{name}:{te_multipliers[i] if te_multipliers else 1.0}")
|
||||
if shared.backend == shared.Backend.DIFFUSERS and (os.environ.get('SD_LORA_DIFFUSERS', None) # OpenVINO only works with Diffusers LoRa loading.
|
||||
if shared.backend == shared.Backend.DIFFUSERS and (os.environ.get('SD_LORA_DIFFUSERS', None)
|
||||
or getattr(network_on_disk, 'shorthash', '').lower() == 'aaebf6360f7d' # sd15-lcm
|
||||
or getattr(network_on_disk, 'shorthash', '').lower() == '3d18b05e4f56' # sdxl-lcm
|
||||
or getattr(network_on_disk, 'shorthash', '').lower() == '813ea5fb1c67'): # turbo sdxl-turbo
|
||||
or getattr(network_on_disk, 'shorthash', '').lower() == '813ea5fb1c67' # turbo sdxl-turbo
|
||||
or (shared.opts.cuda_compile and shared.opts.cuda_compile_backend == "openvino_fx")):
|
||||
# OpenVINO only works with Diffusers LoRa loading.
|
||||
net = load_diffusers(name, network_on_disk, lora_scale=te_multipliers[i] if te_multipliers else 1.0)
|
||||
else:
|
||||
net = load_network(name, network_on_disk)
|
||||
|
||||
@@ -518,7 +518,6 @@ def check_torch():
|
||||
install('openvino==2023.2.0', 'openvino')
|
||||
install('onnxruntime-openvino', 'onnxruntime-openvino', ignore=True) # TODO openvino: numpy version conflicts with tensorflow and doesn't support Python 3.11
|
||||
os.environ.setdefault('PYTORCH_TRACING_MODE', 'TORCHFX')
|
||||
os.environ.setdefault('SD_LORA_DIFFUSERS', '1')
|
||||
os.environ.setdefault('NEOReadDebugKeys', '1')
|
||||
os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100')
|
||||
if args.profile:
|
||||
|
||||
Reference in New Issue
Block a user