Spaces:
				
			
			
	
			
			
		Running
		
			on 
			
			Zero
	
	
	
			
			
	
	
	
	
		
		
		Running
		
			on 
			
			Zero
	Commit 
							
							·
						
						4cd032d
	
1
								Parent(s):
							
							edf8619
								
Remove kaolin
Browse files
    	
        requirements.txt
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 | 
             
            --extra-index-url https://download.pytorch.org/whl/cu121
         | 
| 2 | 
            -
            --find-links https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.4.0_cu121.html
         | 
| 3 |  | 
| 4 | 
             
            torch==2.4.0
         | 
| 5 | 
             
            torchvision==0.19.0
         | 
| @@ -19,7 +18,6 @@ pymeshfix==0.17.0 | |
| 19 | 
             
            igraph==0.11.8
         | 
| 20 | 
             
            git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057d642626897ec8
         | 
| 21 | 
             
            xformers==0.0.27.post2
         | 
| 22 | 
            -
            kaolin==0.17.0
         | 
| 23 | 
             
            spconv-cu120==2.3.6
         | 
| 24 | 
             
            transformers==4.46.3
         | 
| 25 | 
             
            gradio_litmodel3d==0.0.1
         | 
|  | |
| 1 | 
             
            --extra-index-url https://download.pytorch.org/whl/cu121
         | 
|  | |
| 2 |  | 
| 3 | 
             
            torch==2.4.0
         | 
| 4 | 
             
            torchvision==0.19.0
         | 
|  | |
| 18 | 
             
            igraph==0.11.8
         | 
| 19 | 
             
            git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057d642626897ec8
         | 
| 20 | 
             
            xformers==0.0.27.post2
         | 
|  | |
| 21 | 
             
            spconv-cu120==2.3.6
         | 
| 22 | 
             
            transformers==4.46.3
         | 
| 23 | 
             
            gradio_litmodel3d==0.0.1
         | 
    	
        trellis/renderers/mesh_renderer.py
    CHANGED
    
    | @@ -6,11 +6,7 @@ | |
| 6 | 
             
            # distribution of this software and related documentation without an express
         | 
| 7 | 
             
            # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
         | 
| 8 | 
             
            import torch
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                import kaolin as kal
         | 
| 11 | 
            -
                import nvdiffrast.torch as dr
         | 
| 12 | 
            -
            except :
         | 
| 13 | 
            -
                print("Kaolin and nvdiffrast are not installed. Please install them to use the mesh renderer.")
         | 
| 14 | 
             
            from easydict import EasyDict as edict
         | 
| 15 | 
             
            from ..representations.mesh import MeshExtractResult
         | 
| 16 | 
             
            import torch.nn.functional as F
         | 
|  | |
| 6 | 
             
            # distribution of this software and related documentation without an express
         | 
| 7 | 
             
            # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
         | 
| 8 | 
             
            import torch
         | 
| 9 | 
            +
            import nvdiffrast.torch as dr
         | 
|  | |
|  | |
|  | |
|  | |
| 10 | 
             
            from easydict import EasyDict as edict
         | 
| 11 | 
             
            from ..representations.mesh import MeshExtractResult
         | 
| 12 | 
             
            import torch.nn.functional as F
         | 
    	
        trellis/representations/mesh/cube2mesh.py
    CHANGED
    
    | @@ -9,10 +9,7 @@ import torch | |
| 9 | 
             
            from ...modules.sparse import SparseTensor
         | 
| 10 | 
             
            from easydict import EasyDict as edict
         | 
| 11 | 
             
            from .utils_cube import *
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                from .flexicube import FlexiCubes
         | 
| 14 | 
            -
            except:
         | 
| 15 | 
            -
                print("Please install kaolin and diso to use the mesh extractor.")
         | 
| 16 |  | 
| 17 |  | 
| 18 | 
             
            class MeshExtractResult:
         | 
|  | |
| 9 | 
             
            from ...modules.sparse import SparseTensor
         | 
| 10 | 
             
            from easydict import EasyDict as edict
         | 
| 11 | 
             
            from .utils_cube import *
         | 
| 12 | 
            +
            from .flexicube import FlexiCubes
         | 
|  | |
|  | |
|  | |
| 13 |  | 
| 14 |  | 
| 15 | 
             
            class MeshExtractResult:
         | 
    	
        trellis/representations/mesh/flexicube.py
    CHANGED
    
    | @@ -8,7 +8,6 @@ | |
| 8 |  | 
| 9 | 
             
            import torch
         | 
| 10 | 
             
            from .tables import *
         | 
| 11 | 
            -
            from kaolin.utils.testing import check_tensor
         | 
| 12 |  | 
| 13 | 
             
            __all__ = [
         | 
| 14 | 
             
                'FlexiCubes'
         | 
| @@ -49,30 +48,6 @@ class FlexiCubes: | |
| 49 |  | 
| 50 | 
             
                def __call__(self, voxelgrid_vertices, scalar_field, cube_idx, resolution, qef_reg_scale=1e-3,
         | 
| 51 | 
             
                             weight_scale=0.99, beta=None, alpha=None, gamma_f=None, voxelgrid_colors=None, training=False):
         | 
| 52 | 
            -
                    assert torch.is_tensor(voxelgrid_vertices) and \
         | 
| 53 | 
            -
                        check_tensor(voxelgrid_vertices, (None, 3), throw=False), \
         | 
| 54 | 
            -
                        "'voxelgrid_vertices' should be a tensor of shape (num_vertices, 3)"
         | 
| 55 | 
            -
                    num_vertices = voxelgrid_vertices.shape[0]
         | 
| 56 | 
            -
                    assert torch.is_tensor(scalar_field) and \
         | 
| 57 | 
            -
                        check_tensor(scalar_field, (num_vertices,), throw=False), \
         | 
| 58 | 
            -
                        "'scalar_field' should be a tensor of shape (num_vertices,)"
         | 
| 59 | 
            -
                    assert torch.is_tensor(cube_idx) and \
         | 
| 60 | 
            -
                        check_tensor(cube_idx, (None, 8), throw=False), \
         | 
| 61 | 
            -
                        "'cube_idx' should be a tensor of shape (num_cubes, 8)"
         | 
| 62 | 
            -
                    num_cubes = cube_idx.shape[0]
         | 
| 63 | 
            -
                    assert beta is None or (
         | 
| 64 | 
            -
                        torch.is_tensor(beta) and
         | 
| 65 | 
            -
                        check_tensor(beta, (num_cubes, 12), throw=False)
         | 
| 66 | 
            -
                    ), "'beta' should be a tensor of shape (num_cubes, 12)"
         | 
| 67 | 
            -
                    assert alpha is None or (
         | 
| 68 | 
            -
                        torch.is_tensor(alpha) and
         | 
| 69 | 
            -
                        check_tensor(alpha, (num_cubes, 8), throw=False)
         | 
| 70 | 
            -
                    ), "'alpha' should be a tensor of shape (num_cubes, 8)"
         | 
| 71 | 
            -
                    assert gamma_f is None or (
         | 
| 72 | 
            -
                        torch.is_tensor(gamma_f) and
         | 
| 73 | 
            -
                        check_tensor(gamma_f, (num_cubes,), throw=False)
         | 
| 74 | 
            -
                    ), "'gamma_f' should be a tensor of shape (num_cubes,)"
         | 
| 75 | 
            -
             | 
| 76 | 
             
                    surf_cubes, occ_fx8 = self._identify_surf_cubes(scalar_field, cube_idx)
         | 
| 77 | 
             
                    if surf_cubes.sum() == 0:
         | 
| 78 | 
             
                        return (
         | 
|  | |
| 8 |  | 
| 9 | 
             
            import torch
         | 
| 10 | 
             
            from .tables import *
         | 
|  | |
| 11 |  | 
| 12 | 
             
            __all__ = [
         | 
| 13 | 
             
                'FlexiCubes'
         | 
|  | |
| 48 |  | 
| 49 | 
             
                def __call__(self, voxelgrid_vertices, scalar_field, cube_idx, resolution, qef_reg_scale=1e-3,
         | 
| 50 | 
             
                             weight_scale=0.99, beta=None, alpha=None, gamma_f=None, voxelgrid_colors=None, training=False):
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 51 | 
             
                    surf_cubes, occ_fx8 = self._identify_surf_cubes(scalar_field, cube_idx)
         | 
| 52 | 
             
                    if surf_cubes.sum() == 0:
         | 
| 53 | 
             
                        return (
         | 
 
			
