Spaces:
Paused
Paused
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() |