mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
Added memory clearance after deletion
This commit is contained in:
parent
ff1609f91e
commit
44db35fb1a
@ -1,3 +1,5 @@
|
|||||||
|
import gc
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.nn.functional import silu
|
from torch.nn.functional import silu
|
||||||
from types import MethodType
|
from types import MethodType
|
||||||
@ -190,7 +192,9 @@ class StableDiffusionModelHijack:
|
|||||||
delattr(m.model.diffusion_model.output_blocks[0][1].transformer_blocks,i)
|
delattr(m.model.diffusion_model.output_blocks[0][1].transformer_blocks,i)
|
||||||
delattr(m.model.diffusion_model.output_blocks[1][1].transformer_blocks,i)
|
delattr(m.model.diffusion_model.output_blocks[1][1].transformer_blocks,i)
|
||||||
delattr(m.model.diffusion_model.output_blocks[4][1].transformer_blocks,'1')
|
delattr(m.model.diffusion_model.output_blocks[4][1].transformer_blocks,'1')
|
||||||
delattr(m.model.diffusion_model.output_blocks[5][1].transformer_blocks,'1')
|
delattr(m.model.diffusion_model.output_blocks[5][1].transformer_blocks,'1')
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
def hijack(self, m):
|
def hijack(self, m):
|
||||||
conditioner = getattr(m, 'conditioner', None)
|
conditioner = getattr(m, 'conditioner', None)
|
||||||
|
Loading…
Reference in New Issue
Block a user