mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 20:57:58 +00:00
added stuff to diffusers
This commit is contained in:
parent
9d1f734d74
commit
8049b42091
@ -19,6 +19,16 @@ from lollms.utilities import git_pull
|
||||
from tqdm import tqdm
|
||||
import threading
|
||||
|
||||
import pipmaster as pm
|
||||
if not pm.is_installed("torch"):
|
||||
pm.install_or_update("torch torchvision torchaudio", "https://download.pytorch.org/whl/cu121")
|
||||
|
||||
import torch
|
||||
if not torch.cuda.is_available():
|
||||
pm.install_or_update("torch torchvision torchaudio", "https://download.pytorch.org/whl/cu121")
|
||||
|
||||
|
||||
|
||||
def adjust_dimensions(value: int) -> int:
|
||||
"""Adjusts the given value to be divisible by 8."""
|
||||
return (value // 8) * 8
|
||||
@ -152,10 +162,13 @@ class LollmsDiffusers(LollmsTTI):
|
||||
# use_safetensors=True,
|
||||
# ) # app.config.diffusers_model
|
||||
# Enable memory optimizations.
|
||||
try:
|
||||
if app.config.diffusers_offloading_mode=="sequential_cpu_offload":
|
||||
self.model.enable_sequential_cpu_offload()
|
||||
elif app.coinfig.diffusers_offloading_mode=="model_cpu_offload":
|
||||
self.model.enable_model_cpu_offload()
|
||||
except:
|
||||
pass
|
||||
except Exception as ex:
|
||||
self.model= None
|
||||
trace_exception(ex)
|
||||
@ -221,8 +234,8 @@ class LollmsDiffusers(LollmsTTI):
|
||||
sc = self.get_scheduler_by_name(sampler_name)
|
||||
if sc:
|
||||
self.model.scheduler = sc
|
||||
width = adjust_dimensions(width)
|
||||
height = adjust_dimensions(height)
|
||||
width = adjust_dimensions(int(width))
|
||||
height = adjust_dimensions(int(height))
|
||||
if output_path is None:
|
||||
output_path = self.output_dir
|
||||
if seed!=-1:
|
||||
|
Loading…
Reference in New Issue
Block a user