mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-01-05 08:10:07 +01:00
Make portable builds functional again after b3666e140d
This commit is contained in:
parent
6291e72129
commit
9d07d3a229
|
|
@ -2,7 +2,6 @@ import time
|
|||
|
||||
import modules.shared as shared
|
||||
from modules.logging_colors import logger
|
||||
from modules.torch_utils import get_device
|
||||
from modules.utils import resolve_model_path
|
||||
|
||||
|
||||
|
|
@ -82,6 +81,8 @@ def load_image_model(model_name, dtype='bfloat16', attn_backend='sdpa', cpu_offl
|
|||
import torch
|
||||
from diffusers import DiffusionPipeline
|
||||
|
||||
from modules.torch_utils import get_device
|
||||
|
||||
logger.info(f"Loading image model \"{model_name}\" with quantization: {quant_method}")
|
||||
t0 = time.time()
|
||||
|
||||
|
|
|
|||
|
|
@ -280,25 +280,26 @@ def list_interface_input_elements():
|
|||
'include_past_attachments',
|
||||
]
|
||||
|
||||
# Image generation elements
|
||||
elements += [
|
||||
'image_prompt',
|
||||
'image_neg_prompt',
|
||||
'image_width',
|
||||
'image_height',
|
||||
'image_aspect_ratio',
|
||||
'image_steps',
|
||||
'image_cfg_scale',
|
||||
'image_seed',
|
||||
'image_batch_size',
|
||||
'image_batch_count',
|
||||
'image_model_menu',
|
||||
'image_dtype',
|
||||
'image_attn_backend',
|
||||
'image_compile',
|
||||
'image_cpu_offload',
|
||||
'image_quant',
|
||||
]
|
||||
if not shared.args.portable:
|
||||
# Image generation elements
|
||||
elements += [
|
||||
'image_prompt',
|
||||
'image_neg_prompt',
|
||||
'image_width',
|
||||
'image_height',
|
||||
'image_aspect_ratio',
|
||||
'image_steps',
|
||||
'image_cfg_scale',
|
||||
'image_seed',
|
||||
'image_batch_size',
|
||||
'image_batch_count',
|
||||
'image_model_menu',
|
||||
'image_dtype',
|
||||
'image_attn_backend',
|
||||
'image_compile',
|
||||
'image_cpu_offload',
|
||||
'image_quant',
|
||||
]
|
||||
|
||||
return elements
|
||||
|
||||
|
|
@ -531,25 +532,29 @@ def setup_auto_save():
|
|||
'paste_to_attachment',
|
||||
'include_past_attachments',
|
||||
|
||||
# Image generation tab (ui_image_generation.py)
|
||||
'image_prompt',
|
||||
'image_neg_prompt',
|
||||
'image_width',
|
||||
'image_height',
|
||||
'image_aspect_ratio',
|
||||
'image_steps',
|
||||
'image_cfg_scale',
|
||||
'image_seed',
|
||||
'image_batch_size',
|
||||
'image_batch_count',
|
||||
'image_model_menu',
|
||||
'image_dtype',
|
||||
'image_attn_backend',
|
||||
'image_compile',
|
||||
'image_cpu_offload',
|
||||
'image_quant',
|
||||
]
|
||||
|
||||
if not shared.args.portable:
|
||||
# Image generation tab (ui_image_generation.py)
|
||||
change_elements += [
|
||||
'image_prompt',
|
||||
'image_neg_prompt',
|
||||
'image_width',
|
||||
'image_height',
|
||||
'image_aspect_ratio',
|
||||
'image_steps',
|
||||
'image_cfg_scale',
|
||||
'image_seed',
|
||||
'image_batch_size',
|
||||
'image_batch_count',
|
||||
'image_model_menu',
|
||||
'image_dtype',
|
||||
'image_attn_backend',
|
||||
'image_compile',
|
||||
'image_cpu_offload',
|
||||
'image_quant',
|
||||
]
|
||||
|
||||
for element_name in change_elements:
|
||||
if element_name in shared.gradio:
|
||||
shared.gradio[element_name].change(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ from modules.image_models import (
|
|||
)
|
||||
from modules.logging_colors import logger
|
||||
from modules.text_generation import stop_everything_event
|
||||
from modules.torch_utils import get_device
|
||||
from modules.utils import gradio
|
||||
|
||||
ASPECT_RATIOS = {
|
||||
|
|
@ -667,7 +666,7 @@ def generate(state):
|
|||
"""
|
||||
import torch
|
||||
|
||||
from modules.torch_utils import clear_torch_cache
|
||||
from modules.torch_utils import clear_torch_cache, get_device
|
||||
|
||||
clear_torch_cache()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue