Fooocus GitHub Bot Commit

This commit is generated by a GitHub bot of Fooocus
This commit is contained in:
lllyasviel
2023-11-12 13:12:03 -08:00
parent ac8002d2a4
commit 7e222cf3e1
8 changed files with 28 additions and 36 deletions
+10
View File
@@ -157,6 +157,16 @@ class BaseModel(torch.nn.Module):
def set_inpaint(self):
self.inpaint_model = True
def memory_required(self, input_shape):
area = input_shape[0] * input_shape[2] * input_shape[3]
if fcbh.model_management.xformers_enabled() or fcbh.model_management.pytorch_attention_flash_attention():
#TODO: this needs to be tweaked
return (area / (fcbh.model_management.dtype_size(self.get_dtype()) * 10)) * (1024 * 1024)
else:
#TODO: this formula might be too aggressive since I tweaked the sub-quad and split algorithms to use less memory.
return (((area * 0.6) / 0.9) + 1024) * (1024 * 1024)
def unclip_adm(unclip_conditioning, device, noise_augmentor, noise_augment_merge=0.0):
adm_inputs = []
weights = []