delete the field that is preventing the model from being unloaded and is causing increased RAM usage

This commit is contained in:
AUTOMATIC1111 2023-07-30 19:36:24 +03:00
parent 02038036ff
commit 0af4127fd1

View File

@ -1076,11 +1076,15 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
current = shared.sd_model.sd_checkpoint_info current = shared.sd_model.sd_checkpoint_info
try: try:
if self.hr_checkpoint_info is not None: if self.hr_checkpoint_info is not None:
del self.sampler
sd_models.reload_model_weights(info=self.hr_checkpoint_info) sd_models.reload_model_weights(info=self.hr_checkpoint_info)
devices.torch_gc()
return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts) return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
finally: finally:
del self.sampler
sd_models.reload_model_weights(info=current) sd_models.reload_model_weights(info=current)
devices.torch_gc()
def sample_hr_pass(self, samples, decoded_samples, seeds, subseeds, subseed_strength, prompts): def sample_hr_pass(self, samples, decoded_samples, seeds, subseeds, subseed_strength, prompts):
self.is_hr_pass = True self.is_hr_pass = True