Spaces:
Sleeping
Sleeping
Commit ·
476b962
1
Parent(s): f9367bd
fix: correct SEA-RAFT imports (core.raft, core.utils.utils) + huggingface_hub>=0.20
Browse files- Dockerfile +1 -1
- app.py +8 -5
Dockerfile
CHANGED
|
@@ -26,7 +26,7 @@ RUN pip install --no-cache-dir \
|
|
| 26 |
# SEA-RAFT (dense optical flow — ECCV 2024 Best Paper Candidate)
|
| 27 |
# Clone repo so we can import the model architecture
|
| 28 |
RUN git clone --depth 1 https://github.com/princeton-vl/SEA-RAFT.git /app/SEA-RAFT && \
|
| 29 |
-
pip install --no-cache-dir einops scipy huggingface_hub
|
| 30 |
|
| 31 |
# Patch lightglue __init__.py so optional models (DISK, ALIKED)
|
| 32 |
# don't crash when their kornia deps are incompatible
|
|
|
|
| 26 |
# SEA-RAFT (dense optical flow — ECCV 2024 Best Paper Candidate)
|
| 27 |
# Clone repo so we can import the model architecture
|
| 28 |
RUN git clone --depth 1 https://github.com/princeton-vl/SEA-RAFT.git /app/SEA-RAFT && \
|
| 29 |
+
pip install --no-cache-dir einops scipy "huggingface_hub>=0.20"
|
| 30 |
|
| 31 |
# Patch lightglue __init__.py so optional models (DISK, ALIKED)
|
| 32 |
# don't crash when their kornia deps are incompatible
|
app.py
CHANGED
|
@@ -99,19 +99,21 @@ def get_sea_raft_model():
|
|
| 99 |
try:
|
| 100 |
import sys
|
| 101 |
import os
|
|
|
|
|
|
|
| 102 |
# SEA-RAFT is cloned into /app/SEA-RAFT during Docker build
|
| 103 |
-
sea_raft_dir = os.
|
| 104 |
if os.path.isdir(sea_raft_dir) and sea_raft_dir not in sys.path:
|
| 105 |
sys.path.insert(0, sea_raft_dir)
|
|
|
|
| 106 |
|
| 107 |
-
from
|
| 108 |
-
from utils.utils import InputPadder
|
| 109 |
-
import argparse
|
| 110 |
|
| 111 |
print("[init] Loading SEA-RAFT model (Small)...")
|
| 112 |
t0 = time.time()
|
| 113 |
|
| 114 |
-
#
|
| 115 |
args = argparse.Namespace(
|
| 116 |
mixed_precision=False,
|
| 117 |
num_heads=1,
|
|
@@ -123,6 +125,7 @@ def get_sea_raft_model():
|
|
| 123 |
iters=12,
|
| 124 |
)
|
| 125 |
|
|
|
|
| 126 |
model = RAFT.from_pretrained("MemorySlices/Tartan-C-T-TSKH-spring540x960-S", args=args)
|
| 127 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 128 |
model = model.to(device).eval()
|
|
|
|
| 99 |
try:
|
| 100 |
import sys
|
| 101 |
import os
|
| 102 |
+
import argparse
|
| 103 |
+
|
| 104 |
# SEA-RAFT is cloned into /app/SEA-RAFT during Docker build
|
| 105 |
+
sea_raft_dir = os.environ.get("SEA_RAFT_DIR", "/app/SEA-RAFT")
|
| 106 |
if os.path.isdir(sea_raft_dir) and sea_raft_dir not in sys.path:
|
| 107 |
sys.path.insert(0, sea_raft_dir)
|
| 108 |
+
print(f"[init] Added SEA-RAFT to path: {sea_raft_dir}")
|
| 109 |
|
| 110 |
+
from core.raft import RAFT
|
| 111 |
+
from core.utils.utils import InputPadder
|
|
|
|
| 112 |
|
| 113 |
print("[init] Loading SEA-RAFT model (Small)...")
|
| 114 |
t0 = time.time()
|
| 115 |
|
| 116 |
+
# Model args for SEA-RAFT Small variant
|
| 117 |
args = argparse.Namespace(
|
| 118 |
mixed_precision=False,
|
| 119 |
num_heads=1,
|
|
|
|
| 125 |
iters=12,
|
| 126 |
)
|
| 127 |
|
| 128 |
+
# Load pre-trained from HuggingFace hub
|
| 129 |
model = RAFT.from_pretrained("MemorySlices/Tartan-C-T-TSKH-spring540x960-S", args=args)
|
| 130 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 131 |
model = model.to(device).eval()
|