Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Show the detected graphics card on the missing-driver card
Bowen Xue7c99a8350108
diff --git a/freevideo_engine/display_adapters.py b/freevideo_engine/display_adapters.pynew file mode 100644index 0000000..a8d08dc--- /dev/null+++ b/freevideo_engine/display_adapters.py@@ -0,0 +1,105 @@+"""Names of the graphics adapters the operating system lists, without any vendor driver.++Used only to say what was seen on a setup card. None means the lookup itself failed,+which is different from a computer that lists no NVIDIA adapter.+"""+import os+import re+import subprocess++DISPLAY_CLASS = r'SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11cf-bfc1-08002be10318}'+BASIC = re.compile(r'basic (?:display|render)', re.I)+NVIDIA = 'NVIDIA'+NVIDIA_NAME = re.compile(r'nvidia|geforce|quadro|rtx|tesla', re.I)+OTHER_VENDOR = re.compile(r'\bamd\b|radeon|\bati\b|intel', re.I)+VIRTUAL = re.compile(r'basic (?:display|render)|remote|virtual|indirect|mirror|hyper-v|vmware|parsec', re.I)+++def windows_names():+ import winreg+ names = []+ with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, DISPLAY_CLASS) as head:+ index = 0+ while True:+ try:+ slot = winreg.EnumKey(head, index)+ except OSError:+ break+ index += 1+ if not slot.isdigit():+ continue+ try:+ with winreg.OpenKey(head, slot) as key:+ value, _ = winreg.QueryValueEx(key, 'DriverDesc')+ try:+ ids, _ = winreg.QueryValueEx(key, 'MatchingDeviceId')+ except OSError:+ ids = None+ except OSError:+ continue+ names.append((str(value), None if ids is None else str(ids)))+ return names+++def linux_names():+ out = subprocess.run(['lspci', '-mm'], capture_output=True, text=True, timeout=10, check=True).stdout+ names = []+ for line in out.splitlines():+ fields = re.findall(r'"([^"]*)"', line)+ if len(fields) >= 3 and re.search(r'VGA|3D|Display', fields[0]):+ names.append(' '.join(fields[1:3]))+ return names+++def adapters():+ """Adapter names in system order, or None when the system could not be asked."""+ try:+ names = windows_names() if os.name == 'nt' else linux_names()+ except (ImportError, OSError, ValueError, subprocess.SubprocessError):+ return None+ seen, unknown = [], False+ for entry in names:+ name, ids = (entry, '') if isinstance(entry, str) else entry+ name = ' '.join(name.split())+ if BASIC.search(name):+ # Without a driver a card is listed by this name; its PCI vendor says whose it is.+ # The matched ID of a driverless card is often only the display class (PCI\CC_0300), without a vendor.+ if ids is None or 'ven_' not in ids.lower():+ unknown = True+ continue+ if 'ven_10de' in ids.lower():+ name = NVIDIA+ else:+ continue+ if name and (name == NVIDIA or not VIRTUAL.search(name)) and name not in seen:+ seen.append(name)+ # An adapter of unknown vendor may be the missing NVIDIA card, so "none detected" would mislead.+ if unknown and not any(NVIDIA_NAME.search(name) for name in seen):+ return None+ return seen+++def detected_line(zh):+ return line(zh, adapters())+++def only_other_vendors(names):+ """True when the system lists an AMD or Intel adapter and no NVIDIA one; False when the lookup failed."""+ return bool(names) and not any(NVIDIA_NAME.search(name) for name in names) \+ and any(OTHER_VENDOR.search(name) for name in names)+++def line(zh, names):+ """The one line for a "no NVIDIA driver" card; empty when detection itself failed."""+ if names is None:+ return ''+ nvidia = sorted((name for name in names if NVIDIA_NAME.search(name)),+ key=lambda name: name == NVIDIA)+ if nvidia == [NVIDIA]:+ return '检测到:NVIDIA 显卡' if zh else 'Detected: NVIDIA graphics card'+ if nvidia:+ return ('检测到:' if zh else 'Detected: ') + nvidia[0]+ other = '、'.join(names[:2]) if zh else ', '.join(names[:2])+ if zh:+ return '未检测到 NVIDIA 显卡' + ('(%s)' % other if other else '')+ return 'No NVIDIA graphics card detected' + (' (%s)' % other if other else '')diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.pyindex 86c3b7f..8ddf096 100644--- a/freevideo_engine/failure_details.py+++ b/freevideo_engine/failure_details.py@@ -367,6 +367,14 @@ def _without_ready_curl_diagnostics(text):return ''.join(lines)+# Shown instead of the missing-driver card when the system lists only AMD or Intel graphics.+UNSUPPORTED_VENDOR = (+ ('FreeVideo supports NVIDIA graphics cards only',+ 'Installing a driver cannot change this. Use FreeVideo on a computer with an NVIDIA graphics card.'),+ ('FreeVideo 只支持 NVIDIA 显卡',+ '安装驱动无法改变这一点,请在装有 NVIDIA 显卡的电脑上使用 FreeVideo。'))++# What each download source returned, as one short line per host and route on# the failure card. The full lines stay in the copied error and the report.SOURCE_REASONS = {@@ -651,7 +659,7 @@ def _launcher_failure(value, *, zh=False, other_disk=False, disk_name='', can_re(r'NVIDIA driver/nvidia-smi is missing\.', 'gpu-driver-missing',('No NVIDIA driver was found', '未找到 NVIDIA 显卡驱动'),('If this computer has an NVIDIA graphics card, install NVIDIA driver 580 or newer, '- 'restart the computer, then click Retry installation.',+ 'restart the computer, then click "Retry installation".','如果这台电脑有 NVIDIA 显卡,请安装 580 或更新版本的 NVIDIA 显卡驱动,重启电脑后点击“重试安装”。')),(r'NVIDIA driver(?: [\w.]+)?(?: \([^)]*\))? is older than 580', 'gpu-driver-old',('The NVIDIA driver is too old', 'NVIDIA 显卡驱动版本过低'),@@ -725,7 +733,7 @@ def _launcher_failure(value, *, zh=False, other_disk=False, disk_name='', can_re(ENVIRONMENT_PYTHON_REMOVED, 'environment-python-removed',('A program file is missing', '缺少一个程序文件'),('It may have been quarantined by security software. Restore the file or allow the FreeVideo folder, '- 'then click Retry installation.',+ 'then click "Retry installation".','可能被安全软件隔离了。恢复这个文件或允许 FreeVideo 所在的文件夹后,点“重试安装”。')),# Windows refuses PyTorch's unsigned DLLs under Smart App Control; reinstalling changes nothing.(r'WinError 4551|Application Control policy has blocked', 'app-control',diff --git a/freevideo_engine/launcher/Main.qml b/freevideo_engine/launcher/Main.qmlindex 176ac12..49a6e8c 100644--- a/freevideo_engine/launcher/Main.qml+++ b/freevideo_engine/launcher/Main.qml@@ -444,6 +444,7 @@ ApplicationWindow {id: failureBody; x: 18; y: 18; width: parent.width - 36; spacing: 10FText { text: s.failure.title || t("Something went wrong", "出现问题"); color: theme.danger; font.weight: Font.DemiBold; Layout.fillWidth: true }FText { visible: !!(s.failure.detail || s.failure.action); text: s.failure.detail || s.failure.action; color: theme.text; Layout.fillWidth: true }+ FText { visible: !!s.failure.note; text: s.failure.note || ""; color: theme.muted; Layout.fillWidth: true }// What each download source returned: one short line per source.FText { objectName: "failureSources"; visible: !!s.failure.sources; text: sourceLines(s.failure.sources); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true }TextEdit {diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.pyindex 3d7b718..a3149e7 100644--- a/freevideo_engine/launcher_session.py+++ b/freevideo_engine/launcher_session.py@@ -2253,6 +2253,15 @@ class Session:from .sampling_assets import total_bytesfailure = launcher_failure(error, zh=self.language.startswith('zh'), can_repair=self.can_repair(),repairs_comfy=self.repairs_comfy(), unavailable=self.repair_unavailable())+ if failure.get('kind') == 'gpu-driver-missing':+ from .display_adapters import adapters, line, only_other_vendors+ zh = self.language.startswith('zh')+ names = adapters()+ if line(zh, names):+ failure['note'] = line(zh, names)+ if only_other_vendors(names):+ from .failure_details import UNSUPPORTED_VENDOR+ failure['title'], failure['action'] = UNSUPPORTED_VENDOR[1 if zh else 0]if failure.get('path'):# The local repair instruction needs the actual file location; copied details stay redacted.from .model_repair import MISMATCH_PATH