SAm2
Browse files- models/__init__.py +1 -3
models/__init__.py
CHANGED
|
@@ -20,7 +20,6 @@
|
|
| 20 |
import numpy as np
|
| 21 |
import yaml
|
| 22 |
import torch # For memory management and CUDA operations
|
| 23 |
-
import torch # For memory management and CUDA operations
|
| 24 |
|
| 25 |
# --------------------------------------------------------------------------------------
|
| 26 |
# Logging
|
|
@@ -39,7 +38,7 @@
|
|
| 39 |
# --------------------------------------------------------------------------------------
|
| 40 |
# Path setup for third_party repos
|
| 41 |
# --------------------------------------------------------------------------------------
|
| 42 |
-
ROOT = Path(__file__).resolve().parent
|
| 43 |
TP_SAM2 = Path(os.environ.get("THIRD_PARTY_SAM2_DIR", ROOT / "third_party" / "sam2")).resolve()
|
| 44 |
TP_MATANY = Path(os.environ.get("THIRD_PARTY_MATANY_DIR", ROOT / "third_party" / "matanyone")).resolve()
|
| 45 |
|
|
@@ -66,7 +65,6 @@ def _probe_ffmpeg() -> bool:
|
|
| 66 |
|
| 67 |
def _has_cuda() -> bool:
|
| 68 |
try:
|
| 69 |
-
import torch # type: ignore
|
| 70 |
return torch.cuda.is_available()
|
| 71 |
except Exception:
|
| 72 |
return False
|
|
|
|
| 20 |
import numpy as np
|
| 21 |
import yaml
|
| 22 |
import torch # For memory management and CUDA operations
|
|
|
|
| 23 |
|
| 24 |
# --------------------------------------------------------------------------------------
|
| 25 |
# Logging
|
|
|
|
| 38 |
# --------------------------------------------------------------------------------------
|
| 39 |
# Path setup for third_party repos
|
| 40 |
# --------------------------------------------------------------------------------------
|
| 41 |
+
ROOT = Path(__file__).resolve().parent.parent # Go up from models/ to project root
|
| 42 |
TP_SAM2 = Path(os.environ.get("THIRD_PARTY_SAM2_DIR", ROOT / "third_party" / "sam2")).resolve()
|
| 43 |
TP_MATANY = Path(os.environ.get("THIRD_PARTY_MATANY_DIR", ROOT / "third_party" / "matanyone")).resolve()
|
| 44 |
|
|
|
|
| 65 |
|
| 66 |
def _has_cuda() -> bool:
|
| 67 |
try:
|
|
|
|
| 68 |
return torch.cuda.is_available()
|
| 69 |
except Exception:
|
| 70 |
return False
|