Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,31 @@ dtype = torch.bfloat16
|
|
| 18 |
torch.backends.cuda.matmul.allow_tf32 = True
|
| 19 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
login(token=huggingface_token)
|
| 24 |
# Set up environment and cache
|
|
|
|
| 18 |
torch.backends.cuda.matmul.allow_tf32 = True
|
| 19 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
| 20 |
|
| 21 |
+
import shutil
|
| 22 |
+
|
| 23 |
+
def find_cuda():
|
| 24 |
+
# Check if CUDA_HOME or CUDA_PATH environment variables are set
|
| 25 |
+
cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
|
| 26 |
+
|
| 27 |
+
if cuda_home and os.path.exists(cuda_home):
|
| 28 |
+
return cuda_home
|
| 29 |
+
|
| 30 |
+
# Search for the nvcc executable in the system's PATH
|
| 31 |
+
nvcc_path = shutil.which('nvcc')
|
| 32 |
+
|
| 33 |
+
if nvcc_path:
|
| 34 |
+
# Remove the 'bin/nvcc' part to get the CUDA installation path
|
| 35 |
+
cuda_path = os.path.dirname(os.path.dirname(nvcc_path))
|
| 36 |
+
return cuda_path
|
| 37 |
+
|
| 38 |
+
return None
|
| 39 |
+
|
| 40 |
+
cuda_path = find_cuda()
|
| 41 |
+
|
| 42 |
+
if cuda_path:
|
| 43 |
+
print(f"CUDA installation found at: {cuda_path}")
|
| 44 |
+
else:
|
| 45 |
+
print("CUDA installation not found")
|
| 46 |
|
| 47 |
login(token=huggingface_token)
|
| 48 |
# Set up environment and cache
|