fix wrapper
This commit is contained in:
@@ -57,23 +57,14 @@ class SAM2VideoMatting:
|
|||||||
if sam2_repo_path.exists():
|
if sam2_repo_path.exists():
|
||||||
checkpoint_path = str(sam2_repo_path)
|
checkpoint_path = str(sam2_repo_path)
|
||||||
|
|
||||||
# Use the config path as-is (should be relative to SAM2 package)
|
# Use SAM2's build_sam2_video_predictor which returns the predictor directly
|
||||||
# Example: "configs/sam2.1/sam2.1_hiera_l.yaml"
|
# The predictor IS the model - no .model attribute needed
|
||||||
self.predictor = build_sam2_video_predictor(
|
self.predictor = build_sam2_video_predictor(
|
||||||
model_cfg,
|
config_file=model_cfg,
|
||||||
checkpoint_path,
|
ckpt_path=checkpoint_path,
|
||||||
device=self.device
|
device=self.device
|
||||||
)
|
)
|
||||||
|
|
||||||
# Enable memory optimizations
|
|
||||||
if self.memory_offload:
|
|
||||||
# SAM2 has different memory optimization options
|
|
||||||
pass # Memory offloading is handled by SAM2 internally
|
|
||||||
|
|
||||||
if self.fp16 and self.device == "cuda":
|
|
||||||
# SAM2 handles FP16 internally, no need to manually convert
|
|
||||||
pass
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(f"Failed to load SAM2 model: {e}")
|
raise RuntimeError(f"Failed to load SAM2 model: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user