Spaces:
Paused
Paused
Upload post_install.py
Browse files- post_install.py +25 -14
post_install.py
CHANGED
@@ -71,22 +71,20 @@ def install_torch_sparse():
|
|
71 |
|
72 |
if pytorch_base.startswith("2.7"):
|
73 |
print("PyTorch 2.7.x detected - this is very recent and may not have compatible wheels")
|
74 |
-
print("
|
75 |
|
76 |
-
#
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
79 |
|
80 |
-
# Install
|
81 |
-
print("Installing PyTorch
|
82 |
-
if run_command("pip install
|
83 |
-
|
84 |
-
CUDA_VERSION = "cu117"
|
85 |
-
print("Successfully installed PyTorch 2.0.1+cu117")
|
86 |
-
else:
|
87 |
-
print("Failed to install PyTorch 2.0.1+cu117, keeping current version")
|
88 |
-
PYTORCH_VERSION = pytorch_base
|
89 |
-
CUDA_VERSION = cuda_version
|
90 |
else:
|
91 |
# Store version info for later use
|
92 |
PYTORCH_VERSION = pytorch_base
|
@@ -515,6 +513,17 @@ def main():
|
|
515 |
print("β torch-sparse (not available)")
|
516 |
except:
|
517 |
print("β torch-sparse (not available)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
# Check if torch-scatter is available
|
520 |
try:
|
@@ -522,6 +531,8 @@ def main():
|
|
522 |
print("β torch-scatter")
|
523 |
except ImportError:
|
524 |
print("β torch-scatter (not available, may not be critical)")
|
|
|
|
|
525 |
|
526 |
import nvdiffrast
|
527 |
print("β nvdiffrast")
|
|
|
71 |
|
72 |
if pytorch_base.startswith("2.7"):
|
73 |
print("PyTorch 2.7.x detected - this is very recent and may not have compatible wheels")
|
74 |
+
print("Attempting to work with current PyTorch version and disable problematic extensions...")
|
75 |
|
76 |
+
# Keep current PyTorch version but disable torch-sparse and torch-scatter
|
77 |
+
PYTORCH_VERSION = pytorch_base
|
78 |
+
CUDA_VERSION = cuda_version
|
79 |
+
|
80 |
+
# Force disable torch-sparse and torch-scatter since they have ABI issues
|
81 |
+
print("Disabling torch-sparse and torch-scatter due to ABI compatibility issues...")
|
82 |
+
disable_torch_sparse()
|
83 |
|
84 |
+
# Install torchvision for current PyTorch version
|
85 |
+
print("Installing torchvision for current PyTorch version...")
|
86 |
+
if not run_command("pip install torchvision"):
|
87 |
+
print("Warning: Failed to install torchvision")
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
else:
|
89 |
# Store version info for later use
|
90 |
PYTORCH_VERSION = pytorch_base
|
|
|
513 |
print("β torch-sparse (not available)")
|
514 |
except:
|
515 |
print("β torch-sparse (not available)")
|
516 |
+
except Exception as e:
|
517 |
+
# Check if torch-sparse was disabled due to ABI issues
|
518 |
+
try:
|
519 |
+
with open("NeuralJacobianFields/PoissonSystem.py", 'r') as f:
|
520 |
+
content = f.read()
|
521 |
+
if "USE_TORCH_SPARSE = False" in content:
|
522 |
+
print("β torch-sparse (disabled due to ABI issues, using built-in PyTorch sparse)")
|
523 |
+
else:
|
524 |
+
print(f"β torch-sparse import failed: {e}")
|
525 |
+
except:
|
526 |
+
print(f"β torch-sparse import failed: {e}")
|
527 |
|
528 |
# Check if torch-scatter is available
|
529 |
try:
|
|
|
531 |
print("β torch-scatter")
|
532 |
except ImportError:
|
533 |
print("β torch-scatter (not available, may not be critical)")
|
534 |
+
except Exception as e:
|
535 |
+
print(f"β torch-scatter import failed: {e} (may not be critical)")
|
536 |
|
537 |
import nvdiffrast
|
538 |
print("β nvdiffrast")
|