diff --git a/README.md b/README.md index 6ee24282..be7f537b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@
English · 中文
-Make videos on the computer you already own. Powered by [Video DeltaNet (VDN)](https://openvdn.github.io/), FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, with acceleration adapted to your hardware. +Make videos on the computer you already own. Powered by [Video DeltaNet (VDN)](https://openvdn.github.io/), FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM on NVIDIA graphics cards with compute capability 8.0 or higher (such as the RTX 30 series or newer, professional cards included), with acceleration adapted to your hardware. Apple silicon Macs run a preview. https://github.com/user-attachments/assets/ecda7d0d-7fbe-4e0c-8c29-8f3315bafc15 @@ -36,7 +36,7 @@ FreeVideo is a local inference engine for MiniMax H3 on consumer GPUs, built on It coordinates VRAM, system memory and disk, adapting weight placement, compute precision and attention kernels to the available hardware. FreeVideo runs as a ComfyUI plugin, with launchers for Windows, macOS and Linux. Its core features include: -- **Hardware-adaptive execution**: Chooses the weight format for each GPU, int8 on GeForce and RTX 30-series cards and FP8 on workstation and datacenter cards, and automatically probes the available attention kernels. +- **Hardware-adaptive execution**: Chooses the weight format for each GPU, int8 on GeForce RTX 30, 40 and 50 series cards and other Ampere cards, and FP8 on workstation and datacenter cards of newer architectures, and automatically probes the available attention kernels. - **Low-memory inference**: Weight streaming, asynchronous prefetching and chunked computation keep peak memory low, enabling inference with as little as 8 GB of VRAM and 16 GB of RAM. - **Multimodal inputs**: Text prompts, first and last frames, and image, video and audio references. - **Community LoRAs**: Use MiniMax H3 LoRAs in your workflow. See [examples](docs/LoRA.md). diff --git a/README.zh-CN.md b/README.zh-CN.md index 7851a946..6139a7e4 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -11,7 +11,7 @@English · 中文
-FreeVideo 由 [Video DeltaNet(VDN)](https://openvdn.github.io/) 驱动,让 MiniMax H3 能够在消费级显卡上本地运行,最低只需 8GB 显存和 16GB 内存,并会根据硬件配置自动选择合适的加速路径。 +FreeVideo 由 [Video DeltaNet(VDN)](https://openvdn.github.io/) 驱动,让 MiniMax H3 能够在计算能力 8.0 及以上的 NVIDIA 显卡(如 RTX 30 系列及更新,包括专业卡)上本地运行,最低只需 8GB 显存和 16GB 内存,并会根据硬件配置自动选择合适的加速路径。Apple 芯片 Mac 为预览版。 https://github.com/user-attachments/assets/ecda7d0d-7fbe-4e0c-8c29-8f3315bafc15 @@ -36,7 +36,7 @@ FreeVideo 是面向消费级显卡的 MiniMax H3 本地推理引擎,基于 [Op 它统一调度显存、内存与磁盘,并根据硬件条件调整权重放置、计算精度和注意力内核。FreeVideo 以 ComfyUI 插件形式提供,配备 Windows、macOS 和 Linux 启动器。主要特性包括: -- **硬件自适应**:针对不同显卡选择权重格式(GeForce 和 RTX 30 系用 int8,专业卡和数据中心卡用 FP8),并自动探测可用的注意力内核,无需手动配置。 +- **硬件自适应**:针对不同显卡选择权重格式(GeForce RTX 30、40、50 系列和其他 Ampere 架构的显卡用 int8,更新架构的专业卡和数据中心卡用 FP8),并自动探测可用的注意力内核,无需手动配置。 - **低显存推理**:通过权重流式加载、异步预取与分块计算降低峰值显存,最低只需 8GB 显存和 16GB 内存。 - **多模态输入**:支持文本、首帧、尾帧,以及图像、视频、音频参考输入。 - **社区 LoRA**:支持在工作流中使用 MiniMax H3 社区 LoRA。[查看效果对比](docs/LoRA.zh-CN.md)。 diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index aa009dd4..93fba186 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -23,6 +23,7 @@ FreeVideo code uses [Apache-2.0](LICENSE). Its dependencies and models retain th | [Qwen-Image-2.1](https://huggingface.co/Comfy-Org/Qwen-Image-2.1) Turbo image generation models, including Qwen3-VL-8B and VAE (optional download; [notice](freevideo_engine/image_gen/licenses/NOTICE.txt) installed with the models), © 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved. | [Qwen RESEARCH LICENSE AGREEMENT](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/LICENSE) | | [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) 1.13.8 speech runtime, built by FreeVideo without text-to-speech, ALSA and PortAudio (modified build; `__init__.py` edited; source snapshot 11afbd00 kept by FreeVideo; optional download for automatic subtitles, [build note](freevideo_engine/licenses/sherpa-onnx-build-NOTE.txt)). Includes statically linked kaldi-native-fbank, kaldi-decoder, kaldifst, OpenFst, simple-sentencepiece (Apache-2.0), KissFFT (BSD-3-Clause), pybind11 (BSD-3-Clause), nlohmann/json (MIT), hclust-cpp and Darts-clone (BSD-2-Clause), ThreadPool (Zlib). The Windows build also contains msvcp140.dll and msvcp140_1.dll (Microsoft Visual C++ 2022 runtime 14.44.35211, © Microsoft Corporation), unmodified and redistributed as permitted by Microsoft for its redistributable files. | Apache-2.0 | | [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) code adapted for dubbing and [Fun-CosyVoice3-0.5B-2512](https://modelscope.cn/models/FunAudioLLM/Fun-CosyVoice3-0.5B-2512) weights, © 2024 Alibaba Inc (optional download); includes MIT-licensed parts of Matcha-TTS, HiFi-GAN, x_transformers and Snake | [Apache-2.0](freevideo_engine/licenses/CosyVoice-Apache-2.0.txt); [MIT notices](freevideo_engine/licenses/CosyVoice-NOTICE.txt) | +| [PyTorch](https://github.com/pytorch/pytorch) 2.14.0, torchvision 0.29.0 and torchaudio 2.11.1 for Windows on Arm (CUDA 13.4 builds by NVIDIA; setup downloads them unchanged from NVIDIA's package index, pypi.nvidia.com), © PyTorch contributors. The wheels contain further libraries, including NVIDIA's CUDA runtime, cuBLAS, NVBLAS, cuFFT, cuRAND, cuSOLVER, cuSPARSE, NPP, nvJPEG, NVRTC, nvJitLink, nvFatbin, CUPTI, the performance-counter libraries (nvperf), cuDLA and cuDNN, © NVIDIA Corporation; Arm Performance Libraries (armpl), © Arm Limited; libuv; and, in torchvision, libjpeg (jpeg62.dll), libwebp (with libsharpyuv) and the Microsoft Visual C++ runtime (msvcp140.dll) | PyTorch, torchvision and torchaudio: BSD-style and the licenses in each wheel's `licenses` folder; NVIDIA libraries: [CUDA Toolkit EULA](https://docs.nvidia.com/cuda/eula/index.html) and, for cuDNN, [NVIDIA Software License Agreement for SDKs and the cuDNN supplement](https://docs.nvidia.com/deeplearning/cudnn/latest/reference/eula.html); the other libraries: their own licenses | | [ONNX Runtime](https://github.com/microsoft/onnxruntime) 1.28.2 (CPU), © Microsoft Corporation; its third-party notices are shipped inside the sherpa-onnx wheel | MIT | | [Eigen](https://gitlab.com/libeigen/eigen) 5.0.1, compiled into sherpa-onnx and ONNX Runtime; source: https://gitlab.com/libeigen/eigen/-/tree/5.0.1 | MPL-2.0 | | [Silero VAD](https://github.com/snakers4/silero-vad) v5.0 voice-activity model, © 2020-present Silero Team (optional download with subtitles, license file downloaded with the model; the onnx-community export is downloaded with the music model) | [MIT](freevideo_engine/licenses/Silero-VAD-MIT.txt) | diff --git a/constraints/windows-arm64.txt b/constraints/windows-arm64.txt index 832be1d6..aa1e9d6f 100644 --- a/constraints/windows-arm64.txt +++ b/constraints/windows-arm64.txt @@ -82,7 +82,7 @@ sqlalchemy==2.0.52 sympy==1.14.0 tokenizers==0.23.0rc0 torch==2.14.0+cu134 -torchaudio==2.11.0+cu134 +torchaudio==2.11.1+cu134 torchsde==0.2.6 torchvision==0.29.0+cu134 tqdm==4.70.0 diff --git "a/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md" "b/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md" index 8b3d4243..2cc1eb02 100644 --- "a/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md" +++ "b/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md" @@ -21,7 +21,7 @@ 3. 需要源视频的声音时,勾选“保留源视频声音”。 4. 描述可以留空,也可以补充画面要求;然后点“生成视频”。 -源视频里有多个人时,可以继续添加人物图(最多 2 张),人物图按画面中人物从左到右的顺序对应;只有一张人物图时,与原来相同。替换人物不能与首帧、尾帧同时使用。首次使用时会自动下载替换人物模型(约 80 MB),面板中显示进度,下载完成后才能生成。源视频至少 1 秒;源视频没有声音时,不能保留声音。 +源视频里有多个人时,可以继续添加人物图(最多 2 张),人物图按画面中人物从左到右的顺序对应;只有一张人物图时,与原来相同。替换人物与首帧、尾帧请选其一使用。首次使用时会自动下载替换人物模型(约 80 MB),面板中显示进度,下载完成后才能生成。源视频至少 1 秒;源视频没有声音时,不能保留声音。 ## 首帧、尾帧和参考的区别 diff --git a/freevideo.ps1 b/freevideo.ps1 index 49ee3489..aaad2748 100644 --- a/freevideo.ps1 +++ b/freevideo.ps1 @@ -190,6 +190,29 @@ try { } & $freevideoPython @freevideoPythonPrefix -B -X utf8 -m freevideo_engine.managed @freevideoArguments $freevideoExit = $LASTEXITCODE + if ($freevideoExit -gt 127 -or $freevideoExit -lt 0) { + # A crash or a blocked start prints nothing, so the exit code was all a report held. + # The note is best effort and never changes the exit code. + $freevideoDiagErrorMode = $ErrorActionPreference + try { + $ErrorActionPreference = 'Continue' + $freevideoDiagHex = '0x{0:X8}' -f [BitConverter]::ToUInt32([BitConverter]::GetBytes([int]$freevideoExit), 0) + $freevideoDiagPresent = Test-Path -LiteralPath $freevideoPython -PathType Leaf + $freevideoDiagProbe = 'not run' + if ($freevideoDiagPresent) { + $freevideoDiagText = (& $freevideoPython @freevideoPythonPrefix -B -X utf8 -c 'import sys; print(sys.version.split()[0])' 2>&1 | Select-Object -First 1 | Out-String).Trim() + if ($freevideoDiagText.Length -gt 80) { $freevideoDiagText = $freevideoDiagText.Substring(0, 80) } + $freevideoDiagProbe = 'exit code ' + $LASTEXITCODE + ', printed: ' + $freevideoDiagText + } + $freevideoDiagNote = 'The setup step ended with exit code ' + $freevideoExit + ' (' + $freevideoDiagHex + '). Python file present: ' + $freevideoDiagPresent + '; a short check of it ended with ' + $freevideoDiagProbe + '; Python path: ' + $freevideoPython + Write-Host $freevideoDiagNote + [IO.Directory]::CreateDirectory($bootstrapRoot) | Out-Null + [IO.File]::AppendAllText((Join-Path $bootstrapRoot 'bootstrap.log'), ('[' + [DateTime]::UtcNow.ToString('o') + '] ' + $freevideoDiagNote + [Environment]::NewLine), (New-Object System.Text.UTF8Encoding($false))) + } catch { + } finally { + $ErrorActionPreference = $freevideoDiagErrorMode + } + } } catch { Write-Host ("FreeVideo could not start: " + $_.Exception.Message) -ForegroundColor Red Write-Host 'Existing files are retained. Retry the same command after resolving the reported issue.' diff --git a/freevideo_engine/agent/routes.py b/freevideo_engine/agent/routes.py index 9f2f7bdc..f7a1c129 100644 --- a/freevideo_engine/agent/routes.py +++ b/freevideo_engine/agent/routes.py @@ -199,12 +199,25 @@ def voice_state(port): return ready, not ready and bool(info.get('supported')) and bool(info.get('published', True)) +def voice_later(port): + """A Windows on Arm computer, for which no dubbing runtime is published yet: the page says so where the download would be.""" + from ..environments import windows_arm64 + service = getattr(port.server, '_freevideo_dubbing', None) + if service is None or not windows_arm64(): + return False + try: + info = service.info(wait=False) + except (OSError, ValueError): + return False + return not info.get('ready') and not info.get('supported') + + def voice_ready(port): """Whether the dubbing model that changes a voice is on this machine.""" return voice_state(port)[0] -def features(continuation, vlm, stems=False, voice=True, voice_install=False, fps=False): +def features(continuation, vlm, stems=False, voice=True, voice_install=False, fps=False, voice_later=False): """What an agent can use here (ready says whether the engine can run now). A missing name is not offered.""" from .editor_runtime import available rules = available() @@ -220,6 +233,8 @@ def features(continuation, vlm, stems=False, voice=True, voice_install=False, fp 'projects.stems': bool(rules and stems), 'projects.voice': bool(rules and stems and voice), # The machine could change a voice but the dubbing model is not there yet: the page offers its download. 'projects.voice.install': bool(rules and stems and voice_install and not voice), + # Windows on Arm: no dubbing runtime for this computer yet; the page says so in the same place. + **({'projects.voice.later': True} if rules and stems and voice_later and not voice else {}), # 48/60 fps export makes the frames in between on the graphics card (far too slow without one). 'projects.export.fps': bool(rules and fps)} @@ -261,7 +276,7 @@ def capabilities(port, jobs): api_version=API_VERSION, freevideo_version=release or __version__, build=__version__, ready=ready, problem=problem, continuation=continuation, features=features(continuation, vlm, stems=stems_supported(machine), voice=voice[0], voice_install=voice[1], - fps=bool(machine) and machine.get('device_backend', 'cuda') == 'cuda'), + fps=bool(machine) and machine.get('device_backend', 'cuda') == 'cuda', voice_later=voice_later(port)), whitebox=whitebox_support(jobs), device=dict(backend=machine.get('device_backend', 'cuda') if machine else None, vram_limit_gib=machine.get('vram_gib'), ram_limit_gib=machine.get('ram_gib')), diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py index 4c0738f6..d85cc0ae 100644 --- a/freevideo_engine/bootstrap.py +++ b/freevideo_engine/bootstrap.py @@ -31,7 +31,7 @@ from .install_tuning import build_parallelism, required_models, cache_compatible, wheel_key from .terminal_ui import TerminalUI, LogProgress from .locking import runtime_lock, LOCK_ENV -from .environments import (ENVIRONMENTS, environment_names, select_layout, role_pythons, constraints_file, setup_supported, uv_folder, conda_lock, conda_triple, +from .environments import (ENVIRONMENTS, environment_spec, windows_arm64, environment_native_arm64, environment_names, select_layout, role_pythons, constraints_file, setup_supported, uv_folder, conda_lock, conda_triple, bootstrap_versions, uv_file_arguments, uv_build_environment) from . import disk_space from . import network @@ -170,7 +170,7 @@ def reinstall_download_bytes(dependencies, system, *, root=None, frontend_python """Bytes setup downloads again to replace missing or changed files: the pinned Windows wheel (torch_download), elsewhere the package's installed size, an upper bound for its wheel. Marks each engine environment's damaged packages.""" - from .environments import ENVIRONMENTS + from .environments import ENVIRONMENTS, environment_spec from .runtime_libraries import damaged, incomplete, installed_bytes, missing_packages from .torch_download import select total = 0 @@ -189,7 +189,7 @@ def reinstall_download_bytes(dependencies, system, *, root=None, frontend_python else: # Setup puts back pinned packages whose files are gone (Setup.repairing). broken = sorted(set(broken + missing_packages(row['python'], constraints_file(name, system)))) - pins = ENVIRONMENTS.get(name, {}) + pins = (environment_spec(name, system) if name in ENVIRONMENTS else {}) if system == 'Windows' else ENVIRONMENTS.get(name, {}) wheels = {w['package']: w for w in (select(pins['torch'], pins['cuda']) or [])} if system == 'Windows' and pins else {} for package in broken: wheel = wheels.get(package) @@ -239,13 +239,15 @@ def dependency_status(root, layout='unified', system=None): if system == 'Windows': for name in packages: packages[name] = ['triton-windows' if p == 'triton' else p for p in packages[name]] + if windows_arm64(system): + packages[name] = [p for p in packages[name] if p != 'sageattention'] # no win_arm64 build for name in environment_names(layout): names = packages[name] expected = dict(line.strip().lower().split('==', 1) for line in constraints_file(name, system).read_text(encoding='utf-8').splitlines() if '==' in line) expected = {name.replace('_', '-'): version for name, version in expected.items()} expected.update({'freevideo-engine': __version__, 'sageattention': '2.2.0'}) - if system == 'Windows': + if system == 'Windows' and not windows_arm64(system): expected['sageattention'] = json.loads((PACKAGE / 'bootstrap_versions.json').read_text(encoding='utf-8'))['windows']['sageattention']['version'] python = venv_python(root / 'envs' / name, system) row = {'python': str(python), 'exists': python.exists(), 'installed': {}, 'missing': sorted(set(names)), 'mismatched': {}} @@ -438,7 +440,9 @@ def inventory(gpu=None): platform.system(), cgroup_ram_limit=limit, gpu_uuid=selected['uuid'], driver_version=selected['driver_version']) return {'hardware': hardware.to_dict(), 'selected_gpu': selected, 'gpus': rows, - 'kernel': platform.release(), 'platform': platform.platform(), 'machine': platform.machine(), + # On a Windows ARM computer an emulated x64 Python names AMD64; setup installs for the native processor. + 'kernel': platform.release(), 'platform': platform.platform(), + 'machine': 'ARM64' if windows_arm64(platform.system()) else platform.machine(), 'cpu_threads': os.cpu_count(), 'swap_total_bytes': ram.get('swap_total_bytes'), 'swap_free_bytes': ram.get('swap_free_bytes'), 'system_memory': ram, 'compiler': shutil.which('cl' if platform.system() == 'Windows' else 'g++'), 'git': usable_git(), @@ -660,13 +664,13 @@ def plan(args, *, local_progress=None, stage=None): prepared_format = 'int8_convrot' else: if not args.hardware_json and not setup_supported(platform.system(), platform.machine()): - raise RuntimeError('One-click setup supports Linux x86_64 or ARM64 and native Windows x64.') + raise RuntimeError('One-click setup supports Linux x86_64 or ARM64 and native Windows x64 or ARM64.') snapshot = json.loads(args.hardware_json.read_text(encoding='utf-8')) if args.hardware_json else inventory(args.gpu) warnings.extend(snapshot.get('warnings', [])) hardware = Hardware.from_dict(snapshot['hardware']) errors = [] if not setup_supported(hardware.system, snapshot.get('machine', '')): - errors.append('This installer supports Linux x86_64 or ARM64 and native Windows x64.') + errors.append('This installer supports Linux x86_64 or ARM64 and native Windows x64 or ARM64.') windows_target = hardware.system == 'Windows' # A replayed snapshot (--hardware-json) plans for its own processor, not this machine's. target_machine = snapshot.get('machine') or None @@ -1795,7 +1799,7 @@ def task(name, run, after=(), writes=()): sparse=['/comfy/', '/utils/', '/folder_paths.py', '/node_helpers.py', '/LICENSE']), after=('git',)) pythons = {} for name in environment_names(self.layout): - spec = ENVIRONMENTS[name] + spec = environment_spec(name, self.system) venv = self.root / 'envs' / name python = venv_python(venv, self.system) pythons[name] = python @@ -1803,11 +1807,15 @@ def task(name, run, after=(), writes=()): def environment(folder=venv, executable=python, label=name): orphaned = (self.system == 'Windows' and executable.exists() and environment_python_orphaned(executable)) + # On Windows on Arm an environment made with an x64 Python is made again natively. + foreign = (windows_arm64(self.system) and executable.exists() + and not environment_native_arm64(folder, self.versions['python'])) + orphaned = orphaned or foreign if executable.exists() and environment_seeded(folder) and not orphaned: return None from .failure_details import environment_python_removed, file_in_use for wait in (*ENVIRONMENT_BUSY_WAITS, None): - command = [uv, 'venv', '--seed', '--python', self.versions['python']] + command = [uv, 'venv', '--seed', '--python', self.python_request()] # The Python file came back (restored from quarantine) without # the seed packages: keep it and add them. Without the file, the # folder is a leftover that uv replaces. @@ -1817,6 +1825,11 @@ def environment(folder=venv, executable=python, label=name): elif folder.exists(): command.append('--clear') try: + if foreign: + from .windows_arm64 import first_install_notice + with self.download_notice('download-patient-native') as notice: + notice(first_install_notice()) + return self.packages(label + '-venv', [*command, folder], wait_busy=False) return self.packages(label + '-venv', [*command, folder], wait_busy=False) except RuntimeError as error: # Another program (usually security software scanning the @@ -2034,6 +2047,10 @@ def python_sources(self, names): return names return [*[n for n in names if n != 'ghfast'], *network.PYTHON_MIRRORS, *[n for n in names if n == 'ghfast']] + def python_request(self): + """What uv is asked for: the version, or on Windows on Arm the aarch64 build of it.""" + return self.versions.get('python_request', self.versions['python']) + def python_install(self, uv): from .system import bootstrap_root prepared = bootstrap_root(self.root) / 'python' @@ -2041,11 +2058,12 @@ def python_install(self, uv): # A from-zero launcher already installed this exact Python. Reuse its # base interpreter when creating the single compute venv; do not download # and unpack another copy. Existing installations keep their own base. - if prepared.is_dir() and not any(current.glob('cpython-' + self.versions['python'] + '-*')): + if prepared.is_dir() and not any(current.glob(self.versions.get('python_request') + or 'cpython-' + self.versions['python'] + '-*')): env = dict(self.env, UV_PYTHON_INSTALL_DIR=str(prepared)) uv = self.ensure_uv() if str(uv) == self.env.get('FREEVIDEO_UV') else uv found = subprocess_output.run_external([str(uv), '--no-config', 'python', 'find', '--managed-python', - '--no-python-downloads', self.versions['python']], + '--no-python-downloads', self.python_request()], env=env, capture_output=True, timeout=30) if found.returncode == 0: candidate = Path(found.stdout.strip()) @@ -2070,7 +2088,7 @@ def attempt(source, route, retry_mode, native_tls=False): if source in network.PYTHON_MIRRORS else network.source_url('github', source, self.env) + '/astral-sh/python-build-standalone/releases/download') return self.command('python-' + source + '-' + route, - [uv, 'python', 'install', *isolation, self.versions['python']], env=env) + [uv, 'python', 'install', *isolation, self.python_request()], env=env) try: with self.download_notice('download-patient-python') as notice: return network.download_command(self.network, 'github', attempt, self.env, category='python', @@ -2238,6 +2256,10 @@ def install_compiler_linux(self): def install_sage_windows(self, uv, python): spec = self.versions['windows']['sageattention'] + if spec is None: + # Windows on Arm: no SageAttention build exists; the other attention backends are used. + self.ui.write('SageAttention has no Windows on Arm build; continuing without it.\n') + return None directory = Path(self.plan['wheel_cache']) / 'windows-sage2' / spec['sha256'][:16] wheel = directory / unquote(urlsplit(spec['url']).path.rsplit('/', 1)[-1]) reused = wheel.is_file() diff --git a/freevideo_engine/calibration.py b/freevideo_engine/calibration.py index d3e3d412..cf2f9b93 100644 --- a/freevideo_engine/calibration.py +++ b/freevideo_engine/calibration.py @@ -355,12 +355,20 @@ def deliver(report): error='encode: freevideo encode exited with code %d' % returncode)) # Not parser.error: a usage dump buries the child's traceback, # which is the only thing here that says what went wrong. - raise SystemExit(json.dumps({ - 'event': 'calibration_failed', 'stage': 'encode', - 'returncode': returncode, 'log': str(log), - 'if_lease_held': 'A held installation lease means another FreeVideo ' - 'process is using the card. Finish or cancel it, then ' - 'run the placement test again.'})) + failure = {'event': 'calibration_failed', 'stage': 'encode', + 'returncode': returncode, 'log': str(log)} + # A memory stop is not a held lease: say which it was, and do + # not tell a machine that ran out of memory to look for another + # FreeVideo process. + shortage = next((line for line in reversed(output.splitlines()) + if line.startswith('MemoryError: RAM guard')), None) + if shortage: + failure.update(reason='memory', detail=shortage) + else: + failure['if_lease_held'] = ('A held installation lease means another FreeVideo ' + 'process is using the card. Finish or cancel it, then ' + 'run the placement test again.') + raise SystemExit(json.dumps(failure)) policy, rows = plan_variants(hardware, canvas, available_backends(hardware)) if not rows: result = dict(schema_version=1, questions=[], hardware=hardware.to_dict(), diff --git a/freevideo_engine/comfy_editor.py b/freevideo_engine/comfy_editor.py index 308d1a27..de6202dd 100644 --- a/freevideo_engine/comfy_editor.py +++ b/freevideo_engine/comfy_editor.py @@ -895,6 +895,33 @@ def media_path(root, key): return _import_path(root, source['id'], 'preview.mp4' if metadata['kind'] == 'video' else 'preview.m4a') +def _counted_length(path, kind): + """(seconds, packets) of the first stream of `kind`, read from its packets, for a file whose header does not + say how long it is (a browser recording or a file still being written has no length). (None, 0) when the + packets carry no times either.""" + import av + with av.logging.Capture(local=True), av.open(str(path)) as container: + stream = next(iter(getattr(container.streams, kind)), None) + # A text file is read as a "video" of characters (bintext, xbin, idf, ansi): it is not a recording. + if stream is None or not stream.time_base or getattr(stream.codec_context, 'name', None) in ('bintext', 'xbin', 'idf', 'ansi'): + return None, 0 + first = last = None + packets = 0 + try: + for packet in container.demux(stream): + if packet.pts is None: + continue + packets += 1 + end = packet.pts + (packet.duration or 0) + first = packet.pts if first is None else min(first, packet.pts) + last = end if last is None else max(last, end) + except av.error.InvalidDataError: + pass # A cut-off file keeps what was read before the damage, as in the preview. + if packets < 2 or first is None or last <= first: + return None, packets + return float((last - first) * stream.time_base), packets + + def probe(path): import av from .media_encoding import clip_seconds @@ -908,6 +935,11 @@ def probe(path): seconds = clip_seconds(container, stream) fps = float(video.average_rate or video.guessed_rate or FPS) if video is not None else FPS frames = video.frames if video is not None else 0 + if not frames and (seconds is None or not math.isfinite(seconds) or seconds <= 0): + # The file does not say how long it is: read the length from its packets. + seconds, packets = _counted_length(path, 'video' if video is not None else 'audio') + if video is not None and seconds: + frames = packets # A single picture or packets all at one time give no length and stay refused. if not frames: if seconds is None or not math.isfinite(seconds) or seconds <= 0: raise ValueError('Media duration unavailable') @@ -1325,6 +1357,19 @@ def emit_audio(frame): poster.unlink(missing_ok=True) +# The fixed sentences this module raises for a file it cannot use, by the short name the report button carries. +_UNREADABLE_CAUSES = {'No media': 'no_media', 'Media has no playable streams': 'no_playable_streams', + 'Invalid video dimensions': 'invalid_dimensions', 'No decoded video': 'no_decoded_video', + 'No decoded audio': 'no_decoded_audio', 'Media duration unavailable': 'no_duration'} + + +def _failure_detail(error): + """The error's class, and for one of this module's own fixed sentences also its short name ("ValueError/no_media"); + never any other message, which can name a path.""" + cause = _UNREADABLE_CAUSES.get(str(error)) if type(error) is ValueError else None + return f'{type(error).__name__}/{cause}' if cause else type(error).__name__ + + class ImportManager: """One daemon worker per server; restarted preparations are retried once.""" def __init__(self, root): @@ -1349,7 +1394,7 @@ def prepare(self, identity): try: # The class of the error (never its message, which can name a path) goes with the page's report button. _import_update(self.root, identity, state='failed', reason=reason, - detail=type(error).__name__ if reason == 'unreadable' else None) + detail=_failure_detail(error) if reason == 'unreadable' else None) except (OSError, ValueError): pass # The terminal snapshot is retained and retried by the worker/reads. diff --git a/freevideo_engine/comfy_launcher_runtime.py b/freevideo_engine/comfy_launcher_runtime.py index 4b1dec44..3447818c 100644 --- a/freevideo_engine/comfy_launcher_runtime.py +++ b/freevideo_engine/comfy_launcher_runtime.py @@ -1310,7 +1310,7 @@ def _move_address(self, selected): """Take the next free port for this ComfyUI and keep it in the selection the launcher saves.""" url = next_free_address(selected['url']) if url is None: - raise ValueError('This port and the next ones are in use or reserved by the system. Set a different local ComfyUI address.') + raise ValueError('This port and the next ones are in use or reserved by the system. Set a different local server address.') if self.port_move is None: self.port_move = urlsplit(selected['url']).port or 80 selected = self.selection = dict(selected, url=url) @@ -1396,7 +1396,7 @@ def _open_access_proxy(self): port = (urlsplit(selected['url']).port or 80) + 1 candidate = next_free_address(address('0.0.0.0', port - 1)) if port <= 65535 else None if candidate is None: - raise lan_error('ports_in_use', 'The ports for LAN access are in use or reserved by the system. Choose another ComfyUI port.') + raise lan_error('ports_in_use', 'The ports for LAN access and the ports after them are in use or reserved by the system. Close the programs using these ports, then turn it on again.') port = urlsplit(candidate).port self.selection = selected = dict(selected, lan_port=port) self.state = dict(self.state, selection=dict(selected)) @@ -1520,7 +1520,7 @@ def _connect_comfy(self): continue if error.errno == errno.EADDRNOTAVAIL: raise ValueError('This address does not belong to this computer. Enter one of its IP addresses or 0.0.0.0.') from error - raise ValueError('This port is in use by another application. Set a different local ComfyUI address.') from error + raise ValueError('This port is in use by another application. Set a different local server address.') from error if not selected.get('python') or not io_path(selected['python']).is_file(): raise ValueError('ComfyUI Python is missing. Inspect again to prepare a separate environment.') directory = io_path(selected['engine']) / 'launcher' / 'comfy-runs' / (time.strftime('%Y%m%dT%H%M%S') + '-' + secrets.token_hex(4)) diff --git a/freevideo_engine/desktop_runtime.py b/freevideo_engine/desktop_runtime.py index 129e6802..732204cb 100644 --- a/freevideo_engine/desktop_runtime.py +++ b/freevideo_engine/desktop_runtime.py @@ -43,6 +43,13 @@ def launcher_root(): return Path(home) / 'FreeVideo-launcher' +def foreign_environment(root): + """Whether an x64 environment is installed on a Windows on Arm computer.""" + from .environments import WINDOWS_ARM64_PYTHON, environment_native_arm64, windows_arm64 + folder = Path(root) / 'envs' / 'unified' + return windows_arm64() and io_path(folder).is_dir() and not environment_native_arm64(folder, WINDOWS_ARM64_PYTHON) + + NOTICE_FILES = ('LICENSE', 'NOTICE', 'THIRD_PARTY_NOTICES.md') @@ -284,6 +291,56 @@ def entry_ready(source, name=ENTRY_SCRIPT): return False +def _builtin_files(source): + """What the launcher can put back into a deployed source folder: ({name: sha256}, where(name) -> file). + + Only the launcher's own built-in files (or the verified update overlay) are ever the origin, and each one + is used only when its hash equals the recorded one; nothing is downloaded. None when there is no such origin.""" + bootstrap = None + if getattr(sys, 'frozen', False): + from .top_level_modules import update_modules + bootstrap = update_modules()[2] + active = getattr(bootstrap, 'ACTIVE', None) + if active and resolved(Path(plain(active['source']))) == resolved(Path(plain(source))): + recorded = {name: row.get('sha256') for name, row in active['manifest']['files'].items()} + + def where(name): + held = io_path(active['folder']) / 'files' / name + return held if held.is_file() else io_path(Path(sys._MEIPASS) / 'engine-source') / name + return recorded, where + if getattr(sys, 'frozen', False): + record = json.loads((io_path(source) / 'launcher-source.json').read_text(encoding='utf-8')) + return dict(record['sha256']), lambda name: io_path(Path(sys._MEIPASS) / 'engine-source') / name + return None + + +def _inside(name): + """A recorded name is a plain relative path of forward-slash parts: no drive, absolute path, '..' or backslash.""" + parts = name.split('/') if isinstance(name, str) else () + return bool(parts) and all(part not in ('', '.', '..') and not set(part) & set('\\:') for part in parts) + + +def _put_back(source, name, recorded, where): + expected = recorded.get(name) + if not expected or not _inside(name): + return False + origin = where(name) + if not origin.is_file(): + return False + data = origin.read_bytes() + if hashlib.sha256(data).hexdigest() != expected: + return False + target = io_path(source) / name + target.parent.mkdir(parents=True, exist_ok=True) + stage = target.with_name(target.name + '.' + uuid.uuid4().hex[:8] + '.tmp') + try: + stage.write_bytes(data) + os.replace(stage, target) + finally: + stage.unlink(missing_ok=True) + return True + + def restore_entry(source, name=ENTRY_SCRIPT): """Put back one entry script that vanished from a deployed source folder after the launcher started. @@ -292,37 +349,42 @@ def restore_entry(source, name=ENTRY_SCRIPT): if entry_ready(source, name): return True try: - bootstrap = None - origin = expected = None - if getattr(sys, 'frozen', False): - from .top_level_modules import update_modules - bootstrap = update_modules()[2] - active = getattr(bootstrap, 'ACTIVE', None) - if active and resolved(Path(plain(active['source']))) == resolved(Path(plain(source))): - expected = active['manifest']['files'].get(name, {}).get('sha256') - held = io_path(active['folder']) / 'files' / name - origin = held if held.is_file() else io_path(Path(sys._MEIPASS) / 'engine-source') / name - elif getattr(sys, 'frozen', False): - origin = io_path(Path(sys._MEIPASS) / 'engine-source') / name - record = json.loads((io_path(source) / 'launcher-source.json').read_text(encoding='utf-8')) - expected = record['sha256'].get(name) - if origin is None or not expected or not origin.is_file(): + found = _builtin_files(source) + if found is None or not _put_back(source, name, *found): return False - data = origin.read_bytes() - if hashlib.sha256(data).hexdigest() != expected: - return False - target = io_path(source) / name - stage = target.with_name(name + '.' + uuid.uuid4().hex[:8] + '.tmp') - try: - stage.write_bytes(data) - os.replace(stage, target) - finally: - stage.unlink(missing_ok=True) except Exception: return False return entry_ready(source, name) +def restore_missing_files(source): + """Put back every file of a deployed source folder that is gone (or was emptied), such as one a virus + scanner removed, so a setup step does not stop on the first file it reads. + + Files that are present are never touched, so edits stay. Returns (restored names, names that could not be + restored); both are empty when the folder is complete or has no built-in origin to restore from.""" + restored, failed = [], [] + try: + found = _builtin_files(source) + if found is None: + return restored, failed + empty = hashlib.sha256(b'').hexdigest() + for name, expected in sorted(found[0].items()): + try: + if not _inside(name): + failed.append(name) + continue + target = io_path(source) / name + if target.is_file() and (target.stat().st_size or expected == empty): + continue + (restored if _put_back(source, name, *found) else failed).append(name) + except OSError: + failed.append(name) + except Exception: + pass + return restored, failed + + def preflight_json(output): decoder = json.JSONDecoder() for offset, character in enumerate(output): @@ -403,7 +465,11 @@ def command(self, root, arguments): def environment(self, root): from .linux_bundle import child_environment - return dict(child_environment(), PYTHONUTF8='1', PYTHONIOENCODING='utf-8', NO_COLOR='1', FREEVIDEO_UI_EVENTS='1') + values = dict(child_environment(), PYTHONUTF8='1', PYTHONIOENCODING='utf-8', NO_COLOR='1', FREEVIDEO_UI_EVENTS='1') + if foreign_environment(root): + # Setup makes this environment again, and Windows cannot delete the folder of the Python that runs setup. + values['FREEVIDEO_FORCE_BOOTSTRAP'] = '1' + return values def prepare(self, action, root, env, progress): return env @@ -421,10 +487,17 @@ def _run_awake(self, action, root, arguments): # Only a command that really starts the script needs it (the ComfyUI host runs from Python directly). if entry and str(self.source / entry) in command and not restore_entry(self.source, entry): raise RuntimeError('FreeVideo could not find %s in %s' % (entry, plain(self.source))) + restored, unrestored = restore_missing_files(self.source) + restore_note = '' + if restored or unrestored: + restore_note = 'Source files missing from %s: restored %d%s' % (plain(self.source), len(restored), + ('; could not restore ' + ', '.join(unrestored[:5])) if unrestored else '') save(run / 'status.json', dict(action=action, command=command, root=str(root), status='running')) self.events.put(('started', plain(run))) env = self.environment(root) with (run / 'launcher.log').open('w', encoding='utf-8', buffering=1) as log: + if restore_note: + log.write(json.dumps({'event': 'source_files', 'message': restore_note}) + '\n') def plain_message(value): if isinstance(value, str): return plain_text(value) diff --git a/freevideo_engine/diagnostics.py b/freevideo_engine/diagnostics.py index 6c18f427..5fc996a4 100644 --- a/freevideo_engine/diagnostics.py +++ b/freevideo_engine/diagnostics.py @@ -18,6 +18,7 @@ from . import execution_paths from . import long_paths +from . import host_arch from .long_paths import io_path, resolved, plain, plain_text from . import __version__ from .bootstrap import DEFAULT_ROOT @@ -237,6 +238,17 @@ def web_files(root, machine): return dict(error='No FreeVideo source is recorded') +def windows_state(bootstrap): + """The system section of a Windows report.""" + return {'platform': platform.platform(), + 'windows_version': platform.win32_ver(), 'machine': platform.machine(), + 'host_arch': host_arch.detect(), + 'memory': system_memory(), 'cpu': platform.processor(), + 'executables': {name: shutil.which(name) for name in ('git', 'curl', 'cl', 'nvcc')}, + 'cuda_paths': {k: v for k, v in os.environ.items() if k == 'CUDA_PATH' or k.startswith('CUDA_PATH_V')}, + 'bootstrap_log': plain(bootstrap / 'bootstrap.log')} + + def collect(root, config, run, output, *, complete=False, extra_files=(), notes='', progress=None): root, config = resolved(root.expanduser()), io_path(config.expanduser().absolute()) run = io_path(run) if run is not None else None @@ -372,12 +384,7 @@ def add_path(name, path): for path in report_files(gui_run): add_path('launcher/' + gui_run.name + '/' + path.relative_to(gui_run).as_posix(), path) try: - add('current/windows.json', json.dumps({'platform': platform.platform(), - 'windows_version': platform.win32_ver(), 'machine': platform.machine(), - 'memory': system_memory(), 'cpu': platform.processor(), - 'executables': {name: shutil.which(name) for name in ('git', 'curl', 'cl', 'nvcc')}, - 'cuda_paths': {k: v for k, v in os.environ.items() if k == 'CUDA_PATH' or k.startswith('CUDA_PATH_V')}, - 'bootstrap_log': plain(bootstrap / 'bootstrap.log')}).encode()) + add('current/windows.json', json.dumps(windows_state(bootstrap)).encode()) except OSError as error: manifest['errors'].append({'command': 'windows-memory', 'error': redactor.text(str(error))}) else: diff --git a/freevideo_engine/display_adapters.py b/freevideo_engine/display_adapters.py index 7adaafb5..836c0f5a 100644 --- a/freevideo_engine/display_adapters.py +++ b/freevideo_engine/display_adapters.py @@ -12,6 +12,8 @@ NVIDIA_VENDOR = '10de' # PCI vendors whose cards are never NVIDIA's, for naming a driverless card the display class lists without a vendor. OTHER_VENDOR_IDS = {'1002': 'AMD graphics', '8086': 'Intel graphics'} +# Why the last adapters() call could not tell; the report line carries it so a report says which step failed. +LAST_FAILURE = '' BASIC = re.compile(r'basic (?:display|render)', re.I) NVIDIA = 'NVIDIA' NVIDIA_NAME = re.compile(r'nvidia|geforce|quadro|rtx|tesla', re.I) @@ -115,18 +117,25 @@ def pci_display_vendors(): def vendor_of_unknown_adapter(): - """NVIDIA, a name for another vendor, or None when it cannot be told from the system's PCI list.""" + """NVIDIA, a name for the other vendors, or None when it cannot be told from the system's PCI list. + + A complete list that holds a display device but no NVIDIA one means no NVIDIA card is present, whoever made the + device (a virtual machine's graphics has its own vendor ID). An empty list stays unknown. + """ + global LAST_FAILURE try: vendors = pci_display_vendors() if os.name == 'nt' else set() - except Exception: + except Exception as error: # Any surprise from the registry or the device tree (ctypes.ArgumentError is not an OSError) means unknown; # this lookup only refines a card note and must never stop the launcher. + LAST_FAILURE = 'PCI list unreadable: ' + type(error).__name__ return None if NVIDIA_VENDOR in vendors: return NVIDIA - if vendors and vendors <= set(OTHER_VENDOR_IDS): - return ' / '.join(OTHER_VENDOR_IDS[item] for item in sorted(vendors)) - return None + if not vendors: + LAST_FAILURE = 'no display device in the PCI list' + return None + return ' / '.join(OTHER_VENDOR_IDS.get(item, 'Other graphics ' + item) for item in sorted(vendors)) def linux_names(): @@ -141,9 +150,12 @@ def linux_names(): def adapters(): """Adapter names in system order, or None when the system could not be asked.""" + global LAST_FAILURE + LAST_FAILURE = '' try: names = windows_names() if os.name == 'nt' else linux_names() - except (ImportError, OSError, ValueError, subprocess.SubprocessError): + except (ImportError, OSError, ValueError, subprocess.SubprocessError) as error: + LAST_FAILURE = 'adapter list unreadable: ' + type(error).__name__ return None seen, unknown = [], False for entry in names: @@ -186,7 +198,7 @@ def only_other_vendors(names): def report_line(names): """One line for the report: adapter model names only, or that the lookup failed.""" if names is None: - return 'Display adapters: not available' + return 'Display adapters: not available' + (' (%s)' % LAST_FAILURE if LAST_FAILURE else '') return 'Display adapters: ' + ('; '.join(names) if names else 'none listed') diff --git a/freevideo_engine/engine_exit.py b/freevideo_engine/engine_exit.py index 6dd8586f..cc48ae12 100644 --- a/freevideo_engine/engine_exit.py +++ b/freevideo_engine/engine_exit.py @@ -127,7 +127,7 @@ def describe(value, zh): crashed = kind in ('native_crash', 'abort', 'system_stack_overflow') if zh: cause = (',原因是电脑内存不足' if memory else ',被系统或其他程序结束' if ended else ',程序自身崩溃' if crashed else '') - return ('ComfyUI 于 %s 意外停止%s。请点击“重新连接”重新启动;如再次停止,请导出报告,再点击“提交问题”并附上报告。' % (clock, cause)) + return ('FreeVideo 于 %s 意外停止%s。请点击“重新连接”重新启动;如再次停止,请导出报告,再点击“提交问题”并附上报告。' % (clock, cause)) cause = (': the computer ran out of memory' if memory else ': the system or another program ended it' if ended else ': it crashed' if crashed else '') - return 'ComfyUI stopped unexpectedly at %s%s. Click "Connect again" to restart it; if it stops again, export the report and use "Report a problem".' % (clock, cause) + return 'FreeVideo stopped unexpectedly at %s%s. Click "Connect again" to restart it; if it stops again, export the report and use "Report a problem".' % (clock, cause) diff --git a/freevideo_engine/environments.py b/freevideo_engine/environments.py index fcb827dd..1a794453 100644 --- a/freevideo_engine/environments.py +++ b/freevideo_engine/environments.py @@ -3,12 +3,64 @@ import os from pathlib import Path import platform +import re ENVIRONMENTS = { 'unified': {'cuda': 'cu130', 'torch': ['torch==2.13.0', 'torchvision==0.28.0', 'torchaudio==2.11.0']}, 'engine': {'cuda': 'cu129', 'torch': ['torch==2.13.0', 'torchvision==0.28.0']}, 'encoder': {'cuda': 'cu130', 'torch': ['torch==2.14.0', 'torchvision==0.29.0', 'torchaudio==2.11.0']}, } +# Native Windows on Arm: one environment, the CUDA 13.4 torch family NVIDIA publishes for win_arm64 +# (freevideo_engine/windows_arm64.json), pinned by constraints/windows-arm64.txt. +WINDOWS_ARM64_ENVIRONMENTS = { + 'unified': {'cuda': 'cu134', 'torch': ['torch==2.14.0', 'torchvision==0.29.0', 'torchaudio==2.11.1']}, +} +# uv 0.9.0 installs CPython for aarch64 Windows up to 3.12.11; the win_arm64 wheels are cp312. +WINDOWS_ARM64_PYTHON = '3.12.11' +# A bare version is not enough: on an ARM64 Windows host uv 0.9.0 prefers x86_64 Python (uv-platform/src/arch.rs, Ord for +# Arch), so every uv command names the aarch64 build. Either uv binary, x64 or ARM64, honours the explicit request. +WINDOWS_ARM64_PYTHON_REQUEST = 'cpython-' + WINDOWS_ARM64_PYTHON + '-windows-aarch64-none' +WINDOWS_ARM64_TRITON = '3.8.0.post28' # = triton-windows in constraints/windows-arm64.txt + + +def windows_arm64(system=None, machine=None): + """Whether a Windows installation targets native ARM64. + + A given machine (a hardware snapshot's) decides; otherwise this computer's native + processor does, so an x64 Python running emulated on a Windows ARM computer still + installs the native ARM64 tools. Never true off Windows. + """ + if (system or platform.system()) != 'Windows': + return False + if machine: + return str(machine).lower() in ('arm64', 'aarch64') + from .host_arch import windows_arm + return windows_arm() + + +def environment_spec(name, system=None, machine=None): + """The CUDA tag and torch pins of an environment on the target platform.""" + if windows_arm64(system, machine): + if name not in WINDOWS_ARM64_ENVIRONMENTS: + raise ValueError('Windows on Arm uses the unified environment') + return WINDOWS_ARM64_ENVIRONMENTS[name] + return ENVIRONMENTS[name] + + +def environment_native_arm64(folder, python_version): + """Whether an environment was made from the managed aarch64 Windows Python of this version. + + The version alone does not tell: uv also offers the x64 build of the same version on ARM64 Windows. + """ + from .long_paths import io_path + try: + config = io_path(Path(folder) / 'pyvenv.cfg').read_text(encoding='utf-8') + except (OSError, UnicodeError): + return False + version = re.search(r'^version(?:_info)?\s*=\s*([\d.]+)\s*$', config, re.M) + home = re.search(r'^home\s*=\s*(.+?)\s*$', config, re.M) + return (bool(version and home) and version.group(1) == python_version + and 'windows-aarch64' in home.group(1).lower()) def constraints_file(name, system=None): @@ -18,6 +70,10 @@ def constraints_file(name, system=None): from .macos_bootstrap import constraints return constraints() prefix = 'windows-' if (system or platform.system()) == 'Windows' else '' + if prefix and windows_arm64(system): + if name != 'unified': + raise ValueError('Windows on Arm uses the unified environment') + name = 'arm64' return Path(__file__).resolve().parent.parent / 'constraints' / (prefix + name + '.txt') @@ -131,10 +187,10 @@ def linux_machine(machine=None): def setup_supported(system, machine): - """Setup installs on Linux x86_64 or ARM64 and on native Windows x64.""" + """Setup installs on Linux x86_64 or ARM64 and on native Windows x64 or ARM64.""" machine = str(machine or '').lower() return (system == 'Linux' and linux_machine(machine) is not None - or system == 'Windows' and machine in ('x86_64', 'amd64')) + or system == 'Windows' and machine in ('x86_64', 'amd64', 'arm64', 'aarch64')) def uv_folder(machine=None): @@ -161,6 +217,16 @@ def bootstrap_versions(value, system=None, machine=None): return versions(value) if result['target_system'] == 'Windows': result['uv'] = result['windows']['uv'] + if windows_arm64('Windows', machine): + from . import windows_arm64 as arm + table = arm.load() + uv = dict(version=table['uv']['version'], url=table['uv']['legacy_url'], + sha256=table['uv']['legacy_sha256'], executable=table['uv']['legacy_executable']) + # No SageAttention build exists for win_arm64: the planner uses the other attention backends. + result['windows'] = dict(result['windows'], uv=uv, git=table['git'], sageattention=None, + triton=WINDOWS_ARM64_TRITON) + result.update(uv=uv, python=WINDOWS_ARM64_PYTHON, python_request=WINDOWS_ARM64_PYTHON_REQUEST, + target_machine='arm64') elif result['target_system'] == 'Linux': result['target_machine'] = linux_machine(machine) or 'x86_64' if result['target_machine'] == 'aarch64': diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.py index 8b7e53a7..5c050345 100644 --- a/freevideo_engine/failure_details.py +++ b/freevideo_engine/failure_details.py @@ -403,11 +403,11 @@ def _model_unchanged(tail): _KEPT = ('; the models and videos in the current folder are not deleted.', ';原文件夹里的模型和作品不会被删除。') _EXTRACT = ('Extract the downloaded package again into a new folder and start FreeVideo from there' + _KEPT[0], '请把下载的整合包重新解压到一个新文件夹,再从新文件夹启动 FreeVideo' + _KEPT[1]) -_IMPORT = ('On the Installation page in the sidebar, select Install ComfyUI, change Install location to a new folder, ' +_IMPORT = ('On the Installation page in the sidebar, select New installation, change Install location to a new folder, ' 'then click Replace package… under Import environment package and choose the downloaded environment package; ' 'if you are online, you can instead choose Automatic as the install method there. ' 'The models and videos in the current folder are not deleted.', - '请在左侧“安装”页选择“帮我安装 ComfyUI”,把“安装位置”改为一个新文件夹,然后在“导入运行环境包”中点击“更换环境包…”' + '请在左侧“安装”页选择“全新安装”,把“安装位置”改为一个新文件夹,然后在“导入运行环境包”中点击“更换环境包…”' '并选择下载的运行环境包;能联网时,也可以在那里把安装方式改为“自动安装”。原文件夹里的模型和作品不会被删除。') WITHOUT_REPAIR = { # A model file that differs from the tested one; FreeVideo leaves it in place. @@ -758,9 +758,9 @@ class names and errno, no text), when the message is that exception's str(); it action = ('请改选“%s”文件夹。' if zh else 'Select the "%s" folder instead.') % found else: # The button name is the one on the launcher's ComfyUI page (Main.qml, newComfyMethod). - action = ('请选择包含 main.py 的 ComfyUI 文件夹,或包含它的便携包文件夹。尚未安装 ComfyUI 时,请选择“帮我安装 ComfyUI”。' if zh else + action = ('请选择包含 main.py 的 ComfyUI 文件夹,或包含它的便携包文件夹。尚未安装 ComfyUI 时,请选择“全新安装”。' if zh else 'Select the ComfyUI folder (it contains main.py), or the portable folder that contains it. ' - 'If ComfyUI is not installed yet, choose "Install ComfyUI".') + 'If ComfyUI is not installed yet, choose "New installation".') return dict(title='这不是 ComfyUI 文件夹' if zh else "This isn't a ComfyUI folder", detail='', action=action, kind='comfy-folder') if re.search(r'Mac GPU check did not pass|Native GPU checks did not complete', summary): @@ -825,18 +825,20 @@ class names and errno, no text), when the message is that exception's str(); it return dict(title=DOWNLOAD_COPY['error_read'][zh], detail='', action='', kind='download-list-read') rules = ( (r'This port is in use by another application', 'port-taken', - ('The ComfyUI port is in use', 'ComfyUI 端口被占用'), - ('Another program is using this port. Change the ComfyUI address in Settings, then start again.', - '有其他程序占用了这个端口。请在设置里换一个 ComfyUI 地址,再重新启动。')), + ('The server port is in use', '服务端口被占用'), + ('Another program is using this port. Change the server address in Settings, then start again.', + '有其他程序占用了这个端口。请在设置里换一个服务地址,再重新启动。')), # Windows reserves whole port ranges (Hyper-V, WSL), so the ports after it may be unusable too. (r'This port and the next ones are in use or reserved by the system', 'port-taken', - ('The ComfyUI port cannot be used', 'ComfyUI 端口无法使用'), - ('This port and the next ones are in use or reserved by the system. Change the ComfyUI address in Settings, ' - 'then start again.', '这个端口和后面的端口都已被占用或被系统保留。请在设置里换一个 ComfyUI 地址,再重新启动。')), - (r'The ports for LAN access are in use or reserved by the system', 'port-taken', + ('The server port cannot be used', '服务端口无法使用'), + ('This port and the next ones are in use or reserved by the system. Change the server address in Settings, ' + 'then start again.', '这个端口和后面的端口都已被占用或被系统保留。请在设置里换一个服务地址,再重新启动。')), + # The older wording of this sentence ("The ports for LAN access are in use ...") is still recognised. + (r'The ports for LAN access (?:and the ports after them )?are in use or reserved by the system', 'port-taken', ('The LAN access port cannot be used', '局域网访问的端口无法使用'), - ('The ports for LAN access are in use or reserved by the system. Change the ComfyUI port in Settings, ' - 'then start again.', '局域网访问要用的端口已被占用或被系统保留。请在设置里换一个 ComfyUI 端口,再重新启动。')), + ('The ports for LAN access and the ports after them are in use or reserved by the system. Close the programs ' + 'using these ports, then turn on LAN access again.', + '局域网访问要用的端口和后面的端口都已被占用或被系统保留。请关闭占用这些端口的程序,再重新开启局域网访问。')), (r'The previous video has no usable continuation data', 'continuation-missing', ('This video cannot be continued', '这个视频暂时不能接续'), ('Generate the previous video again, then continue it.', '请重新生成上一段视频,再接续。')), @@ -975,8 +977,8 @@ class names and errno, no text), when the message is that exception's str(); it '请点“重试安装”,启动器会自动修复下载工具。仍然失败时,可以导出报告。')), (r'ComfyUI is still running a job', 'busy', ('A video is still generating', '还有视频正在生成'), - ('The update is installed. Click Connect again after the job finishes to restart ComfyUI with it.', - '更新已装好。等当前任务完成后点“重新连接”,ComfyUI 会重启并使用新版。')), + ('The update is installed. Click Connect again after the job finishes to restart FreeVideo with it.', + '更新已装好。等当前任务完成后点“重新连接”,FreeVideo 会重启并使用新版。')), (r'WinError 206|The filename or extension is too long|is too long for Git to read', 'path-too-long', ("The installation folder's path is too long", '安装文件夹的路径太长'), ('Install FreeVideo in a folder with a shorter path, such as D:\\FreeVideo, then click "Retry installation".', diff --git a/freevideo_engine/host_arch.py b/freevideo_engine/host_arch.py new file mode 100644 index 00000000..e427c14d --- /dev/null +++ b/freevideo_engine/host_arch.py @@ -0,0 +1,77 @@ +"""The architecture of the computer itself, as opposed to the one this process runs as. + +On Windows ARM the x64 launcher runs emulated, so platform.machine() and the process +environment name AMD64. IsWow64Process2 reports the native machine; computers without +it fall back to the PROCESSOR_ARCHITEW6432 / PROCESSOR_ARCHITECTURE variables. +""" +import os +import platform +import sys + +IMAGE_FILE_MACHINE_I386 = 0x014C +IMAGE_FILE_MACHINE_ARM64 = 0xAA64 +IMAGE_FILE_MACHINE_AMD64 = 0x8664 + +_MACHINES = {IMAGE_FILE_MACHINE_ARM64: 'arm64', IMAGE_FILE_MACHINE_AMD64: 'x64', IMAGE_FILE_MACHINE_I386: 'x86'} +_NAMES = {'ARM64': 'arm64', 'AMD64': 'x64', 'X86': 'x86', 'IA64': 'ia64'} + + +def _native_machine_code(): + """IMAGE_FILE_MACHINE_* of the physical computer, or None when IsWow64Process2 is unavailable.""" + import ctypes + from ctypes import wintypes + kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) + function = getattr(kernel32, 'IsWow64Process2', None) + if function is None: + return None + function.argtypes = [wintypes.HANDLE, ctypes.POINTER(ctypes.c_ushort), ctypes.POINTER(ctypes.c_ushort)] + function.restype = wintypes.BOOL + kernel32.GetCurrentProcess.restype = wintypes.HANDLE + process, native = ctypes.c_ushort(0), ctypes.c_ushort(0) + if not function(kernel32.GetCurrentProcess(), ctypes.byref(process), ctypes.byref(native)): + return None + return native.value + + +def _own_machine(): + name = platform.machine().lower() + return {'amd64': 'x64', 'x86_64': 'x64', 'aarch64': 'arm64', 'arm64': 'arm64'}.get(name, name or 'unknown') + + +def detect(): + """{'native': 'arm64'|'x64'|..., 'emulated': bool, 'source': str}; never raises.""" + try: + if not sys.platform.startswith('win'): + return dict(native=_own_machine(), emulated=False, source='platform') + own = _NAMES.get(os.environ.get('PROCESSOR_ARCHITECTURE', '').upper()) + try: + code = _native_machine_code() + except Exception: + code = None + if code is not None and code in _MACHINES: + native = _MACHINES[code] + return dict(native=native, emulated=bool(own and own != native), source='IsWow64Process2') + raw = os.environ.get('PROCESSOR_ARCHITEW6432') or os.environ.get('PROCESSOR_ARCHITECTURE', '') + native = _NAMES.get(raw.upper()) + if native: + return dict(native=native, emulated=bool(os.environ.get('PROCESSOR_ARCHITEW6432')), source='environment') + except Exception: + pass + return dict(native='unknown', emulated=False, source='unavailable') + + +def windows_arm(): + """True on a Windows computer whose native machine is ARM64, whatever this process runs as.""" + return sys.platform.startswith('win') and detect()['native'] == 'arm64' + + +def native_arm_process(): + """True when this process itself is a native ARM64 Windows process (not x64 running emulated).""" + return sys.platform.startswith('win') and _own_machine() == 'arm64' + + +def platform_key(): + """'win-arm64' for a native ARM64 Windows process, else 'win-x64' on Windows; the key for per-platform download tables.""" + if sys.platform.startswith('win'): + return 'win-arm64' if native_arm_process() else 'win-x64' + return sys.platform diff --git a/freevideo_engine/launcher/Main.qml b/freevideo_engine/launcher/Main.qml index 7b238167..f6956ce5 100644 --- a/freevideo_engine/launcher/Main.qml +++ b/freevideo_engine/launcher/Main.qml @@ -166,7 +166,7 @@ ApplicationWindow { if (u.status === "available") return t("A faster model is available for your GPU", "有适合这张显卡的更快模型") if (u.status === "low-disk") return t("Not enough disk space for the faster model", "磁盘空间不够,暂时无法升级到更快的模型") if (u.status === "downloading") return t("Downloading the faster model", "正在下载更快的模型") - if (u.status === "downloaded" && u.waiting === "comfy") return t("Switching after ComfyUI is closed", "关闭 ComfyUI 后切换") + if (u.status === "downloaded" && u.waiting === "comfy") return t("Switching after FreeVideo is closed", "关闭 FreeVideo 后切换") if (u.status === "downloaded" || (u.status === "switching" && !s.busy)) return t("Switching after the current video", "当前视频完成后切换") if (u.status === "switching") return t("Switching to the faster model", "正在切换到更快的模型") if (u.status === "releasing") return u.waiting ? t("Removing the old model after the current video", "当前视频完成后删除旧模型") : t("Removing the old model", "正在删除旧模型") @@ -213,8 +213,8 @@ ApplicationWindow { return u.progress && u.progress.unit === "bytes" && u.progress.total ? bytes(u.progress.done) + " / " + bytes(u.progress.total) + t(" · you can keep generating", " · 可以继续生成") : t("Checking the download…", "正在检查下载内容…") if (u.status === "downloaded" && u.waiting === "comfy") - return t("This ComfyUI was not opened by the launcher, so FreeVideo cannot restart it. Close it and the switch starts on its own; until then the current model keeps working.", - "这个 ComfyUI 不是启动器打开的,FreeVideo 没法重启它。关闭它后会自动开始切换,在此之前当前模型照常可用。") + return t("FreeVideo was not started by the launcher, so it cannot be restarted automatically. Once it is closed, the switch starts; until then the current model keeps working.", + "FreeVideo 不是由启动器启动的,无法自动重启。关闭后会自动开始切换,在此之前当前模型照常可用。") if (u.status === "downloaded" || u.status === "switching") return t("Generation pauses for about 2 minutes during the switch; settings and videos are kept.", "切换期间暂停生成约 2 分钟,设置和视频会保留。") if (u.status === "releasable" && u.in_use === "int8_convrot") @@ -249,7 +249,7 @@ ApplicationWindow { var phase = s.update.phase if (phase === "downloading") return t("FreeVideo restarts when the download finishes. Models and settings are kept.", "下载完成后自动重启,模型和设置都会保留。") if (phase === "waiting") return t("Running videos are not interrupted. FreeVideo restarts on its own afterwards.", "不会中断正在生成的视频,完成后自动重启更新。") - if (phase === "restarting" || phase === "engine") return t("ComfyUI restarts once; open FreeVideo pages refresh automatically.", "ComfyUI 会重启一次,已打开的 FreeVideo 页面会自动刷新。") + if (phase === "restarting" || phase === "engine") return t("FreeVideo restarts once; open pages refresh automatically.", "FreeVideo 会重启一次,已打开的页面会自动刷新。") if (phase === "checking") return "" if (s.update.status === "error" && s.update.error) return s.update.error if (s.update.candidate && s.update.manual) return t("Current version ", "当前版本 ") + releaseVersion(currentRelease) + t(". Download it and replace this version; models and settings are kept.", "。下载新版后替换当前版本,模型和设置会保留。") @@ -398,7 +398,7 @@ ApplicationWindow { anchors.verticalCenter: parent.verticalCenter x: win.narrow ? 12 : Math.max(20, Math.min((parent.width - width) / 2, headerTools.x - width - 16)) Repeater { - model: [t("ComfyUI", "ComfyUI"), t("Models", "模型"), t("Install", "安装")] + model: [t("Runtime", "环境"), t("Models", "模型"), t("Install", "安装")] delegate: Row { required property string modelData; required property int index spacing: win.narrow ? 4 : win.compact ? 8 : 12 @@ -444,7 +444,7 @@ ApplicationWindow { NumberAnimation { to: 1; duration: 1400; easing.type: Easing.InOutSine } } } - FText { id: connected; x: 23; anchors.verticalCenter: parent.verticalCenter; text: t("ComfyUI connected", "ComfyUI 已连接"); font.pixelSize: theme.micro; color: theme.success } + FText { id: connected; x: 23; anchors.verticalCenter: parent.verticalCenter; text: t("Connected", "已连接"); font.pixelSize: theme.micro; color: theme.success } } // Both languages stay visible; the current one is marked. FSegmented { @@ -568,8 +568,8 @@ ApplicationWindow { Layout.fillWidth: true; spacing: 12 FChoice { objectName: "newComfyMethod"; Layout.fillWidth: true; Layout.minimumWidth: 0; Layout.preferredWidth: 1; Layout.fillHeight: true - text: t("Install ComfyUI", "帮我安装 ComfyUI") - detail: t("Prepare ComfyUI and its environment.", "准备 ComfyUI 和运行环境。") + text: t("New installation", "全新安装") + detail: t("Prepare the runtime environment.", "准备运行环境。") checked: s.form.new_comfy; enabled: !s.busy onClicked: backend.edit("new_comfy", true) } @@ -1009,8 +1009,8 @@ ApplicationWindow { ColumnLayout { Layout.fillWidth: true; spacing: 6 // A failed start stays failed while another task (an import, a cleanup) runs: the controller's own tasks clear it first. - FText { objectName: "statusTitle"; text: s.status === "open" ? t("FreeVideo is ready", "FreeVideo 已就绪") : s.status === "failed" ? t("Startup interrupted", "启动未完成") : s.busy ? t("Starting ComfyUI", "正在启动 ComfyUI") : s.status === "restart-required" && s.engine_exit_text ? t("ComfyUI stopped", "ComfyUI 已停止") : s.status === "restart-required" ? t("Restart ComfyUI", "请重启 ComfyUI") : t("Ready to launch", "准备就绪"); font.pixelSize: theme.section + 2; font.weight: Font.DemiBold; Layout.fillWidth: true } - FText { objectName: "statusDetail"; text: s.status === "open" ? s.url : s.status === "restart-required" && s.engine_exit_text ? s.engine_exit_text : s.status === "restart-required" ? t("Restart ComfyUI after the update, then select \"Connect again\".", "更新后需重启 ComfyUI,再点“重新连接”。") : s.status === "failed" ? t("ComfyUI did not start. See the message above.", "ComfyUI 未能启动,原因见上方。") : t("Your models and environment are connected.", "已连接模型与运行环境。"); color: theme.muted; Layout.fillWidth: true } + FText { objectName: "statusTitle"; text: s.status === "open" ? t("FreeVideo is ready", "FreeVideo 已就绪") : s.status === "failed" ? t("Startup interrupted", "启动未完成") : s.busy ? t("Starting FreeVideo", "正在启动 FreeVideo") : s.status === "restart-required" && s.engine_exit_text ? t("FreeVideo stopped", "FreeVideo 已停止") : s.status === "restart-required" ? t("Restart FreeVideo", "请重启 FreeVideo") : t("Ready to launch", "准备就绪"); font.pixelSize: theme.section + 2; font.weight: Font.DemiBold; Layout.fillWidth: true } + FText { objectName: "statusDetail"; text: s.status === "open" ? s.url : s.status === "restart-required" && s.engine_exit_text ? s.engine_exit_text : s.status === "restart-required" ? t("Restart FreeVideo after the update, then select \"Connect again\".", "更新后需重启 FreeVideo,再点“重新连接”。") : s.status === "failed" ? t("FreeVideo did not start. See the message above.", "FreeVideo 未能启动,原因见上方。") : t("Your models and environment are connected.", "已连接模型与运行环境。"); color: theme.muted; Layout.fillWidth: true } FText { objectName: "portMovedNote"; visible: s.status === "open" && s.port_from > 0; text: t("Port %1 is in use by another program, so FreeVideo now uses port %2 and will keep using this address.", "端口 %1 已被其他程序占用,FreeVideo 改用端口 %2,以后也使用这个地址。").arg(s.port_from).arg(s.port_to); font.pixelSize: 13; color: theme.muted; wrapMode: Text.WordWrap; Layout.fillWidth: true; Layout.topMargin: -2 } FText { objectName: "pluginScopedNote"; visible: s.status === "open" && s.plugin_scoped; text: t("Some installed plugins are not compatible with FreeVideo, so only FreeVideo was loaded this time.", "部分已装的插件与 FreeVideo 不兼容,这次只载入了 FreeVideo。"); font.pixelSize: 13; color: theme.muted; wrapMode: Text.WordWrap; Layout.fillWidth: true; Layout.topMargin: -2 } } @@ -1543,7 +1543,7 @@ ApplicationWindow { ColumnLayout { Layout.fillWidth: true; visible: settingsTab === "advanced"; spacing: 20; enabled: s.can_manage FGroup { - Layout.fillWidth: true; title: t("ComfyUI address", "ComfyUI 地址") + Layout.fillWidth: true; title: t("Server address", "服务地址") FField { objectName: "listenAddress"; Layout.fillWidth: true; value: s.form.url; enabled: !s.form.lan_access; onEditingFinished: backend.edit("url", text) } FText { objectName: "addressError"; visible: s.field_error.key === "url"; text: visible ? s.field_error.message : ""; color: theme.danger; font.pixelSize: theme.micro; Layout.fillWidth: true } FText { objectName: "listenAddressHint"; text: s.lan_password_set ? t("With 0.0.0.0 or this computer's LAN IP, devices on the same network can open FreeVideo without the password.", "填 0.0.0.0 或本机的局域网 IP 后,同一网络中的设备不用密码就能打开 FreeVideo。") : t("With 0.0.0.0 or this computer's LAN IP, devices on the same network can open FreeVideo without the access link.", "填 0.0.0.0 或本机的局域网 IP 后,同一网络中的设备不需要访问链接就能打开 FreeVideo。"); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } @@ -1553,12 +1553,12 @@ ApplicationWindow { Layout.fillWidth: true; title: t("Folders · optional", "目录 · 可选"); enabled: !s.portable FText { text: t("Engine folder", "引擎目录"); font.pixelSize: theme.micro; color: theme.muted } RowLayout { Layout.fillWidth: true; spacing: 8; FField { Layout.fillWidth: true; value: s.form.engine; placeholderText: t("Automatic", "自动选择"); onEditingFinished: backend.edit("engine", text) } FButton { objectName: "engineBrowse"; text: t("Browse…", "浏览…"); enabled: s.can_manage; implicitHeight: theme.height + 4; onClicked: backend.browse("engine") } } - FText { text: t("ComfyUI Python", "ComfyUI Python"); font.pixelSize: theme.micro; color: theme.muted; Layout.topMargin: 4 } + FText { text: t("Python environment", "Python 环境"); font.pixelSize: theme.micro; color: theme.muted; Layout.topMargin: 4 } FField { Layout.fillWidth: true; value: s.form.python; placeholderText: Qt.platform.os === "windows" ? t("Path to python.exe", "python.exe 的路径") : t("Path to python", "python 的路径"); onEditingFinished: backend.edit("python", text) } } FGroup { Layout.fillWidth: true; title: t("Maintenance", "维护"); enabled: !s.portable - FSwitch { Layout.fillWidth: true; text: t("Create a separate ComfyUI environment", "创建独立的 ComfyUI 环境"); checked: s.form.separate; onToggled: backend.edit("separate", checked) } + FSwitch { Layout.fillWidth: true; text: t("Create a separate environment", "创建独立的运行环境"); checked: s.form.separate; onToggled: backend.edit("separate", checked) } FDivider {} RowLayout { Layout.fillWidth: true; spacing: 16 @@ -1884,7 +1884,7 @@ ApplicationWindow { Item { visible: !!s.update.candidate; Layout.fillWidth: true } FButton { objectName: "updateCloseButton"; text: "×"; flat: true; Accessible.name: t("Close", "关闭"); onClicked: { manualUpdate = false; backend.dismissUpdate() } } } - FText { objectName: "updateDialogText"; text: s.update.phase === "waiting" ? t("A video is still generating. FreeVideo restarts and updates as soon as it finishes.", "还有视频正在生成,完成后会自动重启并更新。") : s.update.status === "ready" && s.update.candidate ? t("Downloaded. Restart to finish; models and settings are kept.", "下载完成,重启可完成更新,模型和设置都会保留。") : s.update.candidate && s.update.manual ? t("FreeVideo ", "FreeVideo ") + releaseVersion(s.update.candidate) + t(" is available (current ", " 已发布(当前 ") + releaseVersion(currentRelease) + t("). Download it and replace this version; models and settings are kept.", ")。下载新版后替换当前版本,模型和设置会保留。") : s.update.candidate ? t("FreeVideo ", "FreeVideo ") + releaseVersion(s.update.candidate) + t(" is available (current ", " 已发布(当前 ") + releaseVersion(currentRelease) + t("). Updating keeps your models and settings. FreeVideo restarts after the download; running videos finish first.", ")。更新会保留模型和设置,下载完成后自动重启;正在生成的视频会先完成。") : s.update.engine ? t("This launcher already includes engine ", "启动器已带有新版引擎 ") + releaseVersion(currentRelease) + t(" (installed: ", "(已安装 ") + engineVersion + (s.status === "open" ? t("). Updating takes about a minute, restarts ComfyUI once and keeps your models and settings.", ")。更新约需 1 分钟,会重启一次 ComfyUI,模型和设置都会保留。") : t("). Updating takes about a minute, then FreeVideo starts; models and settings are kept.", ")。更新约需 1 分钟,完成后自动启动,模型和设置都会保留。")) : s.update.status === "current" ? t("You're up to date.", "已是最新版本。") : s.update.status === "development" ? t("Running from source. Update with Git.", "当前从源码运行,请通过 Git 更新。") : s.update.status === "error" ? t("Could not check for updates.", "暂时无法检查更新。") : t("Checking the latest release…", "正在检查最新版本…"); color: theme.muted; Layout.fillWidth: true } + FText { objectName: "updateDialogText"; text: s.update.phase === "waiting" ? t("A video is still generating. FreeVideo restarts and updates as soon as it finishes.", "还有视频正在生成,完成后会自动重启并更新。") : s.update.status === "ready" && s.update.candidate ? t("Downloaded. Restart to finish; models and settings are kept.", "下载完成,重启可完成更新,模型和设置都会保留。") : s.update.candidate && s.update.manual ? t("FreeVideo ", "FreeVideo ") + releaseVersion(s.update.candidate) + t(" is available (current ", " 已发布(当前 ") + releaseVersion(currentRelease) + t("). Download it and replace this version; models and settings are kept.", ")。下载新版后替换当前版本,模型和设置会保留。") : s.update.candidate ? t("FreeVideo ", "FreeVideo ") + releaseVersion(s.update.candidate) + t(" is available (current ", " 已发布(当前 ") + releaseVersion(currentRelease) + t("). Updating keeps your models and settings. FreeVideo restarts after the download; running videos finish first.", ")。更新会保留模型和设置,下载完成后自动重启;正在生成的视频会先完成。") : s.update.engine ? t("This launcher already includes engine ", "启动器已带有新版引擎 ") + releaseVersion(currentRelease) + t(" (installed: ", "(已安装 ") + engineVersion + (s.status === "open" ? t("). Updating takes about a minute, restarts FreeVideo once and keeps your models and settings.", ")。更新约需 1 分钟,会重启一次 FreeVideo,模型和设置都会保留。") : t("). Updating takes about a minute, then FreeVideo starts; models and settings are kept.", ")。更新约需 1 分钟,完成后自动启动,模型和设置都会保留。")) : s.update.status === "current" ? t("You're up to date.", "已是最新版本。") : s.update.status === "development" ? t("Running from source. Update with Git.", "当前从源码运行,请通过 Git 更新。") : s.update.status === "error" ? t("Could not check for updates.", "暂时无法检查更新。") : t("Checking the latest release…", "正在检查最新版本…"); color: theme.muted; Layout.fillWidth: true } FText { objectName: "updateDialogError"; visible: !!s.update.error; text: s.update.error || ""; color: theme.danger; Layout.fillWidth: true; font.pixelSize: theme.micro } // Under the reason, one row from its left edge; the buttons wrap only when the window is too narrow. Flow { diff --git a/freevideo_engine/launcher_copy.py b/freevideo_engine/launcher_copy.py index 967bc8f5..046a0f95 100644 --- a/freevideo_engine/launcher_copy.py +++ b/freevideo_engine/launcher_copy.py @@ -13,8 +13,8 @@ '无法自动打开该文件夹,请在文件管理器中手动打开'), 'installation_missing': ('There is no installation information yet. Complete installation first.', '还没有安装信息,请先完成安装'), - 'installation_unavailable': ('The saved ComfyUI folder could not be opened. It may have been moved or renamed, or its drive may be disconnected. Choose its current location below, or install ComfyUI.', - '无法打开已保存的 ComfyUI 文件夹,它可能已被移动、改名,或所在磁盘未连接。请在下方选择它现在的位置,或安装 ComfyUI。'), + 'installation_unavailable': ('The saved ComfyUI folder could not be opened. It may have been moved or renamed, or its drive may be disconnected. Choose its current location below, or choose New installation.', + '无法打开已保存的 ComfyUI 文件夹,它可能已被移动、改名,或所在磁盘未连接。请在下方选择它现在的位置,或选择“全新安装”。'), 'checking_update': ('Checking for updates. Please wait.', '正在检查更新,请稍候'), 'update_install_failed': ('The update could not be installed. You can keep using the current version.', '无法安装更新。当前版本可以照常使用。'), @@ -214,9 +214,13 @@ def source_name(value, zh=False): LAN_ERRORS = { 'Enter localhost or an IP address of this computer, for example http://127.0.0.1:8188.': '请填写 localhost 或本机的 IP 地址,例如 http://127.0.0.1:8188。', 'This address does not belong to this computer. Enter one of its IP addresses or 0.0.0.0.': '这个地址不属于本机。请填写本机的 IP 地址或 0.0.0.0。', - 'This port and the next ones are in use or reserved by the system. Set a different local ComfyUI address.': '这个端口和后面的端口都已被占用或被系统保留,请换一个本机 ComfyUI 地址。', - 'The ports for LAN access are in use or reserved by the system. Choose another ComfyUI port.': '局域网访问要用的端口已被占用或被系统保留,请换一个 ComfyUI 端口。', - 'This port is in use by another application. Set a different local ComfyUI address.': '这个端口已被其他程序占用,请换一个本机 ComfyUI 地址。', + 'This port and the next ones are in use or reserved by the system. Set a different local server address.': '这个端口和后面的端口都已被占用或被系统保留,请换一个本机服务地址。', + 'The ports for LAN access and the ports after them are in use or reserved by the system. Close the programs using these ports, then turn it on again.': '局域网访问要用的端口和后面的端口都已被占用或被系统保留,请关闭占用这些端口的程序后再开启。', + 'This port is in use by another application. Set a different local server address.': '这个端口已被其他程序占用,请换一个本机服务地址。', + # What older versions raised; a message kept from one of them is still shown in Chinese. + 'This port and the next ones are in use or reserved by the system. Set a different local ComfyUI address.': '这个端口和后面的端口都已被占用或被系统保留,请换一个本机服务地址。', + 'The ports for LAN access are in use or reserved by the system. Choose another ComfyUI port.': '局域网访问要用的端口和后面的端口都已被占用或被系统保留,请关闭占用这些端口的程序后再开启。', + 'This port is in use by another application. Set a different local ComfyUI address.': '这个端口已被其他程序占用,请换一个本机服务地址。', 'A generation is running. Change the address after it finishes.': '正在生成,完成后可修改地址。', 'The ComfyUI already running does not use this address. After its jobs finish, restart it with this address and connect again.': '已在运行的 ComfyUI 没有使用这个地址。请在任务完成后用这个地址重新启动 ComfyUI,再重新连接。', 'The ComfyUI already running is open to the network directly. After its jobs finish, restart it on 127.0.0.1, then turn on LAN access.': '已在运行的 ComfyUI 正在直接对局域网开放。请在任务完成后改用 127.0.0.1 重新启动它,再开启局域网访问。', @@ -362,6 +366,10 @@ def display(value, zh=False): for pattern, translated in ( (r'Downloading packages · about (.+) across (\d+) files', r'下载组件 · 约 \1,共 \2 个文件'), (r'about (.+) across (\d+) files', r'约 \1,共 \2 个文件'), + (r'This is the first installation of the native runtime for this computer, so the runtime components are downloaded ' + r'again \(about (.+)\)\.', r'首次安装适用于这台电脑的原生运行环境,需要重新下载运行组件(约 \1)。'), + (r'This is the first installation of the native runtime for this computer, so the runtime components are downloaded ' + r'again\.', '首次安装适用于这台电脑的原生运行环境,需要重新下载运行组件。'), (r'(\d+) files / folders scanned', '正在查找文件'), (r'Testing download sources (\d+ / \d+)', r'正在测试下载源 \1'), (r'(\d+ / \d+) files', r'\1 个文件'), (r'shard (\d+ / \d+)', '正在下载'), diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py index 24493427..9393d1bf 100644 --- a/freevideo_engine/launcher_session.py +++ b/freevideo_engine/launcher_session.py @@ -395,7 +395,7 @@ def edit(self, key, value): value = local_url(str(value)) except ValueError as exc: if str(exc).startswith(('Invalid ComfyUI port', 'Port ')): - message = self.t('The ComfyUI port is not valid.', 'ComfyUI 端口无效。') + message = self.t('The server port is not valid.', '服务端口无效。') else: message = self.t( 'Enter localhost or an IP address of this computer, for example http://127.0.0.1:8188.', diff --git a/freevideo_engine/launcher_update.py b/freevideo_engine/launcher_update.py index ad04c3f2..080c07d3 100644 --- a/freevideo_engine/launcher_update.py +++ b/freevideo_engine/launcher_update.py @@ -68,13 +68,19 @@ def source_order(language=None): MAC_CHANNEL = 'macos-preview' # Linux has no release before combined releases, so no platform tag to fall back on. LINUX_CHANNEL = 'linux-preview' +# Native Windows ARM64 is a platform of its own: its package and manifest names +# differ from x64, so an x64 launcher never reads an ARM64 update and the other +# way round. Like Linux it has no release before combined releases. +WINDOWS_ARM64_CHANNEL = 'windows-arm64-preview' +NO_LEGACY_CHANNELS = (LINUX_CHANNEL, WINDOWS_ARM64_CHANNEL) # Stable builds follow the latest vX.Y.Z release; nightly builds follow the # rolling `nightly` prerelease. Both carry every platform in one release. TRACKS = ('stable', 'nightly') NIGHTLY_TAG = 'nightly' RELEASE_ASSETS = {CHANNEL: ('FreeVideo.exe', 'update-windows.json'), MAC_CHANNEL: ('FreeVideo-Mac-arm64.dmg', 'update-macos.json'), - LINUX_CHANNEL: ('FreeVideo-Linux-x86_64.AppImage', 'update-linux.json')} + LINUX_CHANNEL: ('FreeVideo-Linux-x86_64.AppImage', 'update-linux.json'), + WINDOWS_ARM64_CHANNEL: ('FreeVideo-Windows-arm64.exe', 'update-windows-arm64.json')} CHANNELS = tuple(RELEASE_ASSETS) MANIFEST_DOMAIN = b'FreeVideo update manifest v1\x00' # Every platform's mirror manifest carries the release signature, which binds the @@ -320,6 +326,9 @@ def build_identity(value): elif value['channel'] == LINUX_CHANNEL: if value.get('target') != 'linux-x86_64' or value.get('packaging') != 'appimage': raise ValueError('Invalid Linux launcher build identity') + elif value['channel'] == WINDOWS_ARM64_CHANNEL: + if build_target(value) != 'windows-arm64': + raise ValueError('Invalid Windows ARM64 launcher build identity') elif build_target(value) != 'windows-x86_64': raise ValueError('Launcher update channel does not match its target') if build_track(value) not in TRACKS: @@ -333,6 +342,8 @@ def build_identity(value): result.update(target='macos-arm64', packaging='app') if value['channel'] == LINUX_CHANNEL: result.update(target='linux-x86_64', packaging='appimage') + if value['channel'] == WINDOWS_ARM64_CHANNEL: + result['target'] = 'windows-arm64' from .release_notes import optional_fields result.update(optional_fields(value)) return result @@ -497,7 +508,7 @@ def _release(token, channel, track): names = {a.get('name') for a in (release or {}).get('assets', []) if isinstance(a, dict)} if isinstance(release, dict) and not release.get('draft') and not release.get('prerelease') and metadata in names: return release, executable, metadata - if channel == LINUX_CHANNEL: + if channel in NO_LEGACY_CHANNELS: raise UpdateUnavailable('missing') # Until the first combined release, updates come from the platform tag. release = _json(API + '/releases/tags/' + channel, token) @@ -551,7 +562,7 @@ def _github_release(token='', *, channel=CHANNEL, track='stable'): try: candidate = manifest(_json(url, '', binary=True, limit=MAX_MANIFEST_BYTES)) except urllib.error.HTTPError as error: - if error.code == 404 and track == 'stable' and channel != LINUX_CHANNEL: + if error.code == 404 and track == 'stable' and channel not in NO_LEGACY_CHANNELS: try: candidate = manifest(_json(asset_url(channel, 'update.json'), '', binary=True, limit=MAX_MANIFEST_BYTES)) except OSError as legacy: diff --git a/freevideo_engine/model_guidance.py b/freevideo_engine/model_guidance.py index 7407d1c1..04f3e437 100644 --- a/freevideo_engine/model_guidance.py +++ b/freevideo_engine/model_guidance.py @@ -417,8 +417,9 @@ def replace_export(stage, target): def runtime_packages_supported(): - """The offline Environment package carries a Windows runtime.""" - return sys.platform == 'win32' + """The offline Environment package carries a Windows x64 runtime.""" + from .environments import windows_arm64 + return sys.platform == 'win32' and not windows_arm64() def package_instructions(runtime_needed, zh=False): diff --git a/freevideo_engine/network.py b/freevideo_engine/network.py index cb479d38..06877ace 100644 --- a/freevideo_engine/network.py +++ b/freevideo_engine/network.py @@ -413,7 +413,7 @@ def probe_score(row, family): def plan(spec, versions, layout='unified', *, mode='auto', timeout=5, offline=False, env=None, model_only=False, measure_speed=True, progress=None, proxy_mode='auto', git_available=True, only=None): - from .environments import ENVIRONMENTS, environment_names + from .environments import environment_spec, environment_names env = proxy_environment(env) started = time.monotonic() if proxy_mode not in proxy.MODES: @@ -428,7 +428,7 @@ def plan(spec, versions, layout='unified', *, mode='auto', timeout=5, offline=Fa if versions.get('target_system') in ('Windows', 'Darwin'): families.remove('cuda') for name in (() if versions.get('target_system') == 'Darwin' else environment_names(layout)): - role = ENVIRONMENTS[name] + role = environment_spec(name, versions.get('target_system'), versions.get('target_machine')) family = 'torch-' + role['cuda'] + '-' + role['torch'][0].split('==')[1] if family not in families: families.append(family) @@ -437,8 +437,13 @@ def plan(spec, versions, layout='unified', *, mode='auto', timeout=5, offline=Fa if only is not None: families = [family for family in families if family in only] selections, jobs = {}, [] + arm_torch = versions.get('target_system') == 'Windows' and versions.get('target_machine') == 'arm64' for family in families: group = 'torch' if family.startswith('torch-') else 'github' if family == 'git' else family + if arm_torch and group == 'torch': + # Windows on Arm takes the torch family from NVIDIA's index, named in each wheel row; nothing to measure. + selections[family] = [] + continue names = ['official'] if mode == 'official' else list(SOURCES[group]) if mode != 'official' and configured_source(group, env): names.insert(0, 'user') diff --git a/freevideo_engine/offline_packages.py b/freevideo_engine/offline_packages.py index 006fabe9..137ebfa3 100644 --- a/freevideo_engine/offline_packages.py +++ b/freevideo_engine/offline_packages.py @@ -224,6 +224,9 @@ def runtime_id(): def runtime_fits(value): """Any earlier ZIP whose runtime is unchanged serves this version.""" + from .environments import windows_arm64 + if windows_arm64(): + return False # The package holds an x64 Python and x64 wheels. found = value.get('runtime_id') or EARLIER_RUNTIMES.get(value.get('dependency_id')) return value.get('schema_version') == 2 and found == runtime_id() diff --git a/freevideo_engine/policy.py b/freevideo_engine/policy.py index 35e250f3..63a15d78 100644 --- a/freevideo_engine/policy.py +++ b/freevideo_engine/policy.py @@ -603,6 +603,10 @@ def __init__(self, hardware, gpu_total, ram_total, free_gpu, free_ram, reserve_g cgroup_ram_limit_bytes=hardware.cgroup_ram_limit, ram_physical_available_bytes=hardware.ram_physical_available, ram_commit_available_bytes=hardware.ram_commit_available) + # One pool (resource_budget): the GPU's usable figure is what is left after the host's share and reserve. + host_share = UNIFIED_HOST_BYTES + int(reserve_ram * GiB) if shared_pool(hardware) else 0 + if host_share: + self.details.update(gpu_budget_bytes=self.details['gpu_budget_bytes'] - host_share, unified_host_share_bytes=host_share) failed = [name for name in ('gpu', 'ram') if self.details[name+'_budget_bytes'] < self.details[name+'_minimum_bytes']] self.details['insufficient'] = failed @@ -610,7 +614,7 @@ def __init__(self, hardware, gpu_total, ram_total, free_gpu, free_ram, reserve_g # automatic reserve would leave enough. Said in the refusal so the # setting is named instead of looking like a shortage of memory. automatic = int(automatic_gpu_reserve_gib(hardware.system == 'Windows', free_gpu) * GiB) - automatic_budget = free_gpu - automatic + automatic_budget = free_gpu - automatic - host_share self.details['gpu_reserve_explicit'] = bool(gpu_reserve_explicit) if ('gpu' in failed and gpu_reserve_explicit and int(reserve_gpu * GiB) > automatic and automatic_budget >= gpu_minimum_bytes): @@ -644,6 +648,9 @@ def __init__(self, hardware, gpu_total, ram_total, free_gpu, free_ram, reserve_g (canvas['width'], canvas['height'], canvas['frames'], canvas['frames']/24, canvas['video_tokens'], canvas.get('reference_video_tokens', 0) + canvas.get('reference_audio_tokens', 0))) + if host_share: + lines.append('The GPU and the host share one memory pool: VRAM and RAM below are the same %.2f GiB, and the ' + 'usable VRAM leaves the host %.2f GiB of it.' % (free_gpu / GiB, host_share / GiB)) for name, label in (('gpu', 'VRAM'), ('ram', 'RAM')): lines.append('%s: %.2f GiB available, %.2f GiB reserved for system growth, ' '%.2f GiB usable; minimum %.2f GiB. Capacity %.2f / %.2f GiB.' % @@ -814,6 +821,30 @@ def commit_gpu_limit(hardware: Hardware, request_budget): return int(limit) if limit < request_budget else None +# GB10 and the RTX Spark laptops built on it (compute capability 12.1) keep the GPU's memory in system memory. +# +# On Linux (DGX Spark) it is one pool: CUDA's free figure and MemAvailable describe the same bytes, and a byte the GPU +# takes is gone for the host. The host's share is the private memory measured beside a complete request on Windows, +# where the allocator's reservations are charged to the same commit account (WINDOWS_COMMIT_HOST_BYTES), plus its +# spare for other programs: a starting point from that measurement, to be calibrated on a GB10 (arm64 2b). +# +# On Windows the GPU's part is a dedicated carve-out the user can resize (NVML reports only that part; 96 GiB of a +# 128 GB laptop left the CPU about 30.5 GiB), so the two figures do not overlap. What they share is the commit +# account: NVIDIA confirmed that CUDA allocations are charged to it even inside the carve-out. commit_gpu_limit +# already holds the GPU budget to the commit headroom less the host's share, as on every Windows machine. +UNIFIED_HOST_BYTES = WINDOWS_COMMIT_HOST_BYTES + WINDOWS_COMMIT_SPARE_BYTES + + +def unified_memory(hardware: Hardware): + """Whether the GPU's memory is system memory, so a host copy of a weight is a second copy, not a saving.""" + return hardware.architecture == 'blackwell-unified' + + +def shared_pool(hardware: Hardware): + """Whether the GPU's free figure and the host's available memory are the same bytes (unified memory on Linux).""" + return unified_memory(hardware) and hardware.system != 'Windows' + + def automatic_gpu_reserve_gib(desktop, free_gpu): """The VRAM growth reserve when none is set: a fixed share on Windows, a fraction of the free card elsewhere.""" return .25 if desktop else max(.5, min(1., free_gpu / GiB * .025)) @@ -841,6 +872,11 @@ def resource_budget(hardware: Hardware, *, vram_gib=None, ram_gib=None, free_ram = max(0, min(ram_total, hardware.ram_available)) if hardware.cgroup_ram_limit is not None: free_ram = min(free_ram, hardware.cgroup_ram_limit) + unified = shared_pool(hardware) + if unified: + # One pool, counted once. CUDA's figure leaves out reclaimable page cache and MemAvailable counts it, so the + # smaller of the two is what both sides can rely on. + free_gpu = free_ram = min(free_gpu, free_ram) reserve_gpu = (gpu_reserve_gib if gpu_reserve_gib is not None else automatic_gpu_reserve_gib(desktop, free_gpu)) reserve_ram = ram_reserve_gib if ram_reserve_gib is not None else max(2. if desktop else 1., min(4., free_ram / GiB * .05)) @@ -848,6 +884,12 @@ def resource_budget(hardware: Hardware, *, vram_gib=None, ram_gib=None, raise ValueError('System RAM headroom must be finite and nonnegative.') gpu_budget = free_gpu - int(reserve_gpu * GiB) ram_budget = free_ram - int(reserve_ram * GiB) + if unified: + # The GPU budget leaves the host its share and its reserve. The RAM budget, which the RAM guard enforces, + # stays the whole pool less its reserve: whether the guard's reading includes CUDA allocations on these + # machines is not known yet (arm64 2e), and a guard that saw them would stop every request at a host-sized + # budget. The planner keeps no weights in host memory here (see _choose), so the host does not grow into it. + gpu_budget -= UNIFIED_HOST_BYTES + int(reserve_ram * GiB) return dict(gpu_capacity_bytes=gpu_total, ram_capacity_bytes=ram_total, gpu_available_bytes=free_gpu, ram_available_bytes=free_ram, gpu_system_reserve_bytes=int(reserve_gpu * GiB), @@ -1148,6 +1190,10 @@ def _choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto' raise ValueError('Demonstrated RAM must be a nonnegative byte count') retention_budget = max(ram_budget, min(demonstrated_ram_bytes, ram_total - int(reserve_ram * GiB))) + if unified_memory(hardware): + # A weight kept in host memory is a second copy in the same pool, which saves nothing: blocks the GPU budget + # does not hold are read from the model file instead, and the GPU budget above already holds what fits. + retention_budget = 0 small_adjustment = (int(4.6 * GiB * (effective_tokens / (72 * 1008) - 1.)) if canvas is not None else 0) # Scale the existing activation estimate with output and reference rows. @@ -1793,6 +1839,9 @@ def held(group): # keeps read-only views of the rest, which avoid rereads while RAM allows. streamed_weights = ((hardware.system == 'Windows' and resident < 50) or (50 - resident) * block_bytes + host_activation + 2 * GiB > retention_budget) + if unified_memory(hardware): + # Nothing is kept in host memory there (retention_budget is 0): only blocks the GPU does not hold are read. + streamed_weights = resident < 50 if streamed_weights: # When the remaining weights exceed RAM, a bounded retained subset # prevents rereading those bytes every step. This addresses disk I/O, @@ -1917,6 +1966,11 @@ def held(group): if commit_limit is not None: notes.append('Windows commit headroom is %.2f GiB: sampling keeps its GPU allocation within %.2f GiB, the most that commit can back beside the host\'s memory without changing the planned compute shapes. Weights beyond that stay streamed; arithmetic and attention are unchanged.' % ((hardware.ram_commit_available or 0) / GiB, commit_limit / GiB)) + if shared_pool(hardware): + notes.append('One memory pool serves the GPU and the host: the GPU budget leaves the host %.2f GiB and its reserve, and no weights are kept in host memory.' + % (UNIFIED_HOST_BYTES / GiB)) + elif unified_memory(hardware): + notes.append('The GPU memory is a carve-out of system memory and CUDA allocations are charged to Windows commit: the commit headroom bounds the GPU budget, and no weights are kept in host memory.') if retention_budget > ram_budget: notes.append('Weight caching may keep %.2f GiB rather than the %.2f GiB currently reported available: a complete verified request on this machine, under this compute build and geometry, held that much. The request budget and admission still use the reported figure.' % (retention_budget / GiB, ram_budget / GiB)) diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json index a1fe6873..3c7d8d77 100644 --- a/freevideo_engine/release_notes.json +++ b/freevideo_engine/release_notes.json @@ -1,37 +1,74 @@ { "schema": 1, - "product_version": "0.6.8", + "product_version": "0.6.9", "en": { - "summary": "0.6.8 keeps models on the graphics card more often when pictures and videos alternate, has background preparation give the card back sooner when a generation starts, lets results be upscaled from their own menu, makes tutorial chapters searchable from the command palette, and explains more failures.", + "summary": "0.6.9 improves canceling, track display and continuation in the Edit view; has the launcher restore missing program files and give clearer messages; explains more clearly when a performance measurement stops for lack of memory, when FreeVideo does not answer in time and when no NVIDIA graphics card is found; and adds three tutorial chapters.", "changes": [ - "Fewer reloads when pictures and videos alternate: when only system memory is short, models already on the graphics card are no longer cleared with it; after a picture, the video model returns to the card; when both cannot fit, the one used last stays.", - "A new generation gets the graphics card sooner: when Generate is clicked, background compiling and text-encoder preparation stop within seconds and give the card back instead of finishing first.", - "Less waiting in the second pass on 8 GB cards: on cards with less video memory, the second pass no longer waits for the processor to join intermediate results; the output is identical.", - "Upscale from the result menu: a result's \"⋯\" menu offers \"Upscale to W × H\", the same as the library's right-click menu.", - "Search the tutorial from the command palette: while text is typed in the command palette, matching tutorial chapters are listed after the related actions, and choosing one opens that chapter; Chinese and English chapter names and common terms can all be searched.", - "Launcher path tip: a folder's full path is shown as a tip only when the path is cut off.", - "More failures explain their cause: the prompt model and dubbing say when they fail for lack of disk space; a failure whose cause the engine has stated is no longer shown as an unexplained process exit and gets advice for that cause; on a Mac, using reference media together with first and last frames explains that one of the two has to be kept, and what to do next.", - "More accurate LoRA check: step-distillation acceleration LoRAs saved in other layouts are recognized as acceleration LoRAs, and language-model LoRAs are identified as such.", - "Edit view details: the title bar is no longer covered by the timeline's drag layers; at phone width the toolbar fits in one row; closing the Edit view clears the \"last edit not found\" notice; the slow-interface notice stays in the notification list until it is closed.", - "Reverse prompt: a video clip that yields a single frame can be reverse-prompted." + "More tracks in view in the Edit view: when the timeline cannot show every track, the sound tracks become slightly shorter so that as many as possible are visible; if they still do not fit, a fade at the bottom of the timeline shows that more tracks are below.", + "Smoother continuation in the Edit view: when a continued video finishes, its next part is made ready and the creation preview being watched stays open.", + "In a wider window, while a part is generating in the Edit view, Cancel stands on the greyed Generate key, where the mouse can reach it.", + "More recordings can be imported in the Edit view: WebM and MKV recordings that do not state their length can now be imported.", + "Clearer prompt when dubbing is stopped: in the Edit view, the confirmation says that lines already dubbed are kept and the rest can be dubbed again later.", + "The launcher restores missing program files: when files in its saved program folder are missing or empty, the launcher restores them from its built-in copy before setup or launch, then continues as usual. When a Windows setup step ends like a crash, the setup log gains one line with the exit code, a short check of that step's Python and its path.", + "Clearer launcher wording: the status heading says FreeVideo (such as Starting FreeVideo and FreeVideo stopped), and on the setup page the first step and the first option are called Runtime and New installation. The setting \"ComfyUI address\" is now called \"Server address\", and the message for a port in use says the same; when the LAN access ports are in use, the message says to close the programs using them, then turn LAN access on again.", + "Clearer explanation of the graphics card at setup: on Windows, when no NVIDIA driver is found and the computer lists only display devices from other makers, a virtual machine's included, the launcher says that no NVIDIA graphics card was found; when the graphics list cannot be read, the setup report says which step failed. FreeVideo still needs an NVIDIA graphics card with compute capability 8.0 or higher (such as the RTX 30 series or newer, professional cards included).", + "Clearer message when a performance measurement stops: when it stops because the computer ran out of available memory, Settings states the cause and the next step, and a problem can be reported. In a narrow window, a failure message in Settings grows with its text and shows in full.", + "Clearer notice when an answer is late: when FreeVideo does not answer in time, some cases that used to read as a lost connection now say FreeVideo is not responding and suggest checking the queue first; when a queue action gets no answer, the card suggests checking the queue's current state.", + "Three new tutorial chapters: Upscale a video, how to upscale a video to a larger size or to about 4K; making several videos at once (batch, one prompt per line, loop); and organizing creations (tags, filters, compare, recently deleted). The tutorial also covers \"Composition only\" for reference videos and running the second pass from a preview's right-click menu in Creations, and updates how characters, scenes and props work with first and last frames and the steps for selecting creations and finding Favorites.", + "More accurate memory planning on NVIDIA computers whose video memory and system memory are one pool (such as DGX Spark): the plan counts the pool once and leaves a part of it for the system (not verified on a physical computer). Windows on Arm computers: setup chooses its downloads by the processor of the computer (not verified on a physical computer). Dubbing is not available on these computers." ] }, "zh": { - "summary": "0.6.8 让图片与视频交替使用时模型更多留在显卡上,开始生成时后台准备工作更快让出显卡;结果菜单可以直接放大,命令面板可以搜索教程章节,更多失败会说明原因。", + "summary": "0.6.9 改进剪辑视图的取消、轨道显示和接续生成;启动器自动补回缺失的程序文件,提示更清楚;性能测量因内存不足停止、FreeVideo 没有及时应答、没有找到 NVIDIA 显卡时,说明更清楚;教程新增三章。", "changes": [ - "图片和视频交替使用时更少重复载入:只是电脑内存紧张时,已在显卡上的模型不再被一并清出;图片用完后,视频模型会重新回到显卡;两者放不下时,保留最近使用的一个。", - "开始生成更快接手显卡:点击生成时,后台的编译和文本编码器准备会在几秒内停下并让出显卡,不再等它们做完。", - "8 GB 显卡第二遍更少等待:显存较小时,第二遍不再等待处理器拼接中间结果,画面与之前完全一致。", - "结果菜单可以放大:生成结果的“⋯”菜单中可直接选择“放大到 宽 × 高”,与作品库右键菜单一致。", - "命令面板可以搜索教程:在命令面板中输入文字时,匹配的教程章节会列在相关操作之后,选择即可打开该章;中文、英文章节名和常用说法都可搜索。", - "启动器路径提示:文件夹路径只在显示不全时才出现完整路径提示。", - "更多失败会说明原因:提示词模型和配音因磁盘空间不足失败时会说明;引擎已写明原因的失败不再显示为原因不明的进程退出,并给出对应的处理建议;在 Mac 上同时使用参考素材和首尾帧时,会说明需要保留其中一种,以及下一步怎么做。", - "LoRA 检查更准确:以其他方式保存的步数蒸馏加速 LoRA 也能被识别为加速 LoRA;语言模型的 LoRA 会被如实指出。", - "剪辑视图细节:标题栏不再被时间线拖动层遮住;手机宽度下工具条完整放在一行;关闭剪辑视图后,“找不到上次的剪辑”提示随之清除;界面变慢的提示会保留在通知列表中,直到手动关闭。", - "反推提示词:只取到一帧的视频片段也能正常反推。" + "剪辑视图轨道多时看得更全:时间线放不下所有轨道时,声音轨会略微变矮,让轨道尽量全部显示;仍放不下时,时间线下沿出现渐隐,提示下面还有轨道。", + "剪辑视图接续生成更顺畅:接续生成的视频完成后,下一段会照常备好,正在看的作品预览保持打开。", + "在较宽的窗口里,剪辑视图生成一段时,“取消”键移到变灰的“生成视频”键处,可以用鼠标点到。", + "剪辑视图可以导入更多录制文件:文件中没有写明时长的 WebM、MKV 录制文件现在可以导入。", + "停止配音时说明更准确:在剪辑视图中停止配音,确认框会说明已配好的台词会保留,其余台词可以稍后重新配音。", + "启动器自动补回缺失的程序文件:已保存的程序文件夹中有文件缺失或被清空时,启动器会在安装或启动前从自带的副本补回,然后照常继续。Windows 安装中某一步像崩溃一样结束时,安装日志会多记一行,写明退出码、对该步 Python 的简短检查和 Python 路径。", + "启动器用词更清楚:状态标题改用“FreeVideo”(如“正在启动 FreeVideo”“FreeVideo 已停止”),安装页的第一步和第一个选项改称“环境”和“全新安装”。设置项“ComfyUI 地址”改称“服务地址”,端口被占用时的提示也用这个名字;局域网访问的端口被占用时,提示关闭占用端口的程序,再重新开启局域网访问。", + "安装时的显卡说明更清楚:在 Windows 上找不到 NVIDIA 驱动、电脑里只有其他厂商的显示设备(包括虚拟机的)时,启动器会说明没有找到 NVIDIA 显卡;读不出显卡列表时,安装报告写明是哪一步。FreeVideo 仍需要计算能力 8.0 及以上的 NVIDIA 显卡(如 RTX 30 系列及更新,包括专业卡)。", + "性能测量停止时说明更清楚:性能测量因电脑可用内存不足而停止时,设置页会写明原因和下一步,并可以提交问题。设置页的失败说明在窄窗口中随文字变高,完整显示。", + "应答超时的提示更准确:FreeVideo 没有及时应答时,部分原先显示“连接已断开”的情况改为显示“FreeVideo 没有响应”,并提醒先查看队列;队列操作没有得到应答时,提醒查看队列中的实际状态。", + "教程新增三章:“放大视频”,说明如何把视频放大到更大的尺寸或 4K 级别;“一次生成多条”(批量、每行一条描述、循环);“整理作品”(标签、筛选、对比、最近删除)。另补充参考视频“仅参考构图”和在作品库中右键预览继续二采的用法,更新角色、场景和道具与首帧、尾帧搭配使用的说明,以及作品库多选和收藏位置的说明。", + "显存与内存为同一片的 NVIDIA 电脑(如 DGX Spark)的内存规划更准确:规划时这片内存只算一次,并为系统留出一部分(未在真机验证)。Windows on Arm 电脑:安装时按电脑架构选择下载内容(未在真机验证)。这类电脑上无法使用配音。" ] }, "history": [ + { + "product_version": "0.6.8", + "en": { + "summary": "0.6.8 keeps models on the graphics card more often when pictures and videos alternate, has background preparation give the card back sooner when a generation starts, lets results be upscaled from their own menu, makes tutorial chapters searchable from the command palette, and explains more failures.", + "changes": [ + "Fewer reloads when pictures and videos alternate: when only system memory is short, models already on the graphics card are no longer cleared with it; after a picture, the video model returns to the card; when both cannot fit, the one used last stays.", + "A new generation gets the graphics card sooner: when Generate is clicked, background compiling and text-encoder preparation stop within seconds and give the card back instead of finishing first.", + "Less waiting in the second pass on 8 GB cards: on cards with less video memory, the second pass no longer waits for the processor to join intermediate results; the output is identical.", + "Upscale from the result menu: a result's \"⋯\" menu offers \"Upscale to W × H\", the same as the library's right-click menu.", + "Search the tutorial from the command palette: while text is typed in the command palette, matching tutorial chapters are listed after the related actions, and choosing one opens that chapter; Chinese and English chapter names and common terms can all be searched.", + "Launcher path tip: a folder's full path is shown as a tip only when the path is cut off.", + "More failures explain their cause: the prompt model and dubbing say when they fail for lack of disk space; a failure whose cause the engine has stated is no longer shown as an unexplained process exit and gets advice for that cause; on a Mac, using reference media together with first and last frames explains that one of the two has to be kept, and what to do next.", + "More accurate LoRA check: step-distillation acceleration LoRAs saved in other layouts are recognized as acceleration LoRAs, and language-model LoRAs are identified as such.", + "Edit view details: the title bar is no longer covered by the timeline's drag layers; at phone width the toolbar fits in one row; closing the Edit view clears the \"last edit not found\" notice; the slow-interface notice stays in the notification list until it is closed.", + "Reverse prompt: a video clip that yields a single frame can be reverse-prompted." + ] + }, + "zh": { + "summary": "0.6.8 让图片与视频交替使用时模型更多留在显卡上,开始生成时后台准备工作更快让出显卡;结果菜单可以直接放大,命令面板可以搜索教程章节,更多失败会说明原因。", + "changes": [ + "图片和视频交替使用时更少重复载入:只是电脑内存紧张时,已在显卡上的模型不再被一并清出;图片用完后,视频模型会重新回到显卡;两者放不下时,保留最近使用的一个。", + "开始生成更快接手显卡:点击生成时,后台的编译和文本编码器准备会在几秒内停下并让出显卡,不再等它们做完。", + "8 GB 显卡第二遍更少等待:显存较小时,第二遍不再等待处理器拼接中间结果,画面与之前完全一致。", + "结果菜单可以放大:生成结果的“⋯”菜单中可直接选择“放大到 宽 × 高”,与作品库右键菜单一致。", + "命令面板可以搜索教程:在命令面板中输入文字时,匹配的教程章节会列在相关操作之后,选择即可打开该章;中文、英文章节名和常用说法都可搜索。", + "启动器路径提示:文件夹路径只在显示不全时才出现完整路径提示。", + "更多失败会说明原因:提示词模型和配音因磁盘空间不足失败时会说明;引擎已写明原因的失败不再显示为原因不明的进程退出,并给出对应的处理建议;在 Mac 上同时使用参考素材和首尾帧时,会说明需要保留其中一种,以及下一步怎么做。", + "LoRA 检查更准确:以其他方式保存的步数蒸馏加速 LoRA 也能被识别为加速 LoRA;语言模型的 LoRA 会被如实指出。", + "剪辑视图细节:标题栏不再被时间线拖动层遮住;手机宽度下工具条完整放在一行;关闭剪辑视图后,“找不到上次的剪辑”提示随之清除;界面变慢的提示会保留在通知列表中,直到手动关闭。", + "反推提示词:只取到一帧的视频片段也能正常反推。" + ] + } + }, { "product_version": "0.6.7", "en": { diff --git a/freevideo_engine/subtitle_pack.json b/freevideo_engine/subtitle_pack.json index 62c23c10..83ff746c 100644 --- a/freevideo_engine/subtitle_pack.json +++ b/freevideo_engine/subtitle_pack.json @@ -2,7 +2,7 @@ "format": 1, "repo": "OpenVDN/vdn-minimax-h3-edge", "prefix": "subtitles-v1", - "revision": "94f5ccc7bb78917e1eed47de4fc04a61465b8673", + "revision": "2283779e4cd6bd4724f200c152977fce58216da3", "python": "cp312", "groups": { "speech": [ @@ -97,11 +97,16 @@ "file": "runtime/windows-x64/sherpa_onnx-1.13.8-cp312-cp312-win_amd64.whl", "bytes": 7807118, "sha256": "36b86ccb86c699c1ba3550e475a0a840e0c60cb9cd3553568b785081a04f10f3" + }, + "windows-arm64": { + "file": "runtime/windows-arm64/sherpa_onnx-1.13.8-cp312-cp312-win_arm64.whl", + "bytes": 2249666, + "sha256": "1613f14db38b6936098c660f610baee95541378edbdec39a973a591d8df58f5b" } }, "origin": { "speech": "csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-small (NVIDIA NeMo stt_en_conformer_ctc_small, CC-BY-4.0); snakers4/silero-vad v5.0 (MIT)", "language": "csukuangfj/sherpa-onnx-whisper-tiny (OpenAI Whisper tiny, MIT); csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17 (SenseVoiceSmall by FunASR/FunAudioLLM, FunASR Model Open Source License Agreement v1.1)", - "runtime": "k2-fsa/sherpa-onnx 1.13.8 built by FreeVideo without text-to-speech (source 11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf)" + "runtime": "k2-fsa/sherpa-onnx 1.13.8 built by FreeVideo without text-to-speech (source 11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf); windows-arm64: the unmodified win_arm64 wheel of sherpa-onnx 1.13.8 published by k2-fsa on PyPI (Apache-2.0, LICENSE inside the wheel)" } } diff --git a/freevideo_engine/subtitle_pack.py b/freevideo_engine/subtitle_pack.py index 835b00a4..a618ce80 100644 --- a/freevideo_engine/subtitle_pack.py +++ b/freevideo_engine/subtitle_pack.py @@ -41,7 +41,7 @@ def catalog(): def platform_key(): machine = platform.machine().lower() if sys.platform == 'win32': - return 'windows-x64' if machine in ('amd64', 'x86_64') else None + return 'windows-x64' if machine in ('amd64', 'x86_64') else 'windows-arm64' if machine in ('arm64', 'aarch64') else None if sys.platform == 'darwin': return 'macos-arm64' if machine in ('arm64', 'aarch64') else 'macos-x86_64' if machine == 'x86_64' else None if sys.platform.startswith('linux'): diff --git a/freevideo_engine/torch_download.py b/freevideo_engine/torch_download.py index ff979318..bc7894fa 100644 --- a/freevideo_engine/torch_download.py +++ b/freevideo_engine/torch_download.py @@ -1,6 +1,7 @@ """Verified, resumable Windows GPU wheels before the package installation step.""" import importlib.metadata import json +import os from pathlib import Path from . import network @@ -10,6 +11,11 @@ @plain_errors def catalog(): + from .environments import windows_arm64 + if windows_arm64('Windows' if os.name == 'nt' else None): + # Native Windows on Arm: NVIDIA's win_arm64 CUDA 13.4 builds, downloaded from NVIDIA's own index. + from . import windows_arm64 as arm + return arm.load()['torch'] return json.loads(io_path(Path(__file__).with_name('torch_downloads.json')).read_text(encoding='utf-8'))['windows_cp312'] @@ -39,6 +45,9 @@ def fetch(row, root, family, networking, env, ui, check): if not networking.get('sources', {}).get(family) and networking.get('mode') != 'official': names = list(row['sources']) candidates = [(name, row['sources'][name]) for name in names if name in row['sources']] + if not candidates and list(row['sources']) == ['nvidia']: + # Windows on Arm rows are served only by NVIDIA's index, which no measured source names. + candidates = list(row['sources'].items()) key = 'download-' + row['filename'] name = 'Runtime components' source = '' @@ -47,7 +56,7 @@ def fetch(row, root, family, networking, env, ui, check): def feedback(event): nonlocal source - source = {'official': 'PyTorch', 'nju': 'Nanjing University mirror'}.get(event.get('source'), '') + source = {'official': 'PyTorch', 'nju': 'Nanjing University mirror', 'nvidia': 'NVIDIA'}.get(event.get('source'), '') if event['action'] == 'retry': # A patient round is about to start: the same notice the Python and package retries show. ui.update(key, activity='resume', name=name, detail=network.PATIENT_DOWNLOAD_NOTICE) diff --git a/freevideo_engine/uv_bootstrap.py b/freevideo_engine/uv_bootstrap.py index 6fc7c320..728fe5e7 100644 --- a/freevideo_engine/uv_bootstrap.py +++ b/freevideo_engine/uv_bootstrap.py @@ -11,6 +11,13 @@ def wheel_spec(uv): + if 'aarch64-pc-windows-msvc' in uv.get('url', ''): + # Native Windows on Arm: the win_arm64 wheel row of its own table. + from . import windows_arm64 + wheel = windows_arm64.load()['uv'] + if wheel['version'] != uv['version'] or wheel['legacy_sha256'] != uv['sha256']: + raise ValueError('The Windows on Arm uv row does not match the pinned bootstrap version') + return wheel catalog = json.loads(Path(__file__).with_name('uv_downloads.json').read_text(encoding='utf-8')) if catalog['version'] != uv['version'] or catalog['windows']['legacy_sha256'] != uv['sha256']: raise ValueError('The uv download catalog does not match the pinned bootstrap version') diff --git a/freevideo_engine/windows_arm64.json b/freevideo_engine/windows_arm64.json new file mode 100644 index 00000000..1988c43c --- /dev/null +++ b/freevideo_engine/windows_arm64.json @@ -0,0 +1,74 @@ +{ + "schema_version": 1, + "platform": "win_arm64", + "python_tag": "cp312", + "runtime_wheel_bytes": 2077916688, + "python": { + "version": "3.12.16", + "release": "20261110", + "filename": "cpython-3.12.16+20261110-aarch64-pc-windows-msvc-install_only.tar.gz", + "url": "https://github.com/astral-sh/python-build-standalone/releases/download/20261110/cpython-3.12.16%2B20261110-aarch64-pc-windows-msvc-install_only.tar.gz", + "sha256": "7122bf62a0cf601527ba62e19ca715d64db86b269765da23937e9ac7f968f39c", + "bytes": 44719716, + "root": "python", + "executable": "python/python.exe" + }, + "uv": { + "version": "0.9.0", + "filename": "uv-0.9.0-py3-none-win_arm64.whl", + "bytes": 19853856, + "sha256": "4a77a33c86d478fd1fb27db29035044261f086e7287325bcbe695c9b31808f4c", + "executable": "uv-0.9.0.data/scripts/uv.exe", + "executable_bytes": 48860672, + "sources": { + "official": "https://files.pythonhosted.org/packages/1a/7e/d9b4df434081e883eefb0e975e4dd40de210596c28cf8a88ec5783ae593b/uv-0.9.0-py3-none-win_arm64.whl", + "tuna": "https://pypi.tuna.tsinghua.edu.cn/packages/1a/7e/d9b4df434081e883eefb0e975e4dd40de210596c28cf8a88ec5783ae593b/uv-0.9.0-py3-none-win_arm64.whl" + }, + "legacy_url": "https://github.com/astral-sh/uv/releases/download/0.9.0/uv-aarch64-pc-windows-msvc.zip", + "legacy_bytes": 19394974, + "legacy_sha256": "a816625eae0117c8ca0cd618716ddc11c68522d1ecfa7d2738f1c670099fef10", + "legacy_executable": "uv.exe" + }, + "git": { + "version": "2.55.0.5", + "url": "https://github.com/git-for-windows/git/releases/download/v2.55.0.windows.5/MinGit-2.55.0.5-arm64.zip", + "sha256": "05843f9d6e60306c3ab886799e2c67200caab921571f10512df3493049179ddb", + "bytes": 37650057, + "executable": "cmd/git.exe" + }, + "torch": [ + { + "cuda": "cu134", + "package": "torch", + "version": "2.14.0+cu134", + "filename": "torch-2.14.0+cu134-cp312-cp312-win_arm64.whl", + "sha256": "075d59d2d415c93845faae3f10705707f883edaf6cfb9c60a589414b5bf8b82d", + "bytes": 1851098665, + "sources": { + "nvidia": "https://pypi.nvidia.com/nvtorch_oot/torch/torch-2.14.0%2Bcu134-cp312-cp312-win_arm64.whl" + } + }, + { + "cuda": "cu134", + "package": "torchvision", + "version": "0.29.0+cu134", + "filename": "torchvision-0.29.0+cu134-cp312-cp312-win_arm64.whl", + "sha256": "e54986da6fb6f4dd72a17894539df7dad578a8f9979100b823cc79717da23fbb", + "bytes": 6490734, + "sources": { + "nvidia": "https://pypi.nvidia.com/nvtorch_oot/torchvision/torchvision-0.29.0%2Bcu134-cp312-cp312-win_arm64.whl" + } + }, + { + "cuda": "cu134", + "package": "torchaudio", + "version": "2.11.1+cu134", + "filename": "torchaudio-2.11.1+cu134-py3-none-win_arm64.whl", + "sha256": "665fefb8dbb8d37e3141918d5c8dade4e1b7802abac19cea35342115a375be68", + "bytes": 1787661, + "sources": { + "nvidia": "https://pypi.nvidia.com/nvtorch_oot/torchaudio/torchaudio-2.11.1%2Bcu134-py3-none-win_arm64.whl" + } + } + ] +} diff --git a/freevideo_engine/windows_arm64.py b/freevideo_engine/windows_arm64.py new file mode 100644 index 00000000..8ee42792 --- /dev/null +++ b/freevideo_engine/windows_arm64.py @@ -0,0 +1,84 @@ +"""The pinned download table for the native Windows on Arm (win_arm64) install. + +Everything the install fetches for that platform is in windows_arm64.json, kept apart from the x64 tables +(bootstrap_versions.json, uv_downloads.json, torch_downloads.json, distribution/windows-runtime-wheels.json): those files +are not touched, so a Windows x64 install, its package fingerprints and its downloads stay exactly as they were. +Each row carries a sha256 and a byte count; a file is used only when both match. +""" +import json +from pathlib import Path +import re +from urllib.parse import unquote, urlsplit + +TABLE = Path(__file__).with_name('windows_arm64.json') +HASH = re.compile(r'[0-9a-f]{64}') +# Where a pinned file may come from; the installer's mirrors keep these paths. +HOSTS = ('github.com', 'files.pythonhosted.org', 'pypi.tuna.tsinghua.edu.cn', 'download.pytorch.org', 'pypi.nvidia.com') + + +def _file(row, name, *, executable=None): + if not isinstance(row.get('bytes'), int) or row['bytes'] <= 0: + raise ValueError(name + ': missing byte count') + if not HASH.fullmatch(str(row.get('sha256', ''))): + raise ValueError(name + ': sha256 must be 64 lowercase hex digits') + return row + + +def _address(url, filename, name): + parts = urlsplit(url) + if (parts.scheme != 'https' or parts.hostname not in HOSTS or parts.username is not None + or parts.query or parts.fragment): + raise ValueError(name + ': address is not an allowed https source') + if filename is not None and unquote(parts.path.rsplit('/', 1)[-1]) != filename: + raise ValueError(name + ': address does not name the file') + return parts + + +def validate(table): + """Raise ValueError unless every row is complete, ARM64-named and from an allowed source.""" + if table.get('schema_version') != 1 or table.get('platform') != 'win_arm64' or table.get('python_tag') != 'cp312': + raise ValueError('windows_arm64.json: wrong schema, platform or Python tag') + python = _file(table['python'], 'python') + if 'aarch64-pc-windows-msvc' not in python['filename'] or not python['filename'].endswith('-install_only.tar.gz'): + raise ValueError('python: not the aarch64 Windows install_only build') + if '+' + python['release'] + '-' not in python['filename'] or '-' + python['version'] + '+' not in python['filename']: + raise ValueError('python: version or release does not match the file') + _address(python['url'], python['filename'], 'python') + uv = _file(table['uv'], 'uv') + if not uv['filename'].endswith('-win_arm64.whl') or '-' + uv['version'] + '-' not in uv['filename']: + raise ValueError('uv: not the win_arm64 wheel of the pinned version') + if not uv.get('sources') or not isinstance(uv.get('executable_bytes'), int): + raise ValueError('uv: sources and the executable size are required') + for source, url in uv['sources'].items(): + _address(url, uv['filename'], 'uv ' + source) + _file(dict(bytes=uv['legacy_bytes'], sha256=uv['legacy_sha256']), 'uv archive') + if 'aarch64-pc-windows-msvc' not in uv['legacy_url']: + raise ValueError('uv archive: not the aarch64 build') + _address(uv['legacy_url'], None, 'uv archive') + git = _file(table['git'], 'git') + if not git['url'].endswith('-arm64.zip') or git['version'] not in git['url']: + raise ValueError('git: not the arm64 MinGit of the pinned version') + _address(git['url'], None, 'git') + for row in table.get('torch', []): + _file(row, row.get('filename', 'torch row')) + # torch and torchvision are cp312 builds; torchaudio 2.11.1 is one py3-none win_arm64 file for every Python. + if not row['filename'].endswith(('-cp312-cp312-win_arm64.whl', '-py3-none-win_arm64.whl')): + raise ValueError(row['filename'] + ': not a cp312 or py3-none win_arm64 wheel') + for source, url in row['sources'].items(): + _address(url, row['filename'], row['filename'] + ' ' + source) + return table + + +def load(): + return validate(json.loads(TABLE.read_text(encoding='utf-8'))) + + +def first_install_notice(): + """Shown while the x64 environment of an earlier version is replaced (wording: Lane).""" + from .launcher_copy import size_text + text = 'This is the first installation of the native runtime for this computer, so the runtime components are downloaded again' + try: + size = load().get('runtime_wheel_bytes') + except (OSError, ValueError, KeyError): + size = None + return text + (' (about %s).' % size_text(size) if size else '.') diff --git a/scripts/publish_release.py b/scripts/publish_release.py index 00755754..f805f38c 100644 --- a/scripts/publish_release.py +++ b/scripts/publish_release.py @@ -21,13 +21,18 @@ ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT)) from freevideo_engine.launcher_update import (CHANNEL, LINUX_CHANNEL, MAC_CHANNEL, MAX_MANIFEST_BYTES, # noqa: E402 - NIGHTLY_TAG, RELEASE_ASSETS, asset_url, build_identity, build_track, + NIGHTLY_TAG, WINDOWS_ARM64_CHANNEL, RELEASE_ASSETS, asset_url, build_identity, build_track, manifest) from freevideo_engine.release_notes import notes, version_key # noqa: E402 PLATFORMS = (CHANNEL, MAC_CHANNEL, LINUX_CHANNEL) LEGACY_PLATFORMS = (CHANNEL, MAC_CHANNEL) -NAMES = {CHANNEL: 'Windows', MAC_CHANNEL: 'Mac', LINUX_CHANNEL: 'Linux'} +NAMES = {CHANNEL: 'Windows', MAC_CHANNEL: 'Mac', LINUX_CHANNEL: 'Linux', WINDOWS_ARM64_CHANNEL: 'Windows ARM64'} + + +def platforms(builds): + """The platforms of this release: the three always, Windows ARM64 only when its build succeeded.""" + return PLATFORMS + ((WINDOWS_ARM64_CHANNEL,) if WINDOWS_ARM64_CHANNEL in builds else ()) PAGE = 'https://github.com/FlashML-org/FreeVideo' LOGO = '''