ritianyu commited on
Commit
153e5ea
·
1 Parent(s): 16ea76a
InfiniDepth/model/block/implicit_decoder.py CHANGED
@@ -3,10 +3,6 @@ import numpy as np
3
  import torch
4
  import torch.nn as nn
5
  import torch.nn.functional as F
6
- import sys
7
- from grpc import insecure_channel
8
- from sympy import use
9
- from pathlib import Path
10
 
11
 
12
  def exists(val):
 
3
  import torch
4
  import torch.nn as nn
5
  import torch.nn.functional as F
 
 
 
 
6
 
7
 
8
  def exists(val):
InfiniDepth/model/block/prompt_models/__init__.py CHANGED
@@ -1,5 +1,4 @@
1
  import torch.nn as nn
2
- from .sam import SAMPromptModel
3
  from .selfattn import SelfAttnPromptModel
4
 
5
  __all__ = [
@@ -29,3 +28,11 @@ class GeneralPromptModel(nn.Module):
29
  patch_w,
30
  )
31
  return features
 
 
 
 
 
 
 
 
 
1
  import torch.nn as nn
 
2
  from .selfattn import SelfAttnPromptModel
3
 
4
  __all__ = [
 
28
  patch_w,
29
  )
30
  return features
31
+
32
+
33
+ def __getattr__(name: str):
34
+ if name == "SAMPromptModel":
35
+ from .sam import SAMPromptModel
36
+
37
+ return SAMPromptModel
38
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
InfiniDepth/model/block/prompt_models/utils/transformer.py CHANGED
@@ -238,6 +238,8 @@ class Attention(nn.Module):
238
 
239
  class MemEffAttention(Attention):
240
  def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor:
 
 
241
  q = self.q_proj(q)
242
  k = self.k_proj(k)
243
  v = self.v_proj(v)
 
238
 
239
  class MemEffAttention(Attention):
240
  def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor:
241
+ if not XFORMERS_AVAILABLE:
242
+ return super().forward(q, k, v)
243
  q = self.q_proj(q)
244
  k = self.k_proj(k)
245
  v = self.v_proj(v)
InfiniDepth/utils/vis_utils.py CHANGED
@@ -6,7 +6,6 @@ from PIL import Image
6
  import copy
7
  import cv2
8
  import numpy as np
9
- import onnxruntime
10
 
11
 
12
  def visualize_normal(n, save_path="normal_map.png"):
@@ -85,6 +84,12 @@ def clip_outliers_by_percentile(depthmap: torch.Tensor,
85
 
86
 
87
  def build_sky_model(model_path="checkpoints/skyseg.onnx"):
 
 
 
 
 
 
88
  return onnxruntime.InferenceSession(model_path)
89
 
90
 
 
6
  import copy
7
  import cv2
8
  import numpy as np
 
9
 
10
 
11
  def visualize_normal(n, save_path="normal_map.png"):
 
84
 
85
 
86
  def build_sky_model(model_path="checkpoints/skyseg.onnx"):
87
+ try:
88
+ import onnxruntime
89
+ except ImportError as exc:
90
+ raise ImportError(
91
+ "onnxruntime is only required for the optional sky-segmentation path."
92
+ ) from exc
93
  return onnxruntime.InferenceSession(model_path)
94
 
95
 
requirements.txt CHANGED
@@ -1,52 +1,33 @@
1
- # python version >= 3.9 <= 3.11
2
- # torch
 
3
  torch==2.9.1
4
  torchvision==0.24.1
5
- torchaudio==2.9.1
6
- xformers==0.0.33.post2
7
- hydra-colorlog
8
- hydra-core
9
- h5py
10
- lightning==2.1.3
11
- imageio>=2.33.1
12
- Pillow>=10.1.0
13
- imageio-ffmpeg
14
- einops
15
- # Diffusion
16
- diffusers[torch]
17
- transformers
18
- # ray
19
- termcolor
20
- rich
21
- tensorboardX
22
  numpy==1.26.4
 
23
  opencv-python==4.9.0.80
24
  scipy
25
  matplotlib
 
 
 
26
  open3d
27
- omegaconf
28
- tyro
29
- ipdb
30
- tensorboard
31
- timm
32
- pre-commit
33
- openexr
34
- numba
35
- kornia
36
- trimesh
37
- transformations
38
- # flash_attn
39
- scikit-image
40
  huggingface_hub>=0.24.0
41
- plotly>=5.22.0
42
- onnxruntime
43
  scikit-learn
 
 
44
 
45
- # HuggingFace Spaces ZeroGPU support
46
- # NOTE: Do NOT list 'gradio' here — it is managed by sdk_version in README.md.
47
- # Listing it again can downgrade/conflict with the pre-installed version and break
48
- # the ZeroGPU proxy token mechanism.
49
- spaces
 
 
 
 
50
 
51
- # moge
52
  git+https://github.com/microsoft/MoGe.git
 
1
+ # Runtime dependencies for the Hugging Face Space demo.
2
+ # Keep this list tight: ZeroGPU is more stable with a smaller dependency surface.
3
+
4
  torch==2.9.1
5
  torchvision==0.24.1
6
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  numpy==1.26.4
8
+ Pillow>=10.1.0
9
  opencv-python==4.9.0.80
10
  scipy
11
  matplotlib
12
+ imageio>=2.33.1
13
+ imageio-ffmpeg
14
+ h5py
15
  open3d
16
+ einops
 
 
 
 
 
 
 
 
 
 
 
 
17
  huggingface_hub>=0.24.0
 
 
18
  scikit-learn
19
+ trimesh
20
+ timm
21
 
22
+ # Hugging Face Spaces manages Gradio from README.md `sdk_version`.
23
+ # Do not pin `gradio` here.
24
+ #
25
+ # ZeroGPU support comes from the Space runtime itself; avoid pinning `spaces`
26
+ # unless debugging a specific runtime regression.
27
+ #
28
+ # `xformers` and `onnxruntime` are intentionally omitted:
29
+ # - the active demo inference path has safe fallbacks without `xformers`
30
+ # - `onnxruntime` is only needed for optional sky-segmentation utilities
31
 
32
+ # MoGe-2 dependency used when no depth prior is uploaded.
33
  git+https://github.com/microsoft/MoGe.git