refactor(compressors): consolidate pipeline and improve mask handling

This commit is contained in:
2026-03-26 19:00:13 +08:00
parent 90d5a8f08a
commit 968819e113
11 changed files with 302 additions and 121 deletions

View File

@@ -1,6 +1,6 @@
"""Model loading utilities for DINO, SAM2 and HashCompressor."""
from compressors import HashCompressor
from typing import TYPE_CHECKING
import torch
@@ -8,6 +8,9 @@ from transformers import AutoImageProcessor, AutoModel, pipeline, MaskGeneration
from .common import get_device
if TYPE_CHECKING:
from compressors.hash_compressor import HashCompressor
def load_sam_model(
model_name: str = "facebook/sam2.1-hiera-large",
@@ -44,7 +47,7 @@ def load_hash_compressor(
input_dim: int = 1024,
hash_bits: int = 512,
compressor_path: str | None = None,
) -> HashCompressor:
) -> "HashCompressor":
from compressors.hash_compressor import HashCompressor
device = get_device()