MCPcopy
hub / github.com/Huanshere/VideoLingo / check_nvidia_gpu

Function check_nvidia_gpu

install.py:18–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16 subprocess.check_call([sys.executable, "-m", "pip", "install", *packages])
17
18def 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
44def check_ffmpeg():
45 from rich.console import Console

Callers 1

mainFunction · 0.85

Calls 1

install_packageFunction · 0.85

Tested by

no test coverage detected