diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.py index a60ca307b..ccdee1886 100644 --- a/comfy/ldm/modules/diffusionmodules/model.py +++ b/comfy/ldm/modules/diffusionmodules/model.py @@ -218,7 +218,7 @@ def xformers_attention(q, k, v): try: out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=None) out = out.transpose(1, 2).reshape(B, C, H, W) - except NotImplementedError as e: + except NotImplementedError: out = slice_attention(q.view(B, -1, C), k.view(B, -1, C).transpose(1, 2), v.view(B, -1, C).transpose(1, 2)).reshape(B, C, H, W) return out @@ -233,7 +233,7 @@ def pytorch_attention(q, k, v): try: out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, dropout_p=0.0, is_causal=False) out = out.transpose(2, 3).reshape(B, C, H, W) - except model_management.OOM_EXCEPTION as e: + except model_management.OOM_EXCEPTION: logging.warning("scaled_dot_product_attention OOMed: switched to slice attention") out = slice_attention(q.view(B, -1, C), k.view(B, -1, C).transpose(1, 2), v.view(B, -1, C).transpose(1, 2)).reshape(B, C, H, W) return out diff --git a/comfy/sd.py b/comfy/sd.py index ebae7f996..88024a271 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -435,7 +435,7 @@ class VAE: if pixel_samples is None: pixel_samples = torch.empty((samples_in.shape[0],) + tuple(out.shape[1:]), device=self.output_device) pixel_samples[x:x+batch_number] = out - except model_management.OOM_EXCEPTION as e: + except model_management.OOM_EXCEPTION: logging.warning("Warning: Ran out of memory when regular VAE decoding, retrying with tiled VAE decoding.") dims = samples_in.ndim - 2 if dims == 1: @@ -490,7 +490,7 @@ class VAE: 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 as e: + except model_management.OOM_EXCEPTION: logging.warning("Warning: Ran out of memory when regular VAE encoding, retrying with tiled VAE encoding.") if len(pixel_samples.shape) == 3: samples = self.encode_tiled_1d(pixel_samples) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index a454f3bb3..a9de659bd 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -382,7 +382,7 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No embed_out = safe_load_embed_zip(embed_path) else: embed = torch.load(embed_path, map_location="cpu") - except Exception as e: + except Exception: logging.warning("{}\n\nerror loading embedding, skipping loading: {}".format(traceback.format_exc(), embedding_name)) return None diff --git a/fix_torch.py b/fix_torch.py index 4aecb23f0..25fabe211 100644 --- a/fix_torch.py +++ b/fix_torch.py @@ -23,6 +23,6 @@ def fix_pytorch_libomp(): break try: mydll = ctypes.cdll.LoadLibrary(test_file) - except FileNotFoundError as e: + except FileNotFoundError: logging.warning("Detected pytorch version with libomp issue, patching.") shutil.copyfile(os.path.join(lib_folder, "libiomp5md.dll"), dest) diff --git a/server.py b/server.py index 5e86558d4..7345d0f2a 100644 --- a/server.py +++ b/server.py @@ -561,7 +561,7 @@ class PromptServer(): for x in nodes.NODE_CLASS_MAPPINGS: try: out[x] = node_info(x) - except Exception as e: + except Exception: logging.error(f"[ERROR] An error occurred while retrieving information for the '{x}' node.") logging.error(traceback.format_exc()) return web.json_response(out) @@ -829,7 +829,7 @@ class PromptServer(): for handler in self.on_prompt_handlers: try: json_data = handler(json_data) - except Exception as e: + except Exception: logging.warning(f"[ERROR] An error occurred during the on_prompt_handler processing") logging.warning(traceback.format_exc())