SegEarth-OV / test_pipelines.py
BiliSakura's picture
Update all files for SegEarth-OV
2edca4c verified
#!/usr/bin/env python3
"""Test all SegEarth pipelines load correctly. Run: conda activate ifedit && python test_pipelines.py [OV|OV-2|OV-3]"""
import sys
def main():
from pipeline import SegEarthPipeline
device = sys.argv[2] if len(sys.argv) > 2 else "cuda"
variants = [("OV", device), ("OV-2", device), ("OV-3", device)]
if len(sys.argv) > 1:
want = sys.argv[1]
variants = [(v, d) for v, d in variants if v == want]
if not variants:
print(f"Unknown variant: {want}")
sys.exit(1)
for variant, device in variants:
print(f"Loading {variant}...", end=" ", flush=True)
try:
pipe = SegEarthPipeline(variant=variant, device=device)
print("OK")
except ImportError as e:
if "sam3" in str(e) and variant == "OV-3":
print("SKIP (sam3 not installed)")
else:
print(f"FAIL: {e}")
raise
except Exception as e:
print(f"FAIL: {e}")
raise
print("All pipelines loaded successfully.")
if __name__ == "__main__":
main()