From 16bb099647df6ba07d7bf3139e67eed64fadd491 Mon Sep 17 00:00:00 2001 From: Kirill Bobyrev <3352968+kirillbobyrev@users.noreply.github.com> Date: Tue, 16 Dec 2025 22:15:17 +0000 Subject: [PATCH] refactor: Prune unused dependencies --- notebook/demo_multi_object.ipynb | 1 - notebook/inference.py | 4 -- notebook/mesh_alignment.py | 1 - requirements.dev.txt | 3 - requirements.inference.txt | 1 - requirements.txt | 69 ------------------- sam3d_objects/data/utils.py | 3 +- .../mesh/flexicubes/flexicubes.py | 34 +++------ 8 files changed, 12 insertions(+), 104 deletions(-) diff --git a/notebook/demo_multi_object.ipynb b/notebook/demo_multi_object.ipynb index a6d8a22c..c73864d3 100644 --- a/notebook/demo_multi_object.ipynb +++ b/notebook/demo_multi_object.ipynb @@ -25,7 +25,6 @@ "import os\n", "import uuid\n", "import imageio\n", - "import numpy as np\n", "from IPython.display import Image as ImageDisplay\n", "\n", "from inference import Inference, ready_gaussian_for_video_rendering, load_image, load_masks, display_image, make_scene, render_video, interactive_visualizer" diff --git a/notebook/inference.py b/notebook/inference.py index 2fb55534..e3c7ab05 100644 --- a/notebook/inference.py +++ b/notebook/inference.py @@ -5,7 +5,6 @@ os.environ["CUDA_HOME"] = os.environ["CONDA_PREFIX"] os.environ["LIDRA_SKIP_INIT"] = "true" -import sys from typing import Union, Optional, List, Callable import numpy as np from PIL import Image @@ -17,13 +16,10 @@ import shutil import subprocess import seaborn as sns -from PIL import Image import numpy as np import gradio as gr import matplotlib.pyplot as plt from copy import deepcopy -from kaolin.visualize import IpyTurntableVisualizer -from kaolin.render.camera import Camera, CameraExtrinsics, PinholeIntrinsics import builtins from pytorch3d.transforms import quaternion_multiply, quaternion_invert diff --git a/notebook/mesh_alignment.py b/notebook/mesh_alignment.py index 9c6da5aa..94016d9f 100644 --- a/notebook/mesh_alignment.py +++ b/notebook/mesh_alignment.py @@ -11,7 +11,6 @@ import torch import trimesh from PIL import Image -import torch.nn.functional as F from pytorch3d.structures import Meshes from pytorch3d.renderer import PerspectiveCameras, RasterizationSettings, MeshRasterizer, TexturesVertex from moge.model.v1 import MoGeModel diff --git a/requirements.dev.txt b/requirements.dev.txt index b00f80e7..e079f8a6 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,4 +1 @@ pytest -findpydeps -pipdeptree -lovely_tensors diff --git a/requirements.inference.txt b/requirements.inference.txt index ca578415..d5d7798c 100644 --- a/requirements.inference.txt +++ b/requirements.inference.txt @@ -1,4 +1,3 @@ -kaolin==0.17.0 gsplat @ git+https://github.com/nerfstudio-project/gsplat.git@2323de5905d5e90e035f792fe65bad0fedd413e7 seaborn==0.13.2 gradio==5.49.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9b4d16d9..eb2db21e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,88 +1,19 @@ -astor==0.8.1 -async-timeout==4.0.3 -auto_gptq==0.7.1 -autoflake==2.3.1 -av==12.0.0 -bitsandbytes==0.43.0 -black==24.3.0 -bpy==4.3.0 -colorama==0.4.6 -conda-pack==0.7.1 -crcmod==1.7 -cuda-python==12.1.0 -dataclasses==0.6 -decord==0.6.0 -deprecation==2.1.0 easydict==1.13 einops-exts==0.0.4 -exceptiongroup==1.2.0 -fastavro==1.9.4 -fasteners==0.19 -flake8==7.0.0 -Flask==3.0.3 -fqdn==1.5.1 -ftfy==6.2.0 -fvcore==0.1.5.post20221221 -gdown==5.2.0 -h5py==3.12.1 -hdfs==2.7.3 -httplib2==0.22.0 hydra-core==1.3.2 hydra-submitit-launcher==1.2.0 igraph==0.11.8 -imath==0.0.2 -isoduration==20.11.0 -jsonlines==4.0.0 -jsonpickle==3.0.4 -jsonpointer==2.4 -jupyter==1.1.1 -librosa==0.10.1 lightning==2.3.3 loguru==0.7.2 -mosaicml-streaming==0.7.5 nvidia-cuda-nvcc-cu12==12.1.105 -nvidia-pyindex==1.0.9 -objsize==0.7.0 open3d==0.18.0 opencv-python==4.9.0.80 -OpenEXR==3.3.3 -optimum==1.18.1 optree==0.14.1 -orjson==3.10.0 -panda3d-gltf==1.2.1 -pdoc3==0.10.0 -peft==0.10.0 -pip-system-certs==4.0 -point-cloud-utils==0.29.5 -polyscope==2.3.0 -pycocotools==2.0.7 -pydot==1.4.2 pymeshfix==0.17.0 -pymongo==4.6.3 -pyrender==0.1.45 -PySocks==1.7.1 -pytest==8.1.1 -python-pycg==0.9.2 -randomname==0.2.1 -roma==1.5.1 -rootutils==1.0.7 -Rtree==1.3.0 -sagemaker==2.242.0 scikit-image==0.23.1 -sentence-transformers==2.6.1 -simplejson==3.19.2 -smplx==0.1.28 spconv-cu121==2.3.8 tensorboard==2.16.2 timm==0.9.16 -tomli==2.0.1 -torchaudio==2.5.1+cu121 -uri-template==1.3.0 -usort==1.0.8.post1 -wandb==0.20.0 -webcolors==1.13 -webdataset==0.2.86 -Werkzeug==3.0.6 xatlas==0.0.9 xformers==0.0.28.post3 MoGe @ git+https://github.com/microsoft/MoGe.git@a8c37341bc0325ca99b9d57981cc3bb2bd3e255b diff --git a/sam3d_objects/data/utils.py b/sam3d_objects/data/utils.py index aaa09692..2df542b1 100644 --- a/sam3d_objects/data/utils.py +++ b/sam3d_objects/data/utils.py @@ -5,7 +5,6 @@ from collections.abc import Iterable import inspect import ast -import astor from torch.utils import _pytree # None = root, Iterable[Any] = path, Any = path of one @@ -215,7 +214,7 @@ def _get_caller_arg_name(argnum=0, parent_frame=1): break # only get the first parent call # get first argument string (do not handle '=') - label = astor.to_source(args[argnum]).strip() + label = ast.unparse(args[argnum]).strip() except: # TODO(Pierre) log exception label = "{label}" diff --git a/sam3d_objects/model/backbone/tdfy_dit/representations/mesh/flexicubes/flexicubes.py b/sam3d_objects/model/backbone/tdfy_dit/representations/mesh/flexicubes/flexicubes.py index 583b5e3f..67d71e31 100644 --- a/sam3d_objects/model/backbone/tdfy_dit/representations/mesh/flexicubes/flexicubes.py +++ b/sam3d_objects/model/backbone/tdfy_dit/representations/mesh/flexicubes/flexicubes.py @@ -15,7 +15,6 @@ # limitations under the License. import torch from .tables import * -from kaolin.utils.testing import check_tensor __all__ = [ 'FlexiCubes' @@ -56,29 +55,18 @@ def __init__(self, device="cuda"): def __call__(self, voxelgrid_vertices, scalar_field, cube_idx, resolution, qef_reg_scale=1e-3, weight_scale=0.99, beta=None, alpha=None, gamma_f=None, voxelgrid_colors=None, training=False): - assert torch.is_tensor(voxelgrid_vertices) and \ - check_tensor(voxelgrid_vertices, (None, 3), throw=False), \ - "'voxelgrid_vertices' should be a tensor of shape (num_vertices, 3)" - num_vertices = voxelgrid_vertices.shape[0] - assert torch.is_tensor(scalar_field) and \ - check_tensor(scalar_field, (num_vertices,), throw=False), \ - "'scalar_field' should be a tensor of shape (num_vertices,)" - assert torch.is_tensor(cube_idx) and \ - check_tensor(cube_idx, (None, 8), throw=False), \ - "'cube_idx' should be a tensor of shape (num_cubes, 8)" + assert voxelgrid_vertices.ndim == 2 and voxelgrid_vertices.shape[1] == 3, "voxelgrid_vertices must be (N, 3)" + assert scalar_field.shape == (voxelgrid_vertices.shape[0],), "scalar_field must be (N,)" + + assert cube_idx.ndim == 2 and cube_idx.shape[1] == 8, "cube_idx must be (M, 8)" num_cubes = cube_idx.shape[0] - assert beta is None or ( - torch.is_tensor(beta) and - check_tensor(beta, (num_cubes, 12), throw=False) - ), "'beta' should be a tensor of shape (num_cubes, 12)" - assert alpha is None or ( - torch.is_tensor(alpha) and - check_tensor(alpha, (num_cubes, 8), throw=False) - ), "'alpha' should be a tensor of shape (num_cubes, 8)" - assert gamma_f is None or ( - torch.is_tensor(gamma_f) and - check_tensor(gamma_f, (num_cubes,), throw=False) - ), "'gamma_f' should be a tensor of shape (num_cubes,)" + + if beta is not None: + assert beta.shape == (num_cubes, 12), "beta must be (M, 12)" + if alpha is not None: + assert alpha.shape == (num_cubes, 8), "alpha must be (M, 8)" + if gamma_f is not None: + assert gamma_f.shape == (num_cubes,), "gamma_f must be (M,)" surf_cubes, occ_fx8 = self._identify_surf_cubes(scalar_field, cube_idx) if surf_cubes.sum() == 0: