mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-05 06:01:39 +08:00
Minor cleanup
This commit is contained in:
parent
1a6d6b9961
commit
29e2118717
@ -1920,6 +1920,7 @@ class WAN21_SCAIL(WAN21):
|
|||||||
pose_latents = kwargs.get("pose_video_latent", None)
|
pose_latents = kwargs.get("pose_video_latent", None)
|
||||||
if pose_latents is not None:
|
if pose_latents is not None:
|
||||||
out['pose_latents'] = [pose_latents.shape[0], 20, *pose_latents.shape[2:]]
|
out['pose_latents'] = [pose_latents.shape[0], 20, *pose_latents.shape[2:]]
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
class WAN21_SCAIL2(WAN21_SCAIL):
|
class WAN21_SCAIL2(WAN21_SCAIL):
|
||||||
|
|||||||
@ -546,13 +546,11 @@ class VAE:
|
|||||||
self.latent_channels = 16
|
self.latent_channels = 16
|
||||||
elif "shape_dec.blocks.1.16.to_subdiv.weight" in sd: # trellis2 shape vae (struct_dec + shape_dec)
|
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]
|
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_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.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()
|
self.first_stage_model = comfy.ldm.trellis2.vae.ShapeVae()
|
||||||
elif "txt_dec.blocks.3.4.conv2.weight" in sd: # trellis2 texture vae
|
elif "txt_dec.blocks.3.4.conv2.weight" in sd: # trellis2 texture vae
|
||||||
self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32]
|
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_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.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()
|
self.first_stage_model = comfy.ldm.trellis2.vae.TextureVae()
|
||||||
|
|||||||
@ -2046,7 +2046,6 @@ class Kandinsky5Image(Kandinsky5):
|
|||||||
return supported_models_base.ClipTarget(comfy.text_encoders.kandinsky5.Kandinsky5TokenizerImage, comfy.text_encoders.kandinsky5.te(**hunyuan_detect))
|
return supported_models_base.ClipTarget(comfy.text_encoders.kandinsky5.Kandinsky5TokenizerImage, comfy.text_encoders.kandinsky5.te(**hunyuan_detect))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ACEStep15(supported_models_base.BASE):
|
class ACEStep15(supported_models_base.BASE):
|
||||||
unet_config = {
|
unet_config = {
|
||||||
"audio_model": "ace1.5",
|
"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))
|
return supported_models_base.ClipTarget(comfy.text_encoders.ace15.ACE15Tokenizer, comfy.text_encoders.ace15.te(**detect))
|
||||||
|
|
||||||
|
|
||||||
class LongCatImage(supported_models_base.BASE):
|
class LongCatImage(supported_models_base.BASE):
|
||||||
unet_config = {
|
unet_config = {
|
||||||
"image_model": "flux",
|
"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))
|
return supported_models_base.ClipTarget(comfy.text_encoders.ernie.ErnieTokenizer, comfy.text_encoders.ernie.te(**hunyuan_detect))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SAM3(supported_models_base.BASE):
|
class SAM3(supported_models_base.BASE):
|
||||||
unet_config = {"image_model": "SAM3"}
|
unet_config = {"image_model": "SAM3"}
|
||||||
supported_inference_dtypes = [torch.float16, torch.bfloat16, torch.float32]
|
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)
|
out = model_base.CogVideoX(self, image_to_video=True, device=device)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
models = [
|
models = [
|
||||||
LotusD,
|
LotusD,
|
||||||
Stable_Zero123,
|
Stable_Zero123,
|
||||||
|
|||||||
@ -402,7 +402,7 @@ def _dual_contour(voxel_coords: torch.Tensor, corner_udf: torch.Tensor,
|
|||||||
b.add_(centroid_verts, alpha=reg)
|
b.add_(centroid_verts, alpha=reg)
|
||||||
try:
|
try:
|
||||||
qef_solution = torch.linalg.solve(A, b.unsqueeze(-1)).squeeze(-1)
|
qef_solution = torch.linalg.solve(A, b.unsqueeze(-1)).squeeze(-1)
|
||||||
except Exception:
|
except torch.linalg.LinAlgError:
|
||||||
qef_solution = centroid_verts
|
qef_solution = centroid_verts
|
||||||
|
|
||||||
# Clamp QEF output to the voxel bbox
|
# Clamp QEF output to the voxel bbox
|
||||||
|
|||||||
@ -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 segment as _uv_seg
|
||||||
from comfy_extras.mesh3d.uv_unwrap import parameterize as _uv_param
|
from comfy_extras.mesh3d.uv_unwrap import parameterize as _uv_param
|
||||||
from comfy_extras.mesh3d.uv_unwrap import pack as _uv_pack
|
from comfy_extras.mesh3d.uv_unwrap import pack as _uv_pack
|
||||||
import warnings
|
|
||||||
import logging
|
import logging
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from scipy.sparse import csr_matrix
|
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:
|
if v_colors.shape[-1] > 3:
|
||||||
v_colors = v_colors[:, :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)
|
# to Linear RGB (required for GLTF)
|
||||||
linear_colors = torch.pow(srgb_colors, 2.2)
|
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)
|
mesh = _uv_mesh.build_mesh(v_in, f_in)
|
||||||
ff = mesh.face_face
|
ff = mesh.face_face
|
||||||
if ff.numel() and float((ff >= 0).float().mean().item()) < 0.25:
|
if ff.numel() and float((ff >= 0).float().mean().item()) < 0.25:
|
||||||
warnings.warn("[uv_unwrap] mesh face-adjacency < 25% — vertices appear un-welded "
|
logging.warning("[uv_unwrap] mesh face-adjacency < 25% — vertices appear un-welded "
|
||||||
"(triangle soup); UV charts will be per-face. Raise weld_distance.")
|
"(triangle soup); UV charts will be per-face. Raise weld_distance.")
|
||||||
|
|
||||||
if segmenter == "pec":
|
if segmenter == "pec":
|
||||||
if mesh.faces.device.type != "cuda":
|
if mesh.faces.device.type != "cuda":
|
||||||
|
|||||||
@ -467,7 +467,6 @@ class Trellis2Conditioning(IO.ComfyNode):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, clip_vision_model, image, mask) -> IO.NodeOutput:
|
def execute(cls, clip_vision_model, image, mask) -> IO.NodeOutput:
|
||||||
# Normalize to batched form so per-image conditioning loop below is uniform.
|
# Normalize to batched form so per-image conditioning loop below is uniform.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user