Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,4 +2,18 @@ import torch
|
|
2 |
device = f'cuda:0' if torch.cuda.is_available() else 'cpu'
|
3 |
print('device:', device)
|
4 |
torch_version = torch.__version__
|
5 |
-
print('torch_version:', torch_version)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
device = f'cuda:0' if torch.cuda.is_available() else 'cpu'
|
3 |
print('device:', device)
|
4 |
torch_version = torch.__version__
|
5 |
+
print('torch_version:', torch_version)
|
6 |
+
|
7 |
+
# 获取服务器cuda版本
|
8 |
+
def get_cuda_version():
|
9 |
+
try:
|
10 |
+
import torch
|
11 |
+
cuda_version = torch.version.cuda
|
12 |
+
if cuda_version is None:
|
13 |
+
return "CUDA version not found"
|
14 |
+
return cuda_version
|
15 |
+
except ImportError:
|
16 |
+
return "PyTorch is not installed"
|
17 |
+
|
18 |
+
cuda_version = get_cuda_version()
|
19 |
+
print('cuda_version:', cuda_version)
|