From 29e2118717ba4e8d2fac41fa072866fc5498119c Mon Sep 17 00:00:00 2001 From: kijai Date: Thu, 2 Jul 2026 10:23:17 +0300 Subject: [PATCH] Minor cleanup --- comfy/model_base.py | 1 + comfy/sd.py | 2 -- comfy/supported_models.py | 4 ++-- comfy_extras/mesh3d/postprocess/remesh.py | 2 +- comfy_extras/nodes_mesh_postprocess.py | 7 +++---- comfy_extras/nodes_trellis2.py | 1 - 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 3bcf5bcea..074b298e7 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1920,6 +1920,7 @@ class WAN21_SCAIL(WAN21): pose_latents = kwargs.get("pose_video_latent", None) if pose_latents is not None: out['pose_latents'] = [pose_latents.shape[0], 20, *pose_latents.shape[2:]] + return out class WAN21_SCAIL2(WAN21_SCAIL): diff --git a/comfy/sd.py b/comfy/sd.py index cf8d35a7c..25b972881 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -546,13 +546,11 @@ class VAE: self.latent_channels = 16 elif "shape_dec.blocks.1.16.to_subdiv.weight" in sd: # trellis2 shape vae (struct_dec + shape_dec) self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32] - # TODO self.memory_used_decode = lambda shape, dtype: (2500 * shape[2] * shape[3]) * model_management.dtype_size(dtype) self.memory_used_encode = lambda shape, dtype: (2500 * shape[2] * shape[3]) * model_management.dtype_size(dtype) self.first_stage_model = comfy.ldm.trellis2.vae.ShapeVae() elif "txt_dec.blocks.3.4.conv2.weight" in sd: # trellis2 texture vae self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32] - # TODO self.memory_used_decode = lambda shape, dtype: (2500 * shape[2] * shape[3]) * model_management.dtype_size(dtype) self.memory_used_encode = lambda shape, dtype: (2500 * shape[2] * shape[3]) * model_management.dtype_size(dtype) self.first_stage_model = comfy.ldm.trellis2.vae.TextureVae() diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 69ee9ce5b..fa3818afa 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -2046,7 +2046,6 @@ class Kandinsky5Image(Kandinsky5): return supported_models_base.ClipTarget(comfy.text_encoders.kandinsky5.Kandinsky5TokenizerImage, comfy.text_encoders.kandinsky5.te(**hunyuan_detect)) - class ACEStep15(supported_models_base.BASE): unet_config = { "audio_model": "ace1.5", @@ -2086,6 +2085,7 @@ class ACEStep15(supported_models_base.BASE): return supported_models_base.ClipTarget(comfy.text_encoders.ace15.ACE15Tokenizer, comfy.text_encoders.ace15.te(**detect)) + class LongCatImage(supported_models_base.BASE): unet_config = { "image_model": "flux", @@ -2180,7 +2180,6 @@ class ErnieImage(supported_models_base.BASE): return supported_models_base.ClipTarget(comfy.text_encoders.ernie.ErnieTokenizer, comfy.text_encoders.ernie.te(**hunyuan_detect)) - class SAM3(supported_models_base.BASE): unet_config = {"image_model": "SAM3"} supported_inference_dtypes = [torch.float16, torch.bfloat16, torch.float32] @@ -2300,6 +2299,7 @@ class CogVideoX_Inpaint(CogVideoX_T2V): out = model_base.CogVideoX(self, image_to_video=True, device=device) return out + models = [ LotusD, Stable_Zero123, diff --git a/comfy_extras/mesh3d/postprocess/remesh.py b/comfy_extras/mesh3d/postprocess/remesh.py index 2e20f6254..4cbb867fe 100644 --- a/comfy_extras/mesh3d/postprocess/remesh.py +++ b/comfy_extras/mesh3d/postprocess/remesh.py @@ -402,7 +402,7 @@ def _dual_contour(voxel_coords: torch.Tensor, corner_udf: torch.Tensor, b.add_(centroid_verts, alpha=reg) try: qef_solution = torch.linalg.solve(A, b.unsqueeze(-1)).squeeze(-1) - except Exception: + except torch.linalg.LinAlgError: qef_solution = centroid_verts # Clamp QEF output to the voxel bbox diff --git a/comfy_extras/nodes_mesh_postprocess.py b/comfy_extras/nodes_mesh_postprocess.py index 91465b835..1638560ca 100644 --- a/comfy_extras/nodes_mesh_postprocess.py +++ b/comfy_extras/nodes_mesh_postprocess.py @@ -13,7 +13,6 @@ from comfy_extras.mesh3d.uv_unwrap import mesh as _uv_mesh from comfy_extras.mesh3d.uv_unwrap import segment as _uv_seg from comfy_extras.mesh3d.uv_unwrap import parameterize as _uv_param from comfy_extras.mesh3d.uv_unwrap import pack as _uv_pack -import warnings import logging from tqdm import tqdm from scipy.sparse import csr_matrix @@ -93,7 +92,7 @@ def paint_mesh_with_voxels(mesh, voxel_coords, voxel_colors, resolution): if v_colors.shape[-1] > 3: v_colors = v_colors[:, :3] - srgb_colors = v_colors.clamp(0, 1)#(v_colors * 0.5 + 0.5).clamp(0, 1) + srgb_colors = v_colors.clamp(0, 1) # to Linear RGB (required for GLTF) linear_colors = torch.pow(srgb_colors, 2.2) @@ -2404,8 +2403,8 @@ def _uv_unwrap(positions, indices, segmenter, resolution, padding, weld_distance mesh = _uv_mesh.build_mesh(v_in, f_in) ff = mesh.face_face if ff.numel() and float((ff >= 0).float().mean().item()) < 0.25: - warnings.warn("[uv_unwrap] mesh face-adjacency < 25% — vertices appear un-welded " - "(triangle soup); UV charts will be per-face. Raise weld_distance.") + logging.warning("[uv_unwrap] mesh face-adjacency < 25% — vertices appear un-welded " + "(triangle soup); UV charts will be per-face. Raise weld_distance.") if segmenter == "pec": if mesh.faces.device.type != "cuda": diff --git a/comfy_extras/nodes_trellis2.py b/comfy_extras/nodes_trellis2.py index 3e5256e0c..d5037a0bb 100644 --- a/comfy_extras/nodes_trellis2.py +++ b/comfy_extras/nodes_trellis2.py @@ -467,7 +467,6 @@ class Trellis2Conditioning(IO.ComfyNode): ] ) - @classmethod @classmethod def execute(cls, clip_vision_model, image, mask) -> IO.NodeOutput: # Normalize to batched form so per-image conditioning loop below is uniform.