forked from extern/easydiffusion
Fix - reduce the amount of VRAM occupied when the program starts up, this caused a regression and failures on GPUs with 4 gb or less of VRAM
This commit is contained in:
parent
2c861c65d4
commit
06b41aee58
@ -19,7 +19,7 @@
|
|||||||
<div id="container">
|
<div id="container">
|
||||||
<div id="top-nav">
|
<div id="top-nav">
|
||||||
<div id="logo">
|
<div id="logo">
|
||||||
<h1>Stable Diffusion UI <small>v2.4.5 <span id="updateBranchLabel"></span></small></h1>
|
<h1>Stable Diffusion UI <small>v2.4.6 <span id="updateBranchLabel"></span></small></h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="server-status">
|
<div id="server-status">
|
||||||
<div id="server-status-color">●</div>
|
<div id="server-status-color">●</div>
|
||||||
|
@ -118,8 +118,8 @@ def load_model_ckpt():
|
|||||||
model.cdevice = torch.device(thread_data.device)
|
model.cdevice = torch.device(thread_data.device)
|
||||||
model.unet_bs = thread_data.unet_bs
|
model.unet_bs = thread_data.unet_bs
|
||||||
model.turbo = thread_data.turbo
|
model.turbo = thread_data.turbo
|
||||||
if thread_data.device != 'cpu':
|
# if thread_data.device != 'cpu':
|
||||||
model.to(thread_data.device)
|
# model.to(thread_data.device)
|
||||||
#if thread_data.reduced_memory:
|
#if thread_data.reduced_memory:
|
||||||
#model.model1.to("cpu")
|
#model.model1.to("cpu")
|
||||||
#model.model2.to("cpu")
|
#model.model2.to("cpu")
|
||||||
@ -129,11 +129,11 @@ def load_model_ckpt():
|
|||||||
_, _ = modelCS.load_state_dict(sd, strict=False)
|
_, _ = modelCS.load_state_dict(sd, strict=False)
|
||||||
modelCS.eval()
|
modelCS.eval()
|
||||||
modelCS.cond_stage_model.device = torch.device(thread_data.device)
|
modelCS.cond_stage_model.device = torch.device(thread_data.device)
|
||||||
if thread_data.device != 'cpu':
|
# if thread_data.device != 'cpu':
|
||||||
if thread_data.reduced_memory:
|
# if thread_data.reduced_memory:
|
||||||
modelCS.to('cpu')
|
# modelCS.to('cpu')
|
||||||
else:
|
# else:
|
||||||
modelCS.to(thread_data.device) # Preload on device if not already there.
|
# modelCS.to(thread_data.device) # Preload on device if not already there.
|
||||||
thread_data.modelCS = modelCS
|
thread_data.modelCS = modelCS
|
||||||
|
|
||||||
modelFS = instantiate_from_config(config.modelFirstStage)
|
modelFS = instantiate_from_config(config.modelFirstStage)
|
||||||
@ -151,11 +151,11 @@ def load_model_ckpt():
|
|||||||
print(f'Cannot find VAE file: {thread_data.vae_file}{model_extension}')
|
print(f'Cannot find VAE file: {thread_data.vae_file}{model_extension}')
|
||||||
|
|
||||||
modelFS.eval()
|
modelFS.eval()
|
||||||
if thread_data.device != 'cpu':
|
# if thread_data.device != 'cpu':
|
||||||
if thread_data.reduced_memory:
|
# if thread_data.reduced_memory:
|
||||||
modelFS.to('cpu')
|
# modelFS.to('cpu')
|
||||||
else:
|
# else:
|
||||||
modelFS.to(thread_data.device) # Preload on device if not already there.
|
# modelFS.to(thread_data.device) # Preload on device if not already there.
|
||||||
thread_data.modelFS = modelFS
|
thread_data.modelFS = modelFS
|
||||||
del sd
|
del sd
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user