AlexSinHF commited on
Commit
46a70c9
·
verified ·
1 Parent(s): 188099b

Pose 3D: prefetch DINOv3 hub + import check on CPU; smaller GPU requests

Browse files
Files changed (2) hide show
  1. anima_pose/mesh3d.py +9 -4
  2. app.py +1 -1
anima_pose/mesh3d.py CHANGED
@@ -108,11 +108,16 @@ def prefetch(token: Optional[str] = None) -> None:
108
  _ensure_code()
109
  _weights(token)
110
  import torch
111
- try: # private torch.hub helper: downloads/caches the repo without building the model
112
- torch.hub._get_cache_or_reload("facebookresearch/dinov3", force_reload=False, trust_repo=True,
113
- calling_fn="load", skip_validation=True)
114
  except Exception as exc: # noqa: BLE001 - optional optimisation
115
- print(f"[pose3d] dinov3 hub prefetch skipped: {exc}")
 
 
 
 
 
116
  print("[pose3d] prefetch done")
117
  except Exception as exc: # noqa: BLE001 - never break startup; the GPU call will retry
118
  print(f"[pose3d] prefetch failed: {type(exc).__name__}: {exc}")
 
108
  _ensure_code()
109
  _weights(token)
110
  import torch
111
+ try: # downloads + imports the hub repo (checks its deps) without building the model
112
+ entries = torch.hub.list("facebookresearch/dinov3", trust_repo=True, skip_validation=True)
113
+ print(f"[pose3d] dinov3 hub ready ({len(entries)} entrypoints)")
114
  except Exception as exc: # noqa: BLE001 - optional optimisation
115
+ print(f"[pose3d] dinov3 hub prefetch failed: {type(exc).__name__}: {exc}")
116
+ try: # import check of the SAM 3D Body inference path (CPU only, no weights loaded)
117
+ from sam_3d_body import SAM3DBodyEstimator, load_sam_3d_body # noqa: F401
118
+ print("[pose3d] sam_3d_body import ok")
119
+ except Exception as exc: # noqa: BLE001
120
+ print(f"[pose3d] sam_3d_body import failed: {type(exc).__name__}: {exc}")
121
  print("[pose3d] prefetch done")
122
  except Exception as exc: # noqa: BLE001 - never break startup; the GPU call will retry
123
  print(f"[pose3d] prefetch failed: {type(exc).__name__}: {exc}")
app.py CHANGED
@@ -1131,7 +1131,7 @@ def _estimate_mesh_image(image, max_people=1) -> "Image.Image":
1131
 
1132
 
1133
  def _pose3d_duration(*args, **kwargs):
1134
- return 45 if mesh3d.is_loaded() else 120 # first call builds SAM 3D Body on the GPU
1135
 
1136
 
1137
  @spaces.GPU(duration=_pose3d_duration)
 
1131
 
1132
 
1133
  def _pose3d_duration(*args, **kwargs):
1134
+ return 30 if mesh3d.is_loaded() else 75 # first call builds SAM 3D Body on the GPU
1135
 
1136
 
1137
  @spaces.GPU(duration=_pose3d_duration)