niulx commited on
Commit
ddd0257
1 Parent(s): e9320c7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -35
main.py CHANGED
@@ -9,41 +9,6 @@ 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
-
13
- import os
14
- import ctypes
15
- import torch
16
-
17
- # 设置 LD_LIBRARY_PATH
18
- nvidia_lib_path = '/usr/lib/x86_64-linux-gnu'
19
- os.environ['LD_LIBRARY_PATH'] = nvidia_lib_path + ':' + os.environ.get('LD_LIBRARY_PATH', '')
20
- print("LD_LIBRARY_PATH 已设置为:", os.environ['LD_LIBRARY_PATH'])
21
-
22
- # 尝试加载 libnvidia-ml.so
23
- try:
24
- ctypes.CDLL('libnvidia-ml.so')
25
- print("成功加载 libnvidia-ml.so。")
26
- except Exception as e:
27
- print("无法加载 libnvidia-ml.so,错误信息:", e)
28
-
29
- # 尝试加载 libcuda.so
30
- try:
31
- ctypes.CDLL('libcuda.so')
32
- print("成功加载 libcuda.so。")
33
- except Exception as e:
34
- print("无法加载 libcuda.so,错误信息:", e)
35
-
36
- # 检查 CUDA 是否可用
37
- print("CUDA 是否可用:", torch.cuda.is_available())
38
- print("可用的 CUDA 设备数量:", torch.cuda.device_count())
39
-
40
- # 尝试在 CUDA 上创建张量
41
- try:
42
- x = torch.tensor([1.0], device='cuda')
43
- print("CUDA 张量创建成功:", x)
44
- except Exception as e:
45
- print("无法在 CUDA 上创建张量,错误信息:", e)
46
-
47
 
48
  def run_main(
49
  name="example_tmp",
 
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
 
13
  def run_main(
14
  name="example_tmp",