niulx commited on
Commit
703ff84
1 Parent(s): 6d51956

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +18 -6
main.py CHANGED
@@ -8,12 +8,24 @@ from pipeline_dedit_sd import DEditSDPipeline
8
  from utils import load_image, load_mask, load_mask_edit
9
  from utils_mask import process_mask_move_torch, process_mask_remove_torch, mask_union_torch, mask_substract_torch, create_outer_edge_mask_torch
10
  from utils_mask import check_mask_overlap_torch, check_cover_all_torch, visualize_mask_list, get_mask_difference_torch, save_mask_list_to_npys
11
- print(torch.__version__)
12
- if torch.cuda.is_available():
13
- print("CUDA version:", torch.version.cuda)
14
- print("GPU model name:", torch.cuda.get_device_name(0))
15
- else:
16
- print('no cuda.')
 
 
 
 
 
 
 
 
 
 
 
 
17
  def run_main(
18
  name="example_tmp",
19
  name_2=None,
 
8
  from utils import load_image, load_mask, load_mask_edit
9
  from utils_mask import process_mask_move_torch, process_mask_remove_torch, mask_union_torch, mask_substract_torch, create_outer_edge_mask_torch
10
  from utils_mask import check_mask_overlap_torch, check_cover_all_torch, visualize_mask_list, get_mask_difference_torch, save_mask_list_to_npys
11
+
12
+ print("PyTorch 版本:", torch.__version__)
13
+ print("CUDA 版本:", torch.version.cuda)
14
+ print("CUDA 是否可用:", torch.cuda.is_available())
15
+ import subprocess
16
+
17
+ # 检查 nvidia-smi 命令的输出
18
+ try:
19
+ result = subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
20
+ print(result.stdout.decode())
21
+ except FileNotFoundError:
22
+ print("nvidia-smi 命令不可用,可能未安装 NVIDIA 驱动。")
23
+
24
+ device_count = torch.cuda.device_count()
25
+ print("可用的 CUDA 设备数量:", device_count)
26
+ for i in range(device_count):
27
+ print(f"设备 {i} 名称:", torch.cuda.get_device_name(i))
28
+
29
  def run_main(
30
  name="example_tmp",
31
  name_2=None,