mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-09-09 02:26:31 +08:00
Lower peak trellis workflow vram and ram usage. (#16054)
This commit is contained in:
@@ -12,6 +12,9 @@ class VOXEL:
|
||||
self.voxel_colors = voxel_colors
|
||||
self.resolution = resolution # each 3d model has its own resolution
|
||||
|
||||
def _comfy_cache_tensors(self):
|
||||
return self.data, self.voxel_colors
|
||||
|
||||
class SPLAT:
|
||||
"""A batch of 3D Gaussian splats in render-ready (activated, world-space) form.
|
||||
|
||||
@@ -29,6 +32,9 @@ class SPLAT:
|
||||
self.sh = sh # (B, N, K, 3) spherical-harmonic color coefficients
|
||||
self.counts = counts # (B,) real lengths, or None
|
||||
|
||||
def _comfy_cache_tensors(self):
|
||||
return self.positions, self.scales, self.rotations, self.opacities, self.sh, self.counts
|
||||
|
||||
|
||||
class MESH:
|
||||
def __init__(self, vertices: torch.Tensor, faces: torch.Tensor,
|
||||
@@ -72,6 +78,23 @@ class MESH:
|
||||
self.material = material # SetMeshMaterial scalar/factor overrides
|
||||
self.emissive = emissive # emissive map: (B, H, W, 3)
|
||||
|
||||
def _comfy_cache_tensors(self):
|
||||
return (
|
||||
self.vertices,
|
||||
self.faces,
|
||||
self.uvs,
|
||||
self.vertex_colors,
|
||||
self.texture,
|
||||
self.metallic_roughness,
|
||||
self.vertex_counts,
|
||||
self.face_counts,
|
||||
self.normals,
|
||||
self.tangents,
|
||||
self.normal_map,
|
||||
self.material,
|
||||
self.emissive,
|
||||
)
|
||||
|
||||
|
||||
class File3D:
|
||||
"""Class representing a 3D file from a file path or binary stream.
|
||||
|
||||
Reference in New Issue
Block a user