-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathct2_main.py
37 lines (30 loc) · 1.24 KB
/
ct2_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import os
from pathlib import Path
import queue
from contextlib import contextmanager
def set_cuda_paths():
venv_base = Path(sys.executable).parent.parent
nvidia_base_path = venv_base / 'Lib' / 'site-packages' / 'nvidia'
cuda_path = nvidia_base_path / 'cuda_runtime' / 'bin'
cublas_path = nvidia_base_path / 'cublas' / 'bin'
cudnn_path = nvidia_base_path / 'cudnn' / 'bin'
paths_to_add = [str(cuda_path), str(cublas_path), str(cudnn_path)]
env_vars = ['CUDA_PATH', 'CUDA_PATH_V12_1', 'PATH']
for env_var in env_vars:
current_value = os.environ.get(env_var, '')
new_value = os.pathsep.join(paths_to_add + [current_value] if current_value else paths_to_add)
os.environ[env_var] = new_value
set_cuda_paths()
from PySide6.QtWidgets import QApplication
from ct2_gui import MyWindow
from ct2_utils import CheckQuantizationSupport
if __name__ == "__main__":
quantization_checker = CheckQuantizationSupport()
cuda_available = quantization_checker.has_cuda_device()
quantization_checker.update_supported_quantizations()
app = QApplication(sys.argv)
app.setStyle('Fusion')
window = MyWindow(cuda_available)
window.show()
sys.exit(app.exec())