()
| 16 | subprocess.check_call([sys.executable, "-m", "pip", "install", *packages]) |
| 17 | |
| 18 | def check_nvidia_gpu(): |
| 19 | install_package("nvidia-ml-py") |
| 20 | import pynvml |
| 21 | from translations.translations import translate as t |
| 22 | initialized = False |
| 23 | try: |
| 24 | pynvml.nvmlInit() |
| 25 | initialized = True |
| 26 | device_count = pynvml.nvmlDeviceGetCount() |
| 27 | if device_count > 0: |
| 28 | print(t("Detected NVIDIA GPU(s)")) |
| 29 | for i in range(device_count): |
| 30 | handle = pynvml.nvmlDeviceGetHandleByIndex(i) |
| 31 | name = pynvml.nvmlDeviceGetName(handle) |
| 32 | print(f"GPU {i}: {name}") |
| 33 | return True |
| 34 | else: |
| 35 | print(t("No NVIDIA GPU detected")) |
| 36 | return False |
| 37 | except pynvml.NVMLError: |
| 38 | print(t("No NVIDIA GPU detected or NVIDIA drivers not properly installed")) |
| 39 | return False |
| 40 | finally: |
| 41 | if initialized: |
| 42 | pynvml.nvmlShutdown() |
| 43 | |
| 44 | def check_ffmpeg(): |
| 45 | from rich.console import Console |
no test coverage detected