mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 14:50:49 +08:00
vae handle HIP OOM exceptions
This commit is contained in:
parent
1883e70b43
commit
6b58f6bd5a
@ -235,6 +235,14 @@ try:
|
||||
except:
|
||||
OOM_EXCEPTION = Exception
|
||||
|
||||
|
||||
def is_oom_exception(ex):
|
||||
if isinstance(ex, OOM_EXCEPTION):
|
||||
return True
|
||||
# handle also other kinds of oom, e.g. "HIP error: out of memory"
|
||||
msg = str(ex)
|
||||
return "out of memory" in msg
|
||||
|
||||
XFORMERS_VERSION = ""
|
||||
XFORMERS_ENABLED_VAE = True
|
||||
if args.disable_xformers:
|
||||
|
||||
@ -640,8 +640,9 @@ class VAE:
|
||||
if samples is None:
|
||||
samples = torch.empty((pixel_samples.shape[0],) + tuple(out.shape[1:]), device=self.output_device)
|
||||
samples[x:x + batch_number] = out
|
||||
|
||||
except model_management.OOM_EXCEPTION:
|
||||
except Exception as ex:
|
||||
if not model_management.is_oom_exception(ex):
|
||||
raise
|
||||
logging.warning("Warning: Ran out of memory when regular VAE encoding, retrying with tiled VAE encoding.")
|
||||
if self.latent_dim == 3:
|
||||
tile = 256
|
||||
|
||||
Loading…
Reference in New Issue
Block a user