File size: 1,133 Bytes
fabc606
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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()