Compare commits

...

2 Commits

Author SHA1 Message Date
d933d6b606 fix wrapper 2025-07-26 08:51:48 -07:00
7852303b40 maybe fix 2025-07-26 08:47:50 -07:00

View File

@@ -57,21 +57,14 @@ class SAM2VideoMatting:
if sam2_repo_path.exists():
checkpoint_path = str(sam2_repo_path)
# Use the config path as-is (should be relative to SAM2 package)
# Example: "configs/sam2.1/sam2.1_hiera_l.yaml"
# Use SAM2's build_sam2_video_predictor which returns the predictor directly
# The predictor IS the model - no .model attribute needed
self.predictor = build_sam2_video_predictor(
model_cfg,
checkpoint_path,
config_file=model_cfg,
ckpt_path=checkpoint_path,
device=self.device
)
# Enable memory optimizations
if self.memory_offload:
self.predictor.fill_hole_area = 8
if self.fp16 and self.device == "cuda":
self.predictor.model.half()
except Exception as e:
raise RuntimeError(f"Failed to load SAM2 model: {e}")