diff --git a/.gitignore b/.gitignore index aa9f88b..ba7fba5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ o_voxel/* FlexGEMM/* weights/* triton_cache/* -triton_caches/* \ No newline at end of file +triton_caches/* +o-voxel/* +.vs/* +nvdiffrast/* +nvdiffrec/* \ No newline at end of file diff --git a/README.md b/README.md index 4a393e7..0873cd5 100644 --- a/README.md +++ b/README.md @@ -53,61 +53,9 @@ Many users reported that their is a bug with mesh generation like on this picture: image -Probably this bug comes from Triton Cache +I did not find yet the root cause of this problem. -I advice you to modify your .bat file that launches ComfyUI. - -Edit your .bat file and add these lines before your run "main.py" script: - -```bash -@echo off - -echo [1/2] Clearing Triton Cache... -if exist "%USERPROFILE%.triton" ( - rmdir /s /q "%USERPROFILE%.triton" - echo Triton Cache removed. -) else ( - echo Triton Cache allready cleared - skipped. -) - -echo [2/2] Clearing TorchInductor Cache... -if exist "%TEMP%\torchinductor%USERNAME%" ( - rmdir /s /q "%TEMP%\torchinductor%USERNAME%" - echo TorchInductor Cache removed. -) else ( - echo TorchInductor Cache not found - skipped. -) - -echo. -echo Caches cleared! -echo. -``` - -If you run ComfyUI from a Powershell script, add these lines before "python main.py": - -```bash -Write-Host "[1/2] Clearing Triton Cache..." -# [1/2] Clearing Triton Cache -if (Test-Path "$env:USERPROFILE\.triton") { - Remove-Item -Path "$env:USERPROFILE\.triton" -Recurse -Force - Write-Host "Triton Cache removed." -} -else { - Write-Host "Triton Cache already cleared - skipped." -} - -Write-Host "[2/2] Clearing TorchInductor Cache..." -# [2/2] Clearing TorchInductor Cache -if (Test-Path "$env:TEMP\torchinductor_$env:USERNAME") { - Remove-Item -Path "$env:TEMP\torchinductor_$env:USERNAME" -Recurse -Force - Write-Host "TorchInductor Cache removed." -} -else { - Write-Host "TorchInductor Cache not found - skipped." -} - -Write-Host "Cache Cleared." -``` +For the moment, the only solution is to restart ComfyUI. --- ## REQUIREMENTS ## diff --git a/trellis2/models/sc_vaes/fdg_vae.py b/trellis2/models/sc_vaes/fdg_vae.py index 008d9c6..bd96b14 100644 --- a/trellis2/models/sc_vaes/fdg_vae.py +++ b/trellis2/models/sc_vaes/fdg_vae.py @@ -82,6 +82,11 @@ class FlexiDualGridVaeDecoder(SparseUnetVaeDecoder): self.resolution = resolution def forward(self, x: sp.SparseTensor, gt_intersected: sp.SparseTensor = None, useTiled: bool = True, **kwargs): + # Clear stale spatial caches from any previous run. + # Since `replace()` propagates `_spatial_cache` by reference, neighbor maps + # built during run 1 would otherwise be reused (with wrong indices) in run 2, + # causing corrupted vertex positions ("infinite vertical lines" artifact). + x.clear_spatial_cache() decoded = super().forward(x, **kwargs) if self.training: h, subs_gt, subs = decoded diff --git a/trellis2/pipelines/trellis2_image_to_3d.py b/trellis2/pipelines/trellis2_image_to_3d.py index 67c38d7..938242d 100644 --- a/trellis2/pipelines/trellis2_image_to_3d.py +++ b/trellis2/pipelines/trellis2_image_to_3d.py @@ -780,6 +780,7 @@ class Trellis2ImageTo3DPipeline(Pipeline): if subs is None: ret = self.models['tex_slat_decoder'](slat) * 0.5 + 0.5 else: + slat.clear_spatial_cache() ret = self.models['tex_slat_decoder'](slat, guide_subs=subs) * 0.5 + 0.5 if self.low_vram: