File size: 4,092 Bytes
12a663d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230724b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12a663d
230724b
 
 
 
 
 
 
 
12a663d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230724b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12a663d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env python3
"""
Test script to verify all dependencies are working correctly
"""

import sys
import traceback

def test_imports():
    """Test importing all required dependencies"""
    print("Testing imports...")
    
    try:
        import torch
        print(f"βœ“ PyTorch {torch.__version__}")
        print(f"  CUDA available: {torch.cuda.is_available()}")
        if torch.cuda.is_available():
            print(f"  CUDA version: {torch.version.cuda}")
            print(f"  GPU count: {torch.cuda.device_count()}")
    except Exception as e:
        print(f"βœ— PyTorch import failed: {e}")
        return False
    
    # Check if torch-sparse is available or disabled
    try:
        import torch_sparse
        print("βœ“ torch-sparse")
    except ImportError:
        # Check if torch-sparse was disabled
        try:
            with open("NeuralJacobianFields/PoissonSystem.py", 'r') as f:
                content = f.read()
            if "USE_TORCH_SPARSE = False" in content:
                print("βœ“ torch-sparse (disabled, using built-in PyTorch sparse)")
            else:
                print("βœ— torch-sparse (not available)")
                return False
        except:
            print("βœ— torch-sparse (not available)")
            return False
    except Exception as e:
        print(f"βœ— torch-sparse import failed: {e}")
        return False
    
    # Check if torch-scatter is available (not critical)
    try:
        import torch_scatter
        print("βœ“ torch-scatter")
    except ImportError:
        print("⚠ torch-scatter (not available, may not be critical)")
    except Exception as e:
        print(f"⚠ torch-scatter import failed: {e} (may not be critical)")
    
    try:
        import nvdiffrast
        print("βœ“ nvdiffrast")
    except Exception as e:
        print(f"βœ— nvdiffrast import failed: {e}")
        return False
    
    try:
        import pytorch3d
        print("βœ“ PyTorch3D")
    except Exception as e:
        print(f"βœ— PyTorch3D import failed: {e}")
        return False
    
    try:
        import clip
        print("βœ“ CLIP")
    except Exception as e:
        print(f"βœ— CLIP import failed: {e}")
        return False
    
    return True

def test_basic_functionality():
    """Test basic functionality of key components"""
    print("\nTesting basic functionality...")
    
    try:
        import torch
        
        # Test basic tensor operations
        x = torch.randn(10, 10)
        y = torch.randn(10, 10)
        z = x + y
        print("βœ“ Basic tensor operations")
        
        # Test sparse operations (using built-in PyTorch sparse)
        indices = torch.randint(0, 10, (2, 20))
        values = torch.randn(20)
        sparse_tensor = torch.sparse_coo_tensor(indices, values, (10, 10))
        print("βœ“ Sparse tensor creation")
        
        # Test if torch-sparse is available (optional)
        try:
            import torch_sparse
            print("βœ“ torch-sparse operations available")
        except ImportError:
            print("βœ“ Using built-in PyTorch sparse operations")
        
        # Test if torch-scatter is available (optional)
        try:
            import torch_scatter
            print("βœ“ torch-scatter operations available")
        except ImportError:
            print("βœ“ torch-scatter not available (not critical)")
        
    except Exception as e:
        print(f"βœ— Basic functionality test failed: {e}")
        traceback.print_exc()
        return False
    
    return True

def main():
    """Main test function"""
    print("=== Garment3DGen Dependency Test ===\n")
    
    # Test imports
    if not test_imports():
        print("\n❌ Import tests failed!")
        sys.exit(1)
    
    # Test basic functionality
    if not test_basic_functionality():
        print("\n❌ Functionality tests failed!")
        sys.exit(1)
    
    print("\nβœ… All tests passed! Dependencies are working correctly.")
    print("The Garment3DGen application should be ready to run.")

if __name__ == "__main__":
    main()