mahdideveloepr commited on
Commit
f291ac5
·
verified ·
1 Parent(s): f6ea7e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -16,8 +16,15 @@ from huggingface_hub import hf_hub_download
16
  # بررسی دسترسی به GPU
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
18
  dtype = torch.bfloat16 if torch.cuda.is_available() and torch.cuda.get_device_name(0).startswith("A100") else torch.float16
 
19
  if torch.cuda.is_available():
20
- print(f"✅ CUDA is available! GPU: {torch.cuda.get_device_name(0)}")
 
 
 
 
 
 
21
  else:
22
  print("❌ No CUDA GPUs are available. Switching to CPU.")
23
 
 
16
  # بررسی دسترسی به GPU
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
18
  dtype = torch.bfloat16 if torch.cuda.is_available() and torch.cuda.get_device_name(0).startswith("A100") else torch.float16
19
+
20
  if torch.cuda.is_available():
21
+ num_gpus = torch.cuda.device_count()
22
+ if num_gpus > 1:
23
+ print(f"✅ {num_gpus} CUDA GPUs are available!")
24
+ for i in range(num_gpus):
25
+ print(f"GPU {i}: {torch.cuda.get_device_name(i)}")
26
+ else:
27
+ print(f"✅ CUDA is available! GPU: {torch.cuda.get_device_name(0)}")
28
  else:
29
  print("❌ No CUDA GPUs are available. Switching to CPU.")
30