mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-01-26 02:14:18 +01:00
Lint
This commit is contained in:
parent
30d1f502aa
commit
822e74ac97
|
|
@ -1678,6 +1678,6 @@ button:focus {
|
|||
button#swap-height-width {
|
||||
position: absolute;
|
||||
top: -50px;
|
||||
right: 0px;
|
||||
right: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
# modules/image_model_settings.py
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
|
@ -7,7 +5,6 @@ import yaml
|
|||
import modules.shared as shared
|
||||
from modules.logging_colors import logger
|
||||
|
||||
|
||||
DEFAULTS = {
|
||||
'model_name': 'None',
|
||||
'dtype': 'bfloat16',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# modules/image_models.py
|
||||
import time
|
||||
|
||||
import torch
|
||||
|
||||
import modules.shared as shared
|
||||
from modules.logging_colors import logger
|
||||
from modules.utils import resolve_model_path
|
||||
from modules.torch_utils import get_device
|
||||
from modules.utils import resolve_model_path
|
||||
|
||||
|
||||
def load_image_model(model_name, dtype='bfloat16', attn_backend='sdpa', cpu_offload=False, compile_model=False):
|
||||
|
|
@ -56,7 +56,7 @@ def load_image_model(model_name, dtype='bfloat16', attn_backend='sdpa', cpu_offl
|
|||
shared.image_model = pipe
|
||||
shared.image_model_name = model_name
|
||||
|
||||
logger.info(f"Loaded image model \"{model_name}\" in {(time.time()-t0):.2f} seconds.")
|
||||
logger.info(f"Loaded image model \"{model_name}\" in {(time.time() - t0):.2f} seconds.")
|
||||
return pipe
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -73,9 +73,7 @@ def unload_image_model():
|
|||
shared.image_model = None
|
||||
shared.image_model_name = 'None'
|
||||
|
||||
# Clear CUDA cache
|
||||
if torch.cuda.is_available():
|
||||
|
||||
torch.cuda.empty_cache()
|
||||
from modules.torch_utils import clear_torch_cache
|
||||
clear_torch_cache()
|
||||
|
||||
logger.info("Image model unloaded.")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
# modules/ui_image_generation.py
|
||||
import os
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
|
|
@ -9,9 +8,11 @@ import numpy as np
|
|||
import torch
|
||||
|
||||
from modules import shared, utils
|
||||
from modules.image_model_settings import (
|
||||
get_effective_settings,
|
||||
save_image_model_settings
|
||||
)
|
||||
from modules.image_models import load_image_model, unload_image_model
|
||||
from modules.image_model_settings import get_effective_settings, save_image_model_settings
|
||||
|
||||
|
||||
# Aspect ratio definitions: name -> (width_ratio, height_ratio)
|
||||
ASPECT_RATIOS = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue