mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-23 12:50:18 +08:00
refactor magic numbers with tile variable references
Fixed the tile variable usage to replace magic numbers with tile variable references.
This commit is contained in:
parent
9126c0cfe4
commit
067f88d9af
@ -49,18 +49,18 @@ class ImageUpscaleWithModel:
|
|||||||
|
|
||||||
def upscale(self, upscale_model, image):
|
def upscale(self, upscale_model, image):
|
||||||
device = model_management.get_torch_device()
|
device = model_management.get_torch_device()
|
||||||
|
|
||||||
|
tile = 512
|
||||||
|
overlap = 32
|
||||||
|
|
||||||
memory_required = model_management.module_size(upscale_model.model)
|
memory_required = model_management.module_size(upscale_model.model)
|
||||||
memory_required += (512 * 512 * 3) * image.element_size() * max(upscale_model.scale, 1.0) * 384.0 #The 384.0 is an estimate of how much some of these models take, TODO: make it more accurate
|
memory_required += (tile * tile * 3) * image.element_size() * max(upscale_model.scale, 1.0) * 384.0 #The 384.0 is an estimate of how much some of these models take, TODO: make it more accurate
|
||||||
memory_required += image.nelement() * image.element_size()
|
memory_required += image.nelement() * image.element_size()
|
||||||
model_management.free_memory(memory_required, device)
|
model_management.free_memory(memory_required, device)
|
||||||
|
|
||||||
upscale_model.to(device)
|
upscale_model.to(device)
|
||||||
in_img = image.movedim(-1,-3).to(device)
|
in_img = image.movedim(-1,-3).to(device)
|
||||||
|
|
||||||
tile = 512
|
|
||||||
overlap = 32
|
|
||||||
|
|
||||||
oom = True
|
oom = True
|
||||||
while oom:
|
while oom:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user