Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -256,7 +256,7 @@ def add_file(history, task_history, file, task_new, fig, query):
|
|
256 |
coords = ((torch.from_numpy(position_recon) + 0.5) * 64).int().contiguous()
|
257 |
ss = torch.zeros(1, 64, 64, 64, dtype=torch.long)
|
258 |
ss[:, coords[:, 0], coords[:, 1], coords[:, 2]] = 1
|
259 |
-
token = vqvae.Encode(ss.to(dtype=torch.float32).unsqueeze(0)
|
260 |
token = token[0].cpu().numpy().tolist()
|
261 |
words = token_to_words(token)
|
262 |
fig = make_pointcloud_figure(position_recon,rotate=True)
|
@@ -387,9 +387,8 @@ def _transform_messages(original_messages):
|
|
387 |
return transformed_messages
|
388 |
|
389 |
from trellis.models.sparse_structure_vqvae import VQVAE3D
|
390 |
-
device = torch.device("
|
391 |
vqvae = VQVAE3D(num_embeddings=8192)
|
392 |
-
device = torch.device("cuda")
|
393 |
vqvae.eval()
|
394 |
filepath = hf_hub_download(repo_id="yejunliang23/3DVQVAE",filename="3DVQVAE.bin")
|
395 |
state_dict = torch.load(filepath, map_location="cpu")
|
@@ -398,7 +397,7 @@ vqvae=vqvae.to(device)
|
|
398 |
|
399 |
MODEL_DIR = "yejunliang23/ShapeLLM-7B-omni"
|
400 |
model_ckpt_path=MODEL_DIR
|
401 |
-
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_ckpt_path, torch_dtype="auto", device_map=
|
402 |
processor = AutoProcessor.from_pretrained(model_ckpt_path)
|
403 |
tokenizer = processor.tokenizer
|
404 |
from huggingface_hub import hf_hub_download
|
|
|
256 |
coords = ((torch.from_numpy(position_recon) + 0.5) * 64).int().contiguous()
|
257 |
ss = torch.zeros(1, 64, 64, 64, dtype=torch.long)
|
258 |
ss[:, coords[:, 0], coords[:, 1], coords[:, 2]] = 1
|
259 |
+
token = vqvae.Encode(ss.to(dtype=torch.float32).unsqueeze(0))
|
260 |
token = token[0].cpu().numpy().tolist()
|
261 |
words = token_to_words(token)
|
262 |
fig = make_pointcloud_figure(position_recon,rotate=True)
|
|
|
387 |
return transformed_messages
|
388 |
|
389 |
from trellis.models.sparse_structure_vqvae import VQVAE3D
|
390 |
+
device = torch.device("cpu")
|
391 |
vqvae = VQVAE3D(num_embeddings=8192)
|
|
|
392 |
vqvae.eval()
|
393 |
filepath = hf_hub_download(repo_id="yejunliang23/3DVQVAE",filename="3DVQVAE.bin")
|
394 |
state_dict = torch.load(filepath, map_location="cpu")
|
|
|
397 |
|
398 |
MODEL_DIR = "yejunliang23/ShapeLLM-7B-omni"
|
399 |
model_ckpt_path=MODEL_DIR
|
400 |
+
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_ckpt_path, torch_dtype="auto", device_map="auto")
|
401 |
processor = AutoProcessor.from_pretrained(model_ckpt_path)
|
402 |
tokenizer = processor.tokenizer
|
403 |
from huggingface_hub import hf_hub_download
|