Spaces:
Running
on
Zero
Running
on
Zero
requirements update for HF
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitignore +2 -0
- app.py +25 -3
- requirements.txt +5 -5
- trellis/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/models/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/models/__pycache__/sparse_structure_flow.cpython-312.pyc +0 -0
- trellis/models/__pycache__/sparse_structure_vae.cpython-312.pyc +0 -0
- trellis/models/__pycache__/structured_latent_flow.cpython-312.pyc +0 -0
- trellis/models/structured_latent_vae/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/models/structured_latent_vae/__pycache__/base.cpython-312.pyc +0 -0
- trellis/models/structured_latent_vae/__pycache__/decoder_gs.cpython-312.pyc +0 -0
- trellis/models/structured_latent_vae/__pycache__/decoder_mesh.cpython-312.pyc +0 -0
- trellis/models/structured_latent_vae/__pycache__/decoder_rf.cpython-312.pyc +0 -0
- trellis/models/structured_latent_vae/__pycache__/encoder.cpython-312.pyc +0 -0
- trellis/modules/__pycache__/norm.cpython-312.pyc +0 -0
- trellis/modules/__pycache__/spatial.cpython-312.pyc +0 -0
- trellis/modules/__pycache__/utils.cpython-312.pyc +0 -0
- trellis/modules/attention/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/modules/attention/__pycache__/full_attn.cpython-312.pyc +0 -0
- trellis/modules/attention/__pycache__/modules.cpython-312.pyc +0 -0
- trellis/modules/sparse/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/modules/sparse/__pycache__/basic.cpython-312.pyc +0 -0
- trellis/modules/sparse/__pycache__/linear.cpython-312.pyc +0 -0
- trellis/modules/sparse/__pycache__/nonlinearity.cpython-312.pyc +0 -0
- trellis/modules/sparse/__pycache__/norm.cpython-312.pyc +0 -0
- trellis/modules/sparse/__pycache__/spatial.cpython-312.pyc +0 -0
- trellis/modules/sparse/attention/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/modules/sparse/attention/__pycache__/full_attn.cpython-312.pyc +0 -0
- trellis/modules/sparse/attention/__pycache__/modules.cpython-312.pyc +0 -0
- trellis/modules/sparse/attention/__pycache__/serialized_attn.cpython-312.pyc +0 -0
- trellis/modules/sparse/attention/__pycache__/windowed_attn.cpython-312.pyc +0 -0
- trellis/modules/sparse/conv/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/modules/sparse/conv/__pycache__/conv_spconv.cpython-312.pyc +0 -0
- trellis/modules/sparse/transformer/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/modules/sparse/transformer/__pycache__/blocks.cpython-312.pyc +0 -0
- trellis/modules/sparse/transformer/__pycache__/modulated.cpython-312.pyc +0 -0
- trellis/modules/transformer/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/modules/transformer/__pycache__/blocks.cpython-312.pyc +0 -0
- trellis/modules/transformer/__pycache__/modulated.cpython-312.pyc +0 -0
- trellis/pipelines/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/pipelines/__pycache__/base.cpython-312.pyc +0 -0
- trellis/pipelines/__pycache__/trellis_image_to_3d.cpython-312.pyc +0 -0
- trellis/pipelines/samplers/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/pipelines/samplers/__pycache__/base.cpython-312.pyc +0 -0
- trellis/pipelines/samplers/__pycache__/classifier_free_guidance_mixin.cpython-312.pyc +0 -0
- trellis/pipelines/samplers/__pycache__/flow_euler.cpython-312.pyc +0 -0
- trellis/pipelines/samplers/__pycache__/guidance_interval_mixin.cpython-312.pyc +0 -0
- trellis/renderers/__pycache__/__init__.cpython-312.pyc +0 -0
- trellis/renderers/__pycache__/gaussian_render.cpython-312.pyc +0 -0
- trellis/renderers/__pycache__/mesh_renderer.cpython-312.pyc +0 -0
.gitignore
CHANGED
@@ -166,3 +166,5 @@ cython_debug/
|
|
166 |
/__pycache__
|
167 |
/temp_models
|
168 |
/.vscode/settings.json
|
|
|
|
|
|
166 |
/__pycache__
|
167 |
/temp_models
|
168 |
/.vscode/settings.json
|
169 |
+
**/*.pyc
|
170 |
+
**/__pycache__/
|
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
-
|
4 |
import numpy as np
|
5 |
os.environ['SPCONV_ALGO'] = 'native'
|
6 |
from typing import *
|
@@ -100,7 +100,7 @@ from utils.version_info import (
|
|
100 |
#release_torch_resources,
|
101 |
#get_torch_info
|
102 |
)
|
103 |
-
|
104 |
|
105 |
input_image_palette = []
|
106 |
current_prerendered_image = gr.State("./images/images/Beeuty-1.png")
|
@@ -718,6 +718,28 @@ def generate_3d_asset(depth_image_source, randomize_seed, seed, input_image, out
|
|
718 |
"cfg_strength": 3.0,
|
719 |
},
|
720 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
721 |
# Save the video to a temporary file
|
722 |
user_dir = os.path.join(constants.TMPDIR, str(req.session_hash))
|
723 |
os.makedirs(user_dir, exist_ok=True)
|
@@ -725,7 +747,7 @@ def generate_3d_asset(depth_image_source, randomize_seed, seed, input_image, out
|
|
725 |
video = render_utils.render_video(outputs['gaussian'][0], resolution=576, num_frames=60, r=1)['color']
|
726 |
snapshot_results = render_utils.render_snapshot(outputs['gaussian'][0], resolution=576)
|
727 |
depth_snapshot = snapshot_results['depth'][0]
|
728 |
-
video_geo = render_utils.render_video(outputs['mesh'][0], resolution=576, num_frames=
|
729 |
video = [np.concatenate([video[i], video_geo[i]], axis=1) for i in range(len(video))]
|
730 |
video_path = os.path.join(user_dir, f'{output_name}.mp4')
|
731 |
imageio.mimsave(video_path, video, fps=15)
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
+
import spaces
|
4 |
import numpy as np
|
5 |
os.environ['SPCONV_ALGO'] = 'native'
|
6 |
from typing import *
|
|
|
100 |
#release_torch_resources,
|
101 |
#get_torch_info
|
102 |
)
|
103 |
+
|
104 |
|
105 |
input_image_palette = []
|
106 |
current_prerendered_image = gr.State("./images/images/Beeuty-1.png")
|
|
|
718 |
"cfg_strength": 3.0,
|
719 |
},
|
720 |
)
|
721 |
+
|
722 |
+
# Validate the mesh
|
723 |
+
mesh = outputs['mesh'][0]
|
724 |
+
# Depending on the mesh format (it might be a dict or an object)
|
725 |
+
if isinstance(mesh, dict):
|
726 |
+
vertices = mesh['vertices']
|
727 |
+
faces = mesh['faces']
|
728 |
+
else:
|
729 |
+
vertices = mesh.vertices
|
730 |
+
faces = mesh.faces
|
731 |
+
|
732 |
+
# Check mesh properties
|
733 |
+
print(f"Mesh vertices: {vertices.shape}, faces: {faces.shape}")
|
734 |
+
if faces.max() >= vertices.shape[0]:
|
735 |
+
raise ValueError(f"Invalid mesh: face index {faces.max()} exceeds vertex count {vertices.shape[0]}")
|
736 |
+
|
737 |
+
# Ensure data is on GPU and has correct type
|
738 |
+
if not vertices.is_cuda or not faces.is_cuda:
|
739 |
+
raise ValueError("Mesh data must be on GPU")
|
740 |
+
if vertices.dtype != torch.float32 or faces.dtype != torch.int32:
|
741 |
+
raise ValueError("Mesh vertices must be float32, faces must be int32")
|
742 |
+
|
743 |
# Save the video to a temporary file
|
744 |
user_dir = os.path.join(constants.TMPDIR, str(req.session_hash))
|
745 |
os.makedirs(user_dir, exist_ok=True)
|
|
|
747 |
video = render_utils.render_video(outputs['gaussian'][0], resolution=576, num_frames=60, r=1)['color']
|
748 |
snapshot_results = render_utils.render_snapshot(outputs['gaussian'][0], resolution=576)
|
749 |
depth_snapshot = snapshot_results['depth'][0]
|
750 |
+
video_geo = render_utils.render_video(outputs['mesh'][0], resolution=576, num_frames=60, r=1)['normal']
|
751 |
video = [np.concatenate([video[i], video_geo[i]], axis=1) for i in range(len(video))]
|
752 |
video_path = os.path.join(user_dir, f'{output_name}.mp4')
|
753 |
imageio.mimsave(video_path, video, fps=15)
|
requirements.txt
CHANGED
@@ -17,9 +17,9 @@ sentencepiece
|
|
17 |
|
18 |
#generic Torch versions
|
19 |
--extra-index-url https://download.pytorch.org/whl/cu124
|
20 |
-
torch
|
21 |
torchvision
|
22 |
-
|
23 |
|
24 |
# Other dependencies
|
25 |
Haishoku
|
@@ -68,9 +68,9 @@ git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057
|
|
68 |
spconv-cu124==2.3.8
|
69 |
gradio_litmodel3d==0.0.1
|
70 |
#linux only
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
#Windows only
|
75 |
#https://huggingface.co/spaces/Surn/HexaGrid/main/wheels/flash_attn-2.7.4.post1-cp312-cp312-win_amd64.whl?download=true
|
76 |
#https://huggingface.co/spaces/Surn/HexaGrid/main/wheels/diff_gaussian_rasterization-0.0.0-cp312-cp312-win_amd64.whl?download=true
|
|
|
17 |
|
18 |
#generic Torch versions
|
19 |
--extra-index-url https://download.pytorch.org/whl/cu124
|
20 |
+
torch
|
21 |
torchvision
|
22 |
+
xformers #==0.0.29.post3
|
23 |
|
24 |
# Other dependencies
|
25 |
Haishoku
|
|
|
68 |
spconv-cu124==2.3.8
|
69 |
gradio_litmodel3d==0.0.1
|
70 |
#linux only
|
71 |
+
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
|
72 |
+
https://huggingface.co/spaces/JeffreyXiang/TRELLIS/resolve/main/wheels/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl?download=true
|
73 |
+
https://huggingface.co/spaces/JeffreyXiang/TRELLIS/resolve/main/wheels/nvdiffrast-0.3.3-cp310-cp310-linux_x86_64.whl?download=true
|
74 |
#Windows only
|
75 |
#https://huggingface.co/spaces/Surn/HexaGrid/main/wheels/flash_attn-2.7.4.post1-cp312-cp312-win_amd64.whl?download=true
|
76 |
#https://huggingface.co/spaces/Surn/HexaGrid/main/wheels/diff_gaussian_rasterization-0.0.0-cp312-cp312-win_amd64.whl?download=true
|
trellis/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (343 Bytes)
|
|
trellis/models/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (3.22 kB)
|
|
trellis/models/__pycache__/sparse_structure_flow.cpython-312.pyc
DELETED
Binary file (12.1 kB)
|
|
trellis/models/__pycache__/sparse_structure_vae.cpython-312.pyc
DELETED
Binary file (15.1 kB)
|
|
trellis/models/__pycache__/structured_latent_flow.cpython-312.pyc
DELETED
Binary file (14.7 kB)
|
|
trellis/models/structured_latent_vae/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (387 Bytes)
|
|
trellis/models/structured_latent_vae/__pycache__/base.cpython-312.pyc
DELETED
Binary file (6.57 kB)
|
|
trellis/models/structured_latent_vae/__pycache__/decoder_gs.cpython-312.pyc
DELETED
Binary file (7.94 kB)
|
|
trellis/models/structured_latent_vae/__pycache__/decoder_mesh.cpython-312.pyc
DELETED
Binary file (8.24 kB)
|
|
trellis/models/structured_latent_vae/__pycache__/decoder_rf.cpython-312.pyc
DELETED
Binary file (6.35 kB)
|
|
trellis/models/structured_latent_vae/__pycache__/encoder.cpython-312.pyc
DELETED
Binary file (3.5 kB)
|
|
trellis/modules/__pycache__/norm.cpython-312.pyc
DELETED
Binary file (2.29 kB)
|
|
trellis/modules/__pycache__/spatial.cpython-312.pyc
DELETED
Binary file (3.85 kB)
|
|
trellis/modules/__pycache__/utils.cpython-312.pyc
DELETED
Binary file (2.42 kB)
|
|
trellis/modules/attention/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (1.17 kB)
|
|
trellis/modules/attention/__pycache__/full_attn.cpython-312.pyc
DELETED
Binary file (7.38 kB)
|
|
trellis/modules/attention/__pycache__/modules.cpython-312.pyc
DELETED
Binary file (10.5 kB)
|
|
trellis/modules/sparse/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (3.57 kB)
|
|
trellis/modules/sparse/__pycache__/basic.cpython-312.pyc
DELETED
Binary file (27.8 kB)
|
|
trellis/modules/sparse/__pycache__/linear.cpython-312.pyc
DELETED
Binary file (1.09 kB)
|
|
trellis/modules/sparse/__pycache__/nonlinearity.cpython-312.pyc
DELETED
Binary file (2.4 kB)
|
|
trellis/modules/sparse/__pycache__/norm.cpython-312.pyc
DELETED
Binary file (4.48 kB)
|
|
trellis/modules/sparse/__pycache__/spatial.cpython-312.pyc
DELETED
Binary file (8.59 kB)
|
|
trellis/modules/sparse/attention/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (280 Bytes)
|
|
trellis/modules/sparse/attention/__pycache__/full_attn.cpython-312.pyc
DELETED
Binary file (13.7 kB)
|
|
trellis/modules/sparse/attention/__pycache__/modules.cpython-312.pyc
DELETED
Binary file (9.64 kB)
|
|
trellis/modules/sparse/attention/__pycache__/serialized_attn.cpython-312.pyc
DELETED
Binary file (10.5 kB)
|
|
trellis/modules/sparse/attention/__pycache__/windowed_attn.cpython-312.pyc
DELETED
Binary file (8.53 kB)
|
|
trellis/modules/sparse/conv/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (775 Bytes)
|
|
trellis/modules/sparse/conv/__pycache__/conv_spconv.cpython-312.pyc
DELETED
Binary file (6.47 kB)
|
|
trellis/modules/sparse/transformer/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (223 Bytes)
|
|
trellis/modules/sparse/transformer/__pycache__/blocks.cpython-312.pyc
DELETED
Binary file (7.05 kB)
|
|
trellis/modules/sparse/transformer/__pycache__/modulated.cpython-312.pyc
DELETED
Binary file (7.76 kB)
|
|
trellis/modules/transformer/__pycache__/__init__.cpython-312.pyc
CHANGED
Binary files a/trellis/modules/transformer/__pycache__/__init__.cpython-312.pyc and b/trellis/modules/transformer/__pycache__/__init__.cpython-312.pyc differ
|
|
trellis/modules/transformer/__pycache__/blocks.cpython-312.pyc
CHANGED
Binary files a/trellis/modules/transformer/__pycache__/blocks.cpython-312.pyc and b/trellis/modules/transformer/__pycache__/blocks.cpython-312.pyc differ
|
|
trellis/modules/transformer/__pycache__/modulated.cpython-312.pyc
CHANGED
Binary files a/trellis/modules/transformer/__pycache__/modulated.cpython-312.pyc and b/trellis/modules/transformer/__pycache__/modulated.cpython-312.pyc differ
|
|
trellis/pipelines/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (1.18 kB)
|
|
trellis/pipelines/__pycache__/base.cpython-312.pyc
DELETED
Binary file (3.48 kB)
|
|
trellis/pipelines/__pycache__/trellis_image_to_3d.cpython-312.pyc
DELETED
Binary file (21.2 kB)
|
|
trellis/pipelines/samplers/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (330 Bytes)
|
|
trellis/pipelines/samplers/__pycache__/base.cpython-312.pyc
DELETED
Binary file (678 Bytes)
|
|
trellis/pipelines/samplers/__pycache__/classifier_free_guidance_mixin.cpython-312.pyc
DELETED
Binary file (988 Bytes)
|
|
trellis/pipelines/samplers/__pycache__/flow_euler.cpython-312.pyc
DELETED
Binary file (9.83 kB)
|
|
trellis/pipelines/samplers/__pycache__/guidance_interval_mixin.cpython-312.pyc
DELETED
Binary file (1.13 kB)
|
|
trellis/renderers/__pycache__/__init__.cpython-312.pyc
DELETED
Binary file (1.3 kB)
|
|
trellis/renderers/__pycache__/gaussian_render.cpython-312.pyc
DELETED
Binary file (9.08 kB)
|
|
trellis/renderers/__pycache__/mesh_renderer.cpython-312.pyc
DELETED
Binary file (7.44 kB)
|
|