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 = '''
@@ -70,9 +75,12 @@ def digest(path): return value.hexdigest() -def load_builds(windows, macos, linux): +def load_builds(windows, macos, linux, windows_arm64=None): builds = {} - for channel, folder in ((CHANNEL, Path(windows)), (MAC_CHANNEL, Path(macos)), (LINUX_CHANNEL, Path(linux))): + folders = [(CHANNEL, Path(windows)), (MAC_CHANNEL, Path(macos)), (LINUX_CHANNEL, Path(linux))] + if windows_arm64: + folders.append((WINDOWS_ARM64_CHANNEL, Path(windows_arm64))) + for channel, folder in folders: raw = json.loads((folder / 'launcher-build.json').read_text(encoding='utf-8')) identity = build_identity(raw) if identity['channel'] != channel: @@ -105,16 +113,20 @@ def whats_new(raw): return rows -def downloads(base): - return ['| | |', '|---|---|', +def downloads(base, builds=None): + rows = ['| | |', '|---|---|', '| **Windows** 10/11 · NVIDIA GPU | [FreeVideo.exe](%sFreeVideo.exe) |' % base, '| **macOS** 14+ · Apple silicon | [FreeVideo-Mac-arm64.dmg](%sFreeVideo-Mac-arm64.dmg) |' % base, - '| **Linux** x86_64 · NVIDIA GPU | [FreeVideo-Linux-x86_64.AppImage](%sFreeVideo-Linux-x86_64.AppImage) |' % base, ''] + '| **Linux** x86_64 · NVIDIA GPU | [FreeVideo-Linux-x86_64.AppImage](%sFreeVideo-Linux-x86_64.AppImage) |' % base] + if builds and WINDOWS_ARM64_CHANNEL in builds: + name = RELEASE_ASSETS[WINDOWS_ARM64_CHANNEL][0] + rows.append('| **Windows** ARM64 · NVIDIA GPU (experimental) | [%s](%s%s) |' % (name, base, name)) + return rows + [''] def checksums(builds): return ['
sha256', '', '```', - *('%s %s' % (builds[c]['sha256'], builds[c]['path'].name) for c in PLATFORMS), '```', '
', ''] + *('%s %s' % (builds[c]['sha256'], builds[c]['path'].name) for c in platforms(builds)), '```', '', ''] # The same offline packages, mirrored to ModelScope for downloads from China (anonymous folder page). @@ -123,7 +135,7 @@ def checksums(builds): def stable_body(builds, tag): # Visitors come to download: the files come first, then what changed. - rows = [LOGO, '## Download / 下载', ''] + downloads(PAGE + '/releases/download/' + tag + '/') + rows = [LOGO, '## Download / 下载', ''] + downloads(PAGE + '/releases/download/' + tag + '/', builds) rows += ['**Windows:** run FreeVideo.exe, choose an existing ComfyUI folder or install a new one, then click ' '**Install & launch**. Offline packages are on [Quark](https://pan.quark.cn/s/c51235b84618) and [ModelScope](%s).' % OFFLINE_MODELSCOPE, '', @@ -150,14 +162,14 @@ def stable_body(builds, tag): def nightly_body(builds, sha): built = time.strftime('%Y-%m-%d %H:%M', time.gmtime(max(b['identity']['built_at'] for b in builds.values()))) - size = {c: '%.1f MB' % (builds[c]['path'].stat().st_size / 1e6) for c in PLATFORMS} + size = {c: '%.1f MB' % (builds[c]['path'].stat().st_size / 1e6) for c in platforms(builds)} rows = ['## FreeVideo nightly (rolling)', '', 'Automated build of `main`, refreshed after every merge. For everyday use, download the ' '[latest release](%s/releases/latest).' % PAGE, '', '基于 `main` 的自动构建,每次合并后更新。日常使用请下载[最新正式版](%s/releases/latest)。' % PAGE, ''] - rows += downloads(PAGE + '/releases/download/' + NIGHTLY_TAG + '/') + rows += downloads(PAGE + '/releases/download/' + NIGHTLY_TAG + '/', builds) rows += ['| commit | built (UTC) | version | Windows | macOS | Linux |', '|---|---|---|---|---|---|', '| [`%s`](%s/commit/%s) | %s | %s | %s | %s | %s |' % (sha[:9], PAGE, sha, built, escape('v' + builds[CHANNEL]['identity']['product_version']), @@ -253,13 +265,13 @@ def publish_stable(releases, builds, sha, folder): if releases.tag_exists(tag) or releases.find(tag) is not None: raise SystemExit('::error::%s is already released. Bump product_version and the notes in ' 'freevideo_engine/release_notes.json, merge, then publish again.' % tag) - sums = write(folder, 'SHA256SUMS.txt', ''.join('%s %s\n' % (builds[c]['sha256'], builds[c]['path'].name) for c in PLATFORMS)) + sums = write(folder, 'SHA256SUMS.txt', ''.join('%s %s\n' % (builds[c]['sha256'], builds[c]['path'].name) for c in platforms(builds))) body = write(folder, 'release-body.md', stable_body(builds, tag)) title = 'FreeVideo ' + tag releases.point_tag(tag, sha) gh('Create draft %s' % tag, 'release', 'create', tag, '--verify-tag', '--draft', '--title', title, '--notes-file', body) - gh('Upload launchers to %s' % tag, 'release', 'upload', tag, *(str(builds[c]['path']) for c in PLATFORMS), sums, '--clobber') - bind_metadata(releases, tag, builds, PLATFORMS, folder, {c: RELEASE_ASSETS[c][1] for c in PLATFORMS}) + gh('Upload launchers to %s' % tag, 'release', 'upload', tag, *(str(builds[c]['path']) for c in platforms(builds)), sums, '--clobber') + bind_metadata(releases, tag, builds, platforms(builds), folder, {c: RELEASE_ASSETS[c][1] for c in platforms(builds)}) gh('Publish %s' % tag, 'release', 'edit', tag, '--draft=false', '--prerelease=false', '--latest', '--title', title, '--notes-file', body) # Launchers from before combined releases read the platform tags; keep them current. @@ -308,15 +320,15 @@ def publish_nightly(releases, builds, sha, folder): if superseded(releases, sha): print('main moved on; the newer build publishes the nightly') return - sums = write(folder, 'SHA256SUMS.txt', ''.join('%s %s\n' % (builds[c]['sha256'], builds[c]['path'].name) for c in PLATFORMS)) + sums = write(folder, 'SHA256SUMS.txt', ''.join('%s %s\n' % (builds[c]['sha256'], builds[c]['path'].name) for c in platforms(builds))) body = write(folder, 'release-body.md', nightly_body(builds, sha)) releases.point_tag(NIGHTLY_TAG, sha) if releases.find(NIGHTLY_TAG) is None: gh('Create nightly', 'release', 'create', NIGHTLY_TAG, '--verify-tag', '--draft', '--prerelease', '--latest=false', '--title', 'Nightly (rolling)', '--notes-file', body) - gh('Upload nightly launchers', 'release', 'upload', NIGHTLY_TAG, *(str(builds[c]['path']) for c in PLATFORMS), sums, '--clobber') - bind_metadata(releases, NIGHTLY_TAG, builds, PLATFORMS, folder, {c: RELEASE_ASSETS[c][1] for c in PLATFORMS}) - keep = {builds[c]['path'].name for c in PLATFORMS} | {RELEASE_ASSETS[c][1] for c in PLATFORMS} | {'SHA256SUMS.txt'} + gh('Upload nightly launchers', 'release', 'upload', NIGHTLY_TAG, *(str(builds[c]['path']) for c in platforms(builds)), sums, '--clobber') + bind_metadata(releases, NIGHTLY_TAG, builds, platforms(builds), folder, {c: RELEASE_ASSETS[c][1] for c in platforms(builds)}) + keep = {builds[c]['path'].name for c in platforms(builds)} | {RELEASE_ASSETS[c][1] for c in platforms(builds)} | {'SHA256SUMS.txt'} for name in sorted(set(releases.assets(NIGHTLY_TAG)) - keep): gh('Remove stale %s' % name, 'release', 'delete-asset', NIGHTLY_TAG, name, '--yes') gh('Publish nightly', 'release', 'edit', NIGHTLY_TAG, '--draft=false', '--prerelease', '--latest=false', @@ -330,10 +342,11 @@ def main(): parser.add_argument('--windows', type=Path, required=True) parser.add_argument('--macos', type=Path, required=True) parser.add_argument('--linux', type=Path, required=True) + parser.add_argument('--windows-arm64', type=Path, help='the ARM64 build folder; leave out when that build failed') parser.add_argument('--sha', required=True) parser.add_argument('--repository', default=os.environ.get('GH_REPO', 'FlashML-org/FreeVideo')) args = parser.parse_args() - builds = load_builds(args.windows, args.macos, args.linux) + builds = load_builds(args.windows, args.macos, args.linux, args.windows_arm64) if build_track(builds[CHANNEL]['identity']) != args.track: raise SystemExit('The builds are %s builds, not %s' % (build_track(builds[CHANNEL]['identity']), args.track)) releases = Releases(args.repository) diff --git a/web/browser_extension.js b/web/browser_extension.js index 7d403746..f9be9959 100644 --- a/web/browser_extension.js +++ b/web/browser_extension.js @@ -54,12 +54,16 @@ export function isRequestTimeout(error) { const text = typeof error === 'string' ? error : string(error?.message) || string(error?.exception_message); return type === 'TimeoutError' || /^TimeoutError:\s*/i.test(text); } -export function requestTimeoutText(t) { - return t('The task may already have been accepted.', '任务可能已被接收。'); +// `stage` is the report's: 'queue' is a cancel, a reorder, a resume or redo from the list of parts, or a read of the queue. +export function requestTimeoutText(t, stage) { + return stage === 'queue' ? t('The queue may have changed.', '队列状态可能已变化。') + : t('The task may already have been accepted.', '任务可能已被接收。'); } -// What to do next: the engine may already hold the request, so resubmitting blindly would queue it twice. -export function requestTimeoutAction(t) { - return t('Check the queue, and submit again only if the task is not there.', '请先查看队列,任务不在队列中时再重新提交。'); +// What to do next: the engine may already hold a submitted task, so resubmitting blindly would queue it twice. In the +// queue stage nothing says "submit again": a task that is gone from the queue can be the cancel that worked. +export function requestTimeoutAction(t, stage) { + return stage === 'queue' ? t('Check the queue\'s current state in a moment, then decide whether to act again.', '请稍后查看队列中的实际状态,再决定是否需要重新操作。') + : t('Check the queue, and submit again only if the task is not there.', '请先查看队列,任务不在队列中时再重新提交。'); } // One sentence for a dropped connection (engine closed, network lost); the raw // browser wording stays in the technical details. @@ -71,6 +75,13 @@ export function engineNotRunning(connection) { return connection?.engine_answers_after === false && connection.probe_timed_out !== true && connection.page_address === 'this-computer'; } export function engineNotRunningText(t) { return t('Start it again from the FreeVideo launcher.', '请从 FreeVideo 启动器重新启动。'); } +// The read right after a lost connection was not refused but not answered either, on the computer the page runs +// on, within PROBE_TIMEOUT_MS: that is all the page knows. That FreeVideo is still running and busy is inferred, not +// measured. The notice goes away by itself when it answers again (the page keeps reading the queue). +export function engineNotResponding(connection) { + return connection?.engine_answers_after === false && connection.probe_timed_out === true && connection.page_address === 'this-computer'; +} +export function engineNotRespondingText(t) { return t('It may still be working.', '可能仍在处理中。'); } // A read the engine did not answer: the status was a success but the body is a web page (a page shown while the // engine restarts, or one put in front of it by a proxy or tunnel), not JSON. It is raised as the same kind of // error as a lost connection, so retries, the delay between polls and the notice that clears itself apply @@ -100,7 +111,10 @@ export function pageAddressKind(location = globalThis.location) { // What a failed request can say about itself, read right after it failed: whether the browser is // online, whether the engine answers a small read now, and what kind of address the page came from. // One failed read tells an engine that has stopped from a request that alone was cut off. -export async function connectionFacts(api, {timeout = 2000, now = Date.now} = {}) { +// The wait is longer than the two seconds Windows can take to refuse a connection to a port nothing listens on, so a +// refusal (the engine has stopped) is never mistaken for a read nobody answered. +export const PROBE_TIMEOUT_MS = 5000; +export async function connectionFacts(api, {timeout = PROBE_TIMEOUT_MS, now = Date.now} = {}) { const facts = {online: globalThis.navigator?.onLine ?? null, page_hidden: globalThis.document?.hidden ?? null, page_address: pageAddressKind(), secure_page: globalThis.location?.protocol === 'https:'}; const started = now(); diff --git a/web/editor.css b/web/editor.css index 738cfb2a..b2c06cc4 100644 --- a/web/editor.css +++ b/web/editor.css @@ -610,6 +610,7 @@ the key's column to the strip under the text, next to the key, and the text shows two lines while it is not being typed in, so the console is no taller than before. */ @media(max-width:1365px){ + .fv-editor:lang(zh) .fv-ed-genbar-borrowed{--fv-ed-cancel-top:25px;--fv-ed-cancel-bottom:auto} .fv-editor:lang(zh) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console .fvs-chips{grid-column:1/-1} .fv-editor:lang(zh) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console>.fv-runbar{grid-row:1/span 2} .fv-editor:lang(zh) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console-prompt{display:flex;flex-direction:column} @@ -620,6 +621,7 @@ .fv-editor:lang(zh) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console .fv-prompt-editor textarea:not(:focus){max-height:48px} } @media(max-width:1439px){ + .fv-editor:lang(en) .fv-ed-genbar-borrowed{--fv-ed-cancel-top:25px;--fv-ed-cancel-bottom:auto} .fv-editor:lang(en) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console .fvs-chips{grid-column:1/-1} .fv-editor:lang(en) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console>.fv-runbar{grid-row:1/span 2} .fv-editor:lang(en) .fv-ed-genbar-borrowed .fv-studio.fv-create .fvs-console-prompt{display:flex;flex-direction:column} @@ -636,4 +638,6 @@ .fv-ed-genbar-borrowed>.fv-borrowed{flex:1 1 100%;min-width:0;position:static;display:block;width:auto;height:auto;max-height:none;padding:0;border:0;background:none;box-shadow:none;transform:none;inset:auto} .fv-ed-genbar-borrowed>.fv-borrowed>.fv-body{display:block;position:static;width:auto;height:auto;padding:0} .fv-editor[data-bar-borrowed=true] .fv-ed-genbar-borrowed>.fv-borrowed .fv-controls{position:static;justify-self:stretch;width:auto;max-width:none} +/* While a part is generating, the editor's Cancel (never its Continue, named by its tip) stands on the lent bar's greyed Generate key. On a row of its own under the bar it lay beneath the timeline toolbar, out of the mouse's reach. */ +@media(min-width:681px){.fv-ed-genbar-borrowed[data-mode=running][data-voice=false]>button:is([data-fv-tip-name="取消"],[data-fv-tip-name=Cancel]):not([hidden]){position:absolute;z-index:2;right:17px;top:var(--fv-ed-cancel-top,auto);bottom:var(--fv-ed-cancel-bottom,39px);width:140px;height:80px;background:var(--fv-ctl-solid,var(--fv-card));border:1px solid var(--fv-line2,var(--fv-border))}} [data-fv-locked]{opacity:.5} diff --git a/web/editor.js b/web/editor.js index 945c5aee..1a6f7795 100644 --- a/web/editor.js +++ b/web/editor.js @@ -376,6 +376,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given settled(); return true; } + let offering = false; let capability = {maxSeconds: 15, maxFollowSeconds: 15, maxRequestFrames: null, estimate: () => null}, generationBusy = false, switching = false, generationDone = null, finishGeneration = null; let stopExport = null, mostRecentJob = null, exportPreparing = false, guide = null; const jobWatchers = new Map(), progress = new Map(), jobStatuses = new Map(), runProgress = new Map(), startPlayheads = new Map(), soundJobs = new Set(), shownJobs = new Set(); @@ -562,7 +563,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given saveAgain.disabled = true; saveState.dataset.state = ''; updateSaveState(); try { releaseStamp(); await queue.flush(); } finally { if (!disposed) { saveAgain.disabled = false; updateSaveState(); } } } - const player = createEditorPlayer(preview, transport, {state, sources: store.sources, api, t, error, readAudioSamples: panel.readAudioSamples || readSpeedAudioSamples, preservePreview: () => initializing, prepareAudio: () => !initializing, speech: createSpeechSpans(store.speech)}); + const player = createEditorPlayer(preview, transport, {state, sources: store.sources, api, t, error, readAudioSamples: panel.readAudioSamples || readSpeedAudioSamples, preservePreview: () => initializing || offering, prepareAudio: () => !initializing, speech: createSpeechSpans(store.speech)}); // Until the first video frame arrives the picture shows the part's thumbnail at its own size, then fades to the video. const poster = createPicturePoster(player.element, {state, sources: store.sources, sourceKey, mediaURL: value => mediaURL(api, value)}); function selectionClips(selection = state.selection) { @@ -733,7 +734,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given // Music on the second sound track goes through the same bar; the bar shows a chosen piece's own job. const music = createEditorMusic({state, store, t, completeSources, onStatus: () => genbar?.update(barValue)}); // Dubbing lines of a stretch of speech. - let voiceReady = false, voiceInstallable = false, exportFps = false; + let voiceReady = false, voiceInstallable = false, voiceLater = false, exportFps = false; const generatedSource = value => { const match = /^generated:(.+)$/.exec(String(value || '')); return match ? {kind: 'generated', id: match[1]} : null; }; // Playing one line: the playhead goes to its start and the picture plays up to its end, then stops. let lineStop = null; @@ -970,7 +971,9 @@ export function openEditor({api, app, from = null, panel = {}, components: given if ([...tracksOf].some(track => track.clips.some(clip => !pair.includes(clip) && clip.start >= edge))) return; const picked = state.selection; if (picked && !(picked.kind === 'clip' && picked.ids.some(id => ids.has(id) || model.find(state.record, id)?.link && ids.has(model.find(state.record, id).link)))) return; - enterClip(clip => clip.id === last.id, projectEpoch, {select: false}); + // The part added at the end is the page's doing, not the viewer's: a creation's preview being watched stays open. + offering = true; + try { enterClip(clip => clip.id === last.id, projectEpoch, {select: false}); } finally { offering = false; } } function watchJob(id) { if (disposed) return; @@ -1259,8 +1262,10 @@ export function openEditor({api, app, from = null, panel = {}, components: given } }, // Stopping a run asks first (the floating window's own question); without that module the press stops at once. + // Dubbing stops by parts (lines already dubbed stay), so it has its own question; the order is cancel's own. async confirmStop(anchor) { - try { return await (await import('./task_float.js')).confirmStop(anchor, {kind: 'video'}); } catch { return true; } + const dubbing = !music.target() && !narration.target() && !stems?.active() && voice.session()?.phase === 'dubbing'; + try { return await (await import('./task_float.js')).confirmStop(anchor, {kind: dubbing ? 'voice' : 'video'}); } catch { return true; } }, undo: () => travel(true), reasonText: value => editorErrorText(value, t), @@ -1786,11 +1791,11 @@ export function openEditor({api, app, from = null, panel = {}, components: given const found = await voiceFeatures(api); // An unanswered question changes nothing: the lines stay as they were, and a failed recognition says so. if (found.unknown) return voiceReady; - voiceReady = found.ready; voiceInstallable = found.install; exportFps = found.exportFps; + voiceReady = found.ready; voiceInstallable = found.install; voiceLater = !!found.later; exportFps = found.exportFps; if (!disposed) { voice.refresh(); narration.refresh(); if (found.install) voiceInstall.init(); genbar?.update(barValue); } return found.ready; } - const voiceInstall = createVoiceInstall({api, available: () => voiceInstallable && !voiceReady, target: selection => !!state.record && !!voiceTarget(state.record, selection), + const voiceInstall = createVoiceInstall({api, available: () => voiceInstallable && !voiceReady, later: () => voiceLater && !voiceReady, target: selection => !!state.record && !!voiceTarget(state.record, selection), onChange: () => { if (!disposed) genbar?.update(barValue); }, onReady: readVoice}); // A new line said in a voice of the edit, on an empty stretch of the recording track; heard from the clip's own sound. let sampleStop = null; @@ -2437,7 +2442,9 @@ export function openEditor({api, app, from = null, panel = {}, components: given if (trackContent && trackScroll && typeof ResizeObserver === 'function') { const fitTracks = () => { const around = tracksHost.getBoundingClientRect().height - trackScroll.clientHeight; // the ruler's inset and the scroll bar - if (around >= 0 && trackContent.offsetHeight) element.style.setProperty('--fv-ed-tracks-fit', `${Math.ceil(trackContent.offsetHeight + around)}px`); + // The rows' natural height (editor_tracks.js fitRows): sound lanes given up to fit are not taken as less room needed. + const rows = Number(trackContent.dataset.fit) || trackContent.offsetHeight; + if (around >= 0 && rows) element.style.setProperty('--fv-ed-tracks-fit', `${Math.ceil(rows + around)}px`); }; const watchTracks = new ResizeObserver(fitTracks); watchTracks.observe(trackContent); watchTracks.observe(tracksHost); listeners.push(() => watchTracks.disconnect()); fitTracks(); diff --git a/web/editor_genbar.js b/web/editor_genbar.js index 02810aa1..17f36b9c 100644 --- a/web/editor_genbar.js +++ b/web/editor_genbar.js @@ -299,7 +299,8 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { const narrated = !previewSelection && !musical && !!narration?.target(selection); const dub =!previewSelection && voice?.controller.target(selection) ? voice.controller.session(voice.controller.target(selection)) : null; const voiced = !!dub && dub.phase !== 'none' && dub.phase !== 'error'; - const installing = !previewSelection && !!voice?.install?.visible(selection); + // Where dubbing is not available the sentence stands beside the description and Generate; it takes nothing away. + const installing = !previewSelection && !!voice?.install?.visible(selection) && !voice.install.later?.(); const selected = !!selection && (!!previewSelection || musical || narrated || (actions.supportedSelection?.() ?? true)); // While a part generates, choosing another place offers Generate again; it is queued behind. // A press is being sent for the parts in `pressing`; only that same selection waits for it. diff --git a/web/editor_narration.js b/web/editor_narration.js index 3a34d0ec..abfd6ef8 100644 --- a/web/editor_narration.js +++ b/web/editor_narration.js @@ -203,7 +203,7 @@ export function createEditorNarration({state, store, t, sources = () => new Map( // Waits for the dubbing model when it is still to be downloaded; false when it cannot be had. async function modelReady() { if (ready()) return true; - if (!install?.offered?.()) return false; + if (!install?.offered?.() || install.later?.()) return false; install.start(); while (!disposed && !ready()) { if (['failed', 'unsupported'].includes(install.view?.phase) || install.view?.phase === 'idle' && !install.hasJob?.()) return ready(); @@ -261,7 +261,7 @@ export function createEditorNarration({state, store, t, sources = () => new Map( return found && pace ? pace * found.frames / FPS : null; }, // Bytes still to download before the first line, for the bar's "Downloads before generating" line. - downloadBytes: () => !ready() && install?.offered?.() ? install.view?.bytes || 0 : 0, + downloadBytes: () => !ready() && install?.offered?.() && !install.later?.() ? install.view?.bytes || 0 : 0, downloading: () => !ready() && install?.view?.phase === 'downloading' ? install.view : null, // Generate on an empty stretch, or again on a planned line there, in the voice shown. async press(text) { diff --git a/web/editor_tracks.css b/web/editor_tracks.css index 1b3b522c..9e2f6543 100644 --- a/web/editor_tracks.css +++ b/web/editor_tracks.css @@ -302,4 +302,8 @@ .fv-studio.fv-editor .fv-ed-track-view .fv-ed-track-heads>.fv-ed-add-audio[data-mode=remove]::before{margin:0} .fv-studio.fv-editor .fv-ed-track-view .fv-ed-track-heads:not([data-hx-a2hover])>.fv-ed-add-audio[data-mode=remove]:not([data-shown=true]):not(:hover){visibility:hidden} .fv-studio.fv-editor .fv-ed-track-view .fv-ed-track-heads[data-hx-a2hover]>.fv-ed-add-audio[data-mode=remove]{visibility:visible} +/* The remove key sits beside Audio 2's head, in the rows' coordinates: when the rows scroll it moves with the heads. */ +.fv-studio.fv-editor .fv-ed-track-view[data-vertical-overflow=true] .fv-ed-track-heads>.fv-ed-add-audio[data-mode=remove]{translate:0 var(--fv-ed-track-offset,0px)!important} @media(max-width:520px){.fv-studio.fv-editor .fv-ed-track-view .fv-ed-track-heads>.fv-ed-add-audio[data-mode=remove]{left:calc(100% - 32px)}} +/* A track below the timeline's foot: a fade says there is more until it is scrolled to (editor_tracks.js fitRows). */ +.fv-ed-track-view[data-track-below=true]::after{content:"";position:absolute;left:0;right:0;bottom:0;height:24px;pointer-events:none;z-index:7;background:linear-gradient(to bottom,transparent,var(--fv-ed-timeline,var(--fv-bg)))} diff --git a/web/editor_tracks.js b/web/editor_tracks.js index af3d9391..f43c39e4 100644 --- a/web/editor_tracks.js +++ b/web/editor_tracks.js @@ -500,11 +500,40 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = function syncVerticalScroll() { const top = scroll.scrollTop; element.dataset.verticalOverflow = String(scroll.scrollHeight > scroll.clientHeight); + const last = rowOrder.at(-1); + element.dataset.trackBelow = String(!!last && last.top + last.height > top + scroll.clientHeight + 1); element.style.setProperty('--fv-ed-track-offset', `${-top}px`); // Keep the handle beside the fixed ruler; the line still ends at the last row. playhead.style.top = `${18 + top}px`; playhead.style.height = `${Math.max(0, parseFloat(content.style.height) - 34 - 18 - top)}px`; } + // Rows taller than the timeline: the sound lanes give up height first, evenly, down to what a track head's switches + // need (28 px buttons); the picture row and text rows keep theirs. Past that the timeline scrolls, and a fade at its foot + // says a track is still below until it is scrolled to. Rows that fit keep their size. The timeline's own height is + // taken from the rows' natural height (editor.js), so a lane given up comes back when the window grows. + const soundMinimum = () => touchRows?.matches ? 46 : 30; + let rowOrder = []; + function fitRows() { + const natural = rowOrder.reduce((sum, row) => sum + row.natural + 6, 24) - 6, sound = rowOrder.filter(row => row.sound); + const over = natural - scroll.clientHeight, spare = Math.min(...sound.map(row => row.natural)) - soundMinimum(); + const cut = scroll.clientHeight && over > 0 && sound.length ? clamp(Math.ceil(over / sound.length), 0, Math.max(0, spare)) : 0; + let top = 24; + for (const row of rowOrder) { + const height = row.natural - (row.sound ? cut : 0); + if (row.top !== top || row.height !== height) { + row.top = top; row.height = height; + row.element.style.top = row.head.style.top = `${top}px`; + row.element.style.height = row.head.style.height = `${height}px`; + } + top += height + 6; + } + addAudio.style.top = `${top}px`; + // The key that removes Audio 2 stands in that head's icon, so it moves whenever the rows are fitted. + const second = rows.get('a2'); + if (second) addAudio.style.setProperty?.('--fv-ed-remove-top', `${second.top + second.height / 2 - 14}px`); + content.dataset.fit = String(natural + 34); + setTrackHeight(top - 6); + } function setTrackHeight(height) { // The heads' 6px gap and 28px audio button belong to the same scroll extent. content.style.height = `${height + 34}px`; @@ -512,6 +541,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = syncVerticalScroll(); } function layout() { + if (rowOrder.length) fitRows(); // Defer the initial 90-second view until a detached shell is mounted. if (!mountedStates.has(state) && scroll.clientWidth) { mountedStates.add(state); @@ -631,6 +661,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = const twoAudio = tracks.some(track => track.id === 'a2'); const STEM_NAMES = {dialogue: t('Dialogue', '人声'), music: t('Music', '音乐'), ambience: t('Ambience', '环境声')}; let top = 24, parted = false; + const order = []; for (const track of tracks) { const name = track.kind === 'text' ? t('Text', '文字') : track.kind === 'subtitle' ? t('Subtitles', '字幕') : track.kind === 'video' ? t('Video', '画面') : track.stem ? STEM_NAMES[track.stem] : track.id === 'a3' ? t('Voice', '录音') : twoAudio ? t(`Audio ${track.id.slice(1)}`, `声音 ${track.id.slice(1)}`) : t('Audio', '声音'); @@ -655,7 +686,8 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = row.empty.hidden = track.clips.length > 0; // A picture track with any block description grows a strip for it under the pictures. const noted = !!actions.describedTrack?.(track); row.element.dataset.noted = String(noted); - row.top = top; row.height = track.kind === 'video' ? 64 + (noted ? 22 : 0) : laneHeight(); + row.natural = track.kind === 'video' ? 64 + (noted ? 22 : 0) : laneHeight(); row.sound = track.kind === 'audio'; + row.top = top; row.height = row.natural; order.push(row); row.element.style.top = row.head.style.top = `${top}px`; row.element.style.height = row.head.style.height = `${row.height}px`; row.element.setAttribute('aria-label', name); @@ -727,15 +759,14 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = updateProgress(item); }); } + rowOrder = order; fitRows(); for (const [id, row] of rows) if (!tracks.some(track => track.id === id)) { row.element.remove(); row.head.remove(); rows.delete(id); } for (const [id, item] of clips) if (!retained.has(id)) { item.component?.dispose(); item.element.remove(); clips.delete(id); progresses.delete(id); } heads.append(addAudio); - addAudio.style.top = `${top}px`; addAudio.disabled = tracks.find(track => track.id === 'a2')?.clips.some(busy) || false; + addAudio.disabled = tracks.find(track => track.id === 'a2')?.clips.some(busy) || false; // With Audio 2 present the key removes it: it shows beside that track's head only while Audio 2 (or something on it) // is selected, or the pointer is over its head; it is not there the rest of the time. addAudio.dataset.mode = twoAudio ? 'remove' : 'add'; - const second = rows.get('a2'); - if (second) addAudio.style.setProperty?.('--fv-ed-remove-top', `${second.top + second.height / 2 - 14}px`); addAudio.textContent = twoAudio ? t('Remove Audio 2', '移除声音 2') : t('+ Audio track', '+ 声音轨'); addAudio.dataset.sign = twoAudio ? '×' : '+'; // Phone widths show the sign alone. // Wide heads draw the sign in the icon column and these words in the name column, like a track head. @@ -745,7 +776,6 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = addAudio.setAttribute('aria-label', addAudio.textContent); // Without Audio 2 the guide points at the button that adds it. if (twoAudio) delete addAudio.dataset.tourId; else addAudio.dataset.tourId = 'audio-a2-track'; - setTrackHeight(top - 6); layout(); // The parts of a fresh split appear under the sound they came from: show them from the top. if (parted) scroll.scrollTop = 0; diff --git a/web/editor_voice_install.js b/web/editor_voice_install.js index 72f185e9..7ffa2180 100644 --- a/web/editor_voice_install.js +++ b/web/editor_voice_install.js @@ -18,6 +18,8 @@ export function percent(row) { return Math.max(0, Math.min(99, Math.floor(row.done / row.total * 100))); } +// Lane-5x 11-22: no version or date is promised. +export const laterText = t => t('Dubbing is not available on this computer.', '这台电脑上无法使用配音。'); export const offerText = (bytes, t) => t(`Voice change needs the dubbing model (about ${sizeText(bytes)}).`, `换人声需要配音模型,约 ${sizeText(bytes)}。`); export const progressText = (value, t) => value == null ? t('Downloading the dubbing model', '正在下载配音模型') : t(`Downloading the dubbing model ${value}%`, `正在下载配音模型 ${value}%`); @@ -41,7 +43,7 @@ const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); * whether the model is there now. A download that runs when the page opens is taken up again: by the job this browser * remembers, else only as "downloading" (the engine does not hand its job to anyone else). */ -export function createVoiceInstall({api, available = () => true, target = () => true, onChange = () => {}, onReady = async () => false, +export function createVoiceInstall({api, available = () => true, later = () => false, target = () => true, onChange = () => {}, onReady = async () => false, storage = globalThis.localStorage, delay = wait, interval = 1000} = {}) { const view = {phase: 'loading', percent: null, cancelling: false, error: null, bytes: 0}; let token = '', job = readJob(storage), disposed = false, polling = false, initial = null; @@ -120,9 +122,11 @@ export function createVoiceInstall({api, available = () => true, target = () => view, init() { return initial || (initial = load()); }, // Whether the engine offers the download at all (the panel exists only then). - offered() { return !disposed && available() && ['idle', 'downloading', 'failed'].includes(view.phase); }, + offered() { return !disposed && (later() || available() && ['idle', 'downloading', 'failed'].includes(view.phase)); }, + // Windows on Arm: a sentence in the download's place, nothing to click. + later: () => !disposed && later(), // Whether the bar offers the download for this selection: the engine offers it and a stretch of speech is chosen. - visible(selection) { return !disposed && available() && ['idle', 'downloading', 'failed'].includes(view.phase) && !!target(selection); }, + visible(selection) { return !disposed && (later() || available() && ['idle', 'downloading', 'failed'].includes(view.phase)) && !!target(selection); }, async start() { if (view.phase === 'downloading') return; set({phase: 'downloading', percent: 0, cancelling: false, error: null}); @@ -166,10 +170,10 @@ export function createInstallPanel(host, install, {t, selection}) { const view = install.view, shown = install.visible(selection()); element.hidden = !shown; if (!shown) return; - const state = view.phase === 'downloading' ? 'downloading' : view.phase === 'failed' ? 'failed' : 'offer'; + const state = install.later?.() ? 'later' : view.phase === 'downloading' ? 'downloading' : view.phase === 'failed' ? 'failed' : 'offer'; element.dataset.state = state; const failure = state === 'failed' ? failureText(view.error, view.bytes, t) : null; - const text = state === 'downloading' ? progressText(view.percent, t) : failure ? failure.text : offerText(view.bytes, t); + const text = state === 'later' ? laterText(t) : state === 'downloading' ? progressText(view.percent, t) : failure ? failure.text : offerText(view.bytes, t); if (shownText !== text) { note.replaceChildren(text); shownText = text; if (failure?.report) note.append(issueButton(t, () => ({where: ['Dubbing model download', '配音模型下载'], message: failure.text, kind: view.error || null}))); diff --git a/web/editor_voice_store.js b/web/editor_voice_store.js index 5e5d5c69..34659206 100644 --- a/web/editor_voice_store.js +++ b/web/editor_voice_store.js @@ -17,7 +17,9 @@ export async function voiceFeatures(api) { if (!response.ok) return {ready: false, install: false, unknown: true}; const features = (await response.json())?.features; // The same answer says whether export can make 48/60 fps (it needs the graphics card). - return {ready: !!features?.['projects.voice'], install: !!features?.['projects.voice.install'], exportFps: !!features?.['projects.export.fps']}; + // `later`: a Windows on Arm computer, for which the dubbing runtime is not published yet. + return {ready: !!features?.['projects.voice'], install: !!features?.['projects.voice.install'], later: !!features?.['projects.voice.later'], + exportFps: !!features?.['projects.export.fps']}; } catch { return {ready: false, install: false, unknown: true}; } } diff --git a/web/error_panel.js b/web/error_panel.js index a967780d..47b148da 100644 --- a/web/error_panel.js +++ b/web/error_panel.js @@ -1,7 +1,7 @@ // Shared by the Studio and graph view. Text only; never render exception HTML. import {readOtherUsage, otherUsageText} from './other_usage.js'; import {pageRepair, repairAction, repairButton} from './repair_hint.js'; -import {detectBrowserExtension, browserExtensionAdvice, extensionSteps, isNetworkTypeError, connectionLostText, engineNotRunning, engineNotRunningText, isRequestTimeout, requestTimeoutText, requestTimeoutAction} from './browser_extension.js'; +import {detectBrowserExtension, browserExtensionAdvice, extensionSteps, isNetworkTypeError, connectionLostText, engineNotRunning, engineNotRunningText, engineNotResponding, engineNotRespondingText, isRequestTimeout, requestTimeoutText, requestTimeoutAction} from './browser_extension.js'; import {SAMPLING_EFFORTS, STEP_CACHES, UPSCALE_FACTORS, tableLevel} from './sampling_effort.js'; import {failureIssue, failureStage} from './failure_issue.js'; import {knownEngineExit} from './engine_exit.js'; @@ -655,14 +655,18 @@ export function adviceFor(report, t, value) { : failureAdvice(report.details, t, report.known_error ?? null); // A dropped connection reads as one sentence; the browser's own wording stays in the details. if (advice.kind === 'unknown' && isNetworkTypeError(value) && ['submission', 'queue'].includes(report.stage)) { - const stopped = engineNotRunning(report.connection); - Object.assign(advice, {kind: 'connection', title: stopped ? t('FreeVideo has stopped', 'FreeVideo 已停止运行') : t('Lost the connection to FreeVideo', '与 FreeVideo 的连接已断开'), - summary: stopped ? engineNotRunningText(t) : connectionLostText(t), action: ''}); + const stopped = engineNotRunning(report.connection), silent = engineNotResponding(report.connection); + Object.assign(advice, {kind: 'connection', + title: stopped ? t('FreeVideo has stopped', 'FreeVideo 已停止运行') + : silent ? t('FreeVideo is not responding', 'FreeVideo 没有响应') : t('Lost the connection to FreeVideo', '与 FreeVideo 的连接已断开'), + // Not answered: the engine may already hold the task, so the next step is the timeout card's own (look in the + // queue first) and not the plain "try again", which could queue it twice. + summary: stopped ? engineNotRunningText(t) : silent ? engineNotRespondingText(t) : connectionLostText(t), action: silent ? requestTimeoutAction(t, report.stage) : ''}); } // A request that was not answered in time: the card says so and what to check, instead of a bare title. if (advice.kind === 'unknown' && ['submission', 'queue'].includes(report.stage) && (isRequestTimeout(value) || report.exception_type === 'TimeoutError')) { - Object.assign(advice, {kind: 'timeout', title: t('FreeVideo did not answer in time', 'FreeVideo 未在规定时间内应答'), summary: requestTimeoutText(t), action: requestTimeoutAction(t)}); + Object.assign(advice, {kind: 'timeout', title: t('FreeVideo did not answer in time', 'FreeVideo 未在规定时间内应答'), summary: requestTimeoutText(t, report.stage), action: requestTimeoutAction(t, report.stage)}); } if (report.stage === 'submission' && advice.kind === 'unknown') { advice.title = t('The task could not be submitted', '任务提交失败'); diff --git a/web/glass/settings.css b/web/glass/settings.css index f1e673d0..b8275084 100644 --- a/web/glass/settings.css +++ b/web/glass/settings.css @@ -287,6 +287,8 @@ dialog.fv-set .st-table td.off{color:var(--fv-warn)} /* ── Models: the video-generation card has one height in every state (版面稳定) ── */ dialog.fv-set .st-hero{height:200px;padding:var(--fv-sp-20);display:grid;grid-template-rows:auto minmax(0,1fr);row-gap:var(--fv-sp-16);overflow:hidden} +/* A failed step's sentence can run past the fixed box (with the report button, on a narrow window): the box grows with it instead of clipping both ends. */ +dialog.fv-set .st-hero[data-state=failed],dialog.fv-set .st-hero[data-state=readerr]{height:auto;min-height:200px} dialog.fv-set .st-hero-top{display:grid;grid-template-columns:var(--fv-sp-40) minmax(0,1fr) auto;align-items:center;column-gap:var(--fv-sp-16)} dialog.fv-set .st-hic{width:var(--fv-sp-40);height:var(--fv-sp-40);border-radius:var(--fv-r-pill);display:grid;place-items:center;background:var(--fv-ctl-bg);color:var(--fv-fg2)} dialog.fv-set .st-hic .fv-i{width:20px;height:20px;stroke-width:2} @@ -439,6 +441,7 @@ dialog.fv-set .st-mi[aria-checked=true] .ck{visibility:visible} dialog.fv-set .st-picker{height:var(--fv-touch);padding:0 var(--fv-sp-16);border-radius:var(--fv-rad-pill);background:rgb(var(--fv-tint) / var(--fv-a1));box-shadow:inset 0 0 0 1px var(--fv-edge);color:var(--fv-fg);font-weight:var(--fv-fw-3)} dialog.fv-set .st-mhead .st-close{width:var(--fv-touch);height:var(--fv-touch)} dialog.fv-set .st-hero{height:288px} + dialog.fv-set .st-hero[data-state=failed],dialog.fv-set .st-hero[data-state=readerr]{height:auto;min-height:288px} dialog.fv-set .st-hero-top{grid-template-columns:var(--fv-sp-40) minmax(0,1fr);row-gap:var(--fv-sp-12)} dialog.fv-set .st-ha{grid-column:1 / -1;flex-wrap:wrap} dialog.fv-set .st-ha .st-btn{flex:1;height:var(--fv-touch)} diff --git a/web/settings_room.js b/web/settings_room.js index 84bcdcf6..3aea953a 100644 --- a/web/settings_room.js +++ b/web/settings_room.js @@ -36,7 +36,7 @@ if (typeof document !== 'undefined') { } import { nearestAllowed } from './field_note.js'; -import { cn, t, INSTALLED_HINT, gib, bytesText, atLeast, WAIT_REFUSAL, reportable, failureText, setupError, SECTIONS, sectionOf } from './settings_words.js'; +import { cn, t, INSTALLED_HINT, gib, bytesText, atLeast, WAIT_REFUSAL, reportable, reportText, failureText, setupError, SECTIONS, sectionOf } from './settings_words.js'; export { failureText, sectionOf, SECTIONS, bytesText }; let current; @@ -189,7 +189,7 @@ export async function openSetup(options) { const fault = (target, message, error, fallback) => { const known = failureText(message), text = error && known === String(message || '') ? userMessage(error, t, fallback) : known; target.textContent = text; - if (text && reportable(message)) target.append(reportTip(issueButton(t, () => ({where: ['Settings / installation', '设置/安装'], message: known})))); + if (text && reportable(message)) target.append(reportTip(issueButton(t, () => ({where: ['Settings / installation', '设置/安装'], message: reportText(known, message)})))); }; // ════════════ Models ════════════ diff --git a/web/settings_words.js b/web/settings_words.js index c22cc79b..f220cb08 100644 --- a/web/settings_words.js +++ b/web/settings_words.js @@ -24,6 +24,10 @@ const repairStep = text => text.includes('In the FreeVideo launcher, open Settin // The reserve's lower limit, said the same way whether the panel or the service stopped the value. export const atLeast = least => t(`Enter at least ${least} GiB, or turn on Automatic optimization.`, `请输入不小于 ${least} GiB 的数值,或打开“自动优化”。`); export const WAIT_REFUSAL = /^Wait for (the installation check|the installation|a placement test|a setup task) to finish; its progress is in this panel\.$/; +// A runtime stop, not a setup refusal: the sentence replaces the traceback on screen, but the report button stays and +// sends the original text, because the guard's numbers are what the cause is read from. +const MEMORY_STOP = /MemoryError: RAM guard/; +export const reportText = (shown, original) => MEMORY_STOP.test(String(original || '')) ? String(original) : shown; const SETUP_ERRORS = [ // Another task holds the installation lock; any "Lock file open:" lines name the holders. [BUSY_LOCK, text => [t(BUSY_TEXT.en, BUSY_TEXT.zh), ...text.split(/\r?\n/).filter(line => line.startsWith('Lock file open:')).slice(0, 6)].join('\n')], @@ -44,6 +48,12 @@ const SETUP_ERRORS = [ const [en, zh] = names[text.match(/^Wait for (.+) to finish/)[1]] ?? ['the setup task', '安装任务']; return t(`Wait for ${en} to finish; its progress is under Models.`, `请等待${zh}完成,进度见“模型”。`); }], + // The placement test's text encoder was stopped by the memory guard: the computer, not FreeVideo's own use, ran short. + // The paging-file step is said only when Windows reports its commit headroom as exhausted. + [MEMORY_STOP, text => t('The performance measurement stopped because the computer ran out of available memory. Close memory-heavy programs, then start measuring again under Performance measurement in Advanced.', + '性能测量因电脑可用内存不足而停止。请关闭占用内存较多的程序,再到“高级”中的“性能测量”重新开始测量。') + + (text.includes('Windows commit headroom exhausted') ? t(' If it happens again, in Windows virtual memory settings, use a system-managed paging file on a drive with free space.', + '仍然出现时,请在 Windows 虚拟内存设置中使用系统管理的分页文件,并确保所在磁盘有空闲空间。') : '')], [/^Inspect this installation again before installing$/, () => t('Click Check installation again, then Install.', '请重新点“检查安装”,再点“安装”。')], [/^Review the plan and accept its model\/toolkit licenses first$/, () => t('Tick the agreement to enable Install.', '勾选同意后,可点击“安装”。')], // Saving the reserve: the panel's own limits normally stop these first. @@ -59,7 +69,8 @@ const SETUP_ERRORS = [ [/^The FreeVideo Python environment is missing\./, text => t('This installation is missing its runtime. ', '该安装缺少运行环境。') + repairStep(text)], ]; export const setupError = text => SETUP_ERRORS.find(([pattern]) => pattern.test(text))?.[1](text); -export const reportable = value => !/The installation plan changed\. Detect configuration again|MODEL_MISMATCH_REPAIR:/.test(String(value || '')) +export const reportable = value => MEMORY_STOP.test(String(value || '')) && !isBusy(String(value || '')) + || !/The installation plan changed\. Detect configuration again|MODEL_MISMATCH_REPAIR:/.test(String(value || '')) && setupError(String(value || '')) === undefined && !isBusy(String(value || '')); export const failureText = value => { const text = String(value || ''), matches = [...text.matchAll(/MODEL_MISMATCH_REPAIR: ([^\r\n]+)/g)]; diff --git a/web/task_float.js b/web/task_float.js index 36e8ddea..7a14ad16 100644 --- a/web/task_float.js +++ b/web/task_float.js @@ -244,19 +244,20 @@ export function confirmStop(anchor, {kind = 'video', queued = false, host = null return new Promise(resolve => { const box = el('div', 'sgf sgf-confirm'); box.setAttribute('popover', 'manual'); box.dataset.fvTipScope = ''; const sheet = el('div', 'sgf-sheet'); sheet.setAttribute('role', 'alertdialog'); - const title = el('b', null), text = el('p', null); - title.textContent = queued ? t('Remove from the queue?', '取消排队?') : t('Stop generating?', '停止生成?'); + const title = el('b', null), text = el('p', null), voice = kind === 'voice' && !queued && !agent; + title.textContent = queued ? t('Remove from the queue?', '取消排队?') : voice ? t('Stop dubbing?', '停止配音?') : t('Stop generating?', '停止生成?'); if (agent) { title.textContent = queued ? t('Remove from the queue?', '取消排队?') : t('Stop this step?', '停止这一步?'); text.textContent = queued ? t('It has not started; it will not run.', '这一步还没有开始,取消后不会进行。') : t('What this step has made so far is not kept. Finished works stay.', '这一步做到一半的不会保留,已经完成的作品不受影响。'); } else text.textContent = queued ? t('It has not started; it will not be made.', '这项还没有开始,取消后不会生成。') + : voice ? t('Lines already dubbed are kept; the rest can be dubbed again later.', '已配好的台词会保留,其余台词可以稍后重新配音。') : kind === 'image' ? t('This picture will not be kept.', '这张图不会保留。') : t('What has been made so far is not kept. Queued jobs go on.', '已生成的部分不会保留,排队的任务照常进行。'); const ask = el('div', 'sgf-ask'), acts = el('div', 'sgf-acts'); const keep = el('button', 'pill line'), stop = el('button', 'pill danger'); - keep.type = stop.type = 'button'; keep.textContent = agent ? t('Keep going', '继续') : t('Keep going', '继续生成'); stop.textContent = queued ? t('Remove', '取消排队') : t('Stop', '停止'); - tip(keep, keep.textContent, agent ? t('Close this and let the step go on', '不停止,让这一步接着做') : t('Close this and keep generating', '不停止,接着生成'), 'Esc'); - tip(stop, stop.textContent, queued ? t('Take it out of the queue', '从队列里拿掉这一项') : agent ? t('Stop this step now; what it made so far is not kept', '立即停止这一步,做到一半的不保留') : t('Stop it now; nothing is kept', '立即停止,不保留结果')); + keep.type = stop.type = 'button'; keep.textContent = agent ? t('Keep going', '继续') : voice ? t('Keep dubbing', '继续配音') : t('Keep going', '继续生成'); stop.textContent = queued ? t('Remove', '取消排队') : t('Stop', '停止'); + tip(keep, keep.textContent, agent ? t('Close this and let the step go on', '不停止,让这一步接着做') : voice ? t('Close this and keep dubbing', '不停止,接着配音') : t('Close this and keep generating', '不停止,接着生成'), 'Esc'); + tip(stop, stop.textContent, queued ? t('Take it out of the queue', '从队列里拿掉这一项') : agent ? t('Stop this step now; what it made so far is not kept', '立即停止这一步,做到一半的不保留') : voice ? t('Stop now and keep the lines already dubbed', '立即停止,保留已配好的台词') : t('Stop it now; nothing is kept', '立即停止,不保留结果')); acts.append(keep, stop); ask.append(title, text, acts); sheet.append(ask); box.append(sheet); (host || anchor.closest('dialog[open]') || document.body).append(box); raise(box); const a = anchor.getBoundingClientRect(), w = 300, h = box.offsetHeight || 132; diff --git a/web/tutorial/library-organize-1.webp b/web/tutorial/library-organize-1.webp new file mode 100644 index 00000000..30b7b655 Binary files /dev/null and b/web/tutorial/library-organize-1.webp differ diff --git a/web/tutorial/library-organize-2.webp b/web/tutorial/library-organize-2.webp new file mode 100644 index 00000000..2628b48e Binary files /dev/null and b/web/tutorial/library-organize-2.webp differ diff --git a/web/tutorial/run-modes-1.webp b/web/tutorial/run-modes-1.webp new file mode 100644 index 00000000..d7f67a42 Binary files /dev/null and b/web/tutorial/run-modes-1.webp differ diff --git a/web/tutorial/run-modes-2.webp b/web/tutorial/run-modes-2.webp new file mode 100644 index 00000000..036b2b56 Binary files /dev/null and b/web/tutorial/run-modes-2.webp differ diff --git a/web/tutorial/upscale-1.webp b/web/tutorial/upscale-1.webp new file mode 100644 index 00000000..1ee965eb Binary files /dev/null and b/web/tutorial/upscale-1.webp differ diff --git a/web/tutorial/upscale-2.webp b/web/tutorial/upscale-2.webp new file mode 100644 index 00000000..0fcc5a51 Binary files /dev/null and b/web/tutorial/upscale-2.webp differ diff --git a/web/tutorial_book.js b/web/tutorial_book.js index 3a9f08ec..982c33fc 100644 --- a/web/tutorial_book.js +++ b/web/tutorial_book.js @@ -36,13 +36,13 @@ const COPY = { stepDone: 'Mark it done and move on', stepBack: 'Go back one step', drag: 'Drag to another corner', play: 'Play this example'}}, }; const GROUPS = [ - [['Start', '入门'], ['quick-start', 'text-to-video', 'timed-lines', 'quality-tiers', 'refine']], + [['Start', '入门'], ['quick-start', 'text-to-video', 'timed-lines', 'quality-tiers', 'refine', 'run-modes']], [['Pictures and people', '用图片和人物'], ['first-last-frame', 'middle-frames', 'reference-video', 'cast-sheet', 'scenes-props', 'replace-person', 'replace-two-people', 'lora']], [['Pictures', '图像'], ['image-gen', 'image-references', 'edit-image', 'local-image-edit', 'new-image-shape']], [['Longer videos', '更长的视频'], ['long-video', 'extend-video', 'continue-or-new-shot']], [['Edit and sound', '剪辑与声音'], ['editor', 'save-frame', 'editor-extend-refs', 'segment-prompt', 'separate-tracks', 'replace-music', 'beat-snap', 'voice-recording', 'narration', 'sound-to-picture', 'text-subtitles']], [['Autopilot', 'AI 全自动'], ['autopilot', 'drama-outline', 'film-project']], - [['Library and system', '作品与运行'], ['library-reuse', 'library-export', 'system-status', 'launcher-close', 'troubleshoot', 'offline-reimport']], + [['Library and system', '作品与运行'], ['library-reuse', 'upscale', 'library-export', 'library-organize', 'system-status', 'launcher-close', 'troubleshoot', 'offline-reimport']], ]; // The figure is a finished example, not a screenshot of the interface (screenshots go stale; "Take me there" points at the real control). const FIG = { diff --git a/web/tutorial_book_content.js b/web/tutorial_book_content.js index fc5619d1..b0346ef7 100644 --- a/web/tutorial_book_content.js +++ b/web/tutorial_book_content.js @@ -127,8 +127,8 @@ export const TUTORIAL_CHAPTERS = [ settings: {}, }, limits: { - zh: ['图片会按所选画幅居中裁切。', 'Mac 上首帧、尾帧暂不能与参考图、角色同时使用。'], - en: ['Images are center-cropped to the chosen shape.', 'On a Mac, first and last frames cannot be used with reference images or characters yet.'], + zh: ['图片会按所选画幅居中裁切。', 'Mac 上首帧、尾帧与参考图、角色请选其一使用。'], + en: ['Images are center-cropped to the chosen shape.', 'On a Mac, a request uses either first and last frames, or reference images and characters.'], }, }, { @@ -159,8 +159,8 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:素材区域和参考图已用红框标出。', en: 'The creation panel, with the Media section and a reference image outlined in red.'}, }, steps: { - zh: ['在创作面板的“素材”中添加图片,每张可设为参考、首帧或尾帧。', '在描述中输入 @ 选择图片,并写明它在画面中的作用,例如“ 里的女孩在海边奔跑”。', '视频和音频也可作为参考:同样点“添\u2060加”,在描述中输入 @ 引用。', '音频卡片上选“原样使用”时,成片直接使用这段声音,时长随音频而定;一次只能有一段音频原样使用。', '点“生⁠成⁠视⁠频”。'], - en: ['Add images under "Media" in the creation panel and set each one as a reference, first frame, or last frame.', 'Type @ in the prompt and choose an image, then say what it does in the scene, for example "The girl in runs along the beach".', 'Videos and audio can be references too: add them the same way with "Add" and mention them in the prompt with @.', 'On an audio card, choose "Use as is" to put that audio into the result unchanged. The duration follows the audio, and only one audio file can be used as is.', 'Choose "Generate video".'], + zh: ['在创作面板的“素材”中添加图片,每张可设为参考、首帧或尾帧。', '在描述中输入 @ 选择图片,并写明它在画面中的作用,例如“ 里的女孩在海边奔跑”。', '视频和音频也可作为参考:同样点“添\u2060加”,在描述中输入 @ 引用;视频卡片上勾选“仅参考构图”时,只沿用它的构图,不沿用动作和颜色。', '音频卡片上选“原样使用”时,成片直接使用这段声音,时长随音频而定;一次只能有一段音频原样使用。', '点“生⁠成⁠视⁠频”。'], + en: ['Add images under "Media" in the creation panel and set each one as a reference, first frame, or last frame.', 'Type @ in the prompt and choose an image, then say what it does in the scene, for example "The girl in runs along the beach".', 'Videos and audio can be references too: add them the same way with "Add" and mention them in the prompt with @. On a video card, check "Composition only" to follow its layout but not its motion or colors.', 'On an audio card, choose "Use as is" to put that audio into the result unchanged. The duration follows the audio, and only one audio file can be used as is.', 'Choose "Generate video".'], }, example: { assets: [], @@ -192,8 +192,8 @@ export const TUTORIAL_CHAPTERS = [ settings: {}, }, limits: { - zh: ['一次请求最多使用 3 个角色。', '角色不能与首帧、尾帧同时使用。', '角色的外观可能每次略有不同。'], - en: ['A request uses up to 3 characters.', 'Characters cannot be used with first or last frames.', 'A character may look slightly different between runs.'], + zh: ['一次请求最多使用 3 个角色。', 'Mac 上角色与首帧、尾帧请选其一使用。', '角色的外观可能每次略有不同。'], + en: ['A request uses up to 3 characters.', 'On a Mac, a request uses either characters or first and last frames.', 'A character may look slightly different between runs.'], }, }, { @@ -210,8 +210,8 @@ export const TUTORIAL_CHAPTERS = [ en: ['Expand "Media" in the creation panel and choose + on the "Scenes" or "Props" row.', 'Enter a "Name" and add pictures: choose "Upload images" or "Generate with AI". A scene takes up to 3 pictures, a prop 1.', 'Choose "Save".', 'Later, type @ in the description to pick it, and say where it is in the shot or how it is used.'], }, limits: { - zh: ['一次请求最多使用 1 个场景和 2 个道具,不占角色的 3 个名额。', '场景和道具不能与首帧、尾帧同时使用。', '物品的细节可能每次略有不同。'], - en: ['A request uses up to 1 scene and 2 props, which do not count toward the 3 characters.', 'Scenes and props cannot be used with first or last frames.', 'Fine details of an object may differ slightly between runs.'], + zh: ['一次请求最多使用 1 个场景和 2 个道具,不占角色的 3 个名额。', 'Mac 上场景、道具与首帧、尾帧请选其一使用。', '物品的细节可能每次略有不同。'], + en: ['A request uses up to 1 scene and 2 props, which do not count toward the 3 characters.', 'On a Mac, a request uses either scenes and props or first and last frames.', 'Fine details of an object may differ slightly between runs.'], }, }, { @@ -228,8 +228,8 @@ export const TUTORIAL_CHAPTERS = [ en: ['Expand "Media" in the creation panel and turn on "Replace person".', 'Under "Source video" choose "Add video", and under "Person image" choose "Add image".', 'To keep the sound of the source video, check "Keep source video sound".', 'The prompt can stay empty or describe more of the picture. Then choose "Generate video".'], }, limits: { - zh: ['替换人物不能与首帧、尾帧同时使用。', '首次使用时会自动下载约 80 MB 的替换人物模型,面板中显示进度,下载完成后才能生成。', '源视频至少 1 秒;源视频没有声音时,不能保留声音。'], - en: ['Replace person cannot be used with first or last frames.', 'The first time, the Replace person model of about 80 MB downloads on its own. The panel shows the progress, and generation can start when it finishes.', 'The source video must be at least 1 second long. A source video without sound has no sound to keep.'], + zh: ['替换人物与首帧、尾帧请选其一使用。', '首次使用时会自动下载约 80 MB 的替换人物模型,面板中显示进度,下载完成后才能生成。', '源视频至少 1 秒;源视频没有声音时,不能保留声音。'], + en: ['A request uses either Replace person or first and last frames.', 'The first time, the Replace person model of about 80 MB downloads on its own. The panel shows the progress, and generation can start when it finishes.', 'The source video must be at least 1 second long. A source video without sound has no sound to keep.'], }, }, { @@ -247,8 +247,8 @@ export const TUTORIAL_CHAPTERS = [ en: ['Expand "Media" in the creation panel, turn on "Replace person" and add the video under "Source video".', 'Add the first picture under "Person image 1". "Person image 2" appears next to it; add the second picture there.', 'The pictures are matched to the people in the video from left to right: image 1 replaces the person on the left, image 2 the person on the right.', 'Choose × at the top right of a picture to remove it.', 'Choose "Generate video".'], }, limits: { - zh: ['一次最多替换 2 个人物。', '替换人物不能与首帧、尾帧同时使用。'], - en: ['Up to 2 people can be replaced in one request.', 'Replace person cannot be used with first or last frames.'], + zh: ['一次最多替换 2 个人物。', '替换人物与首帧、尾帧请选其一使用。'], + en: ['Up to 2 people can be replaced in one request.', 'A request uses either Replace person or first and last frames.'], }, }, { @@ -357,8 +357,8 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:“生⁠成⁠视⁠频”右侧的箭头已用红框标出,展开的菜单中有“生⁠成⁠视⁠频”和“生⁠成⁠预⁠览”。', en: 'The creation panel, with the arrow beside "Generate video" outlined in red and its menu open on "Generate video" and "Generate preview".'}, }, steps: { - zh: ['点“生⁠成⁠视⁠频”右侧的箭头,选“生⁠成⁠预⁠览”。', '点“生⁠成⁠预⁠览”,等待预览完成。', '画面满意时,点结果中的“继续二采”。', '不满意时,修改描述或种子,再生成新的预览。'], - en: ['Choose the arrow beside "Generate video" and pick "Generate preview".', 'Choose "Generate preview" and wait for it to finish.', 'When the picture is right, choose "Run second pass" in the result.', 'Otherwise change the prompt or the seed and generate a new preview.'], + zh: ['点“生⁠成⁠视⁠频”右侧的箭头,选“生⁠成⁠预⁠览”。', '点“生⁠成⁠预⁠览”,等待预览完成。', '画面满意时,点结果中的“继续二采”;也可以在作品库中右键这条预览,选“继续二采”。', '不满意时,修改描述或种子,再生成新的预览。'], + en: ['Choose the arrow beside "Generate video" and pick "Generate preview".', 'Choose "Generate preview" and wait for it to finish.', 'When the picture is right, choose "Run second pass" in the result, or right-click the preview in Creations and choose "Run second pass".', 'Otherwise change the prompt or the seed and generate a new preview.'], }, example: { assets: [], @@ -370,6 +370,24 @@ export const TUTORIAL_CHAPTERS = [ en: ['The full video matches a direct run.', 'A preview is quicker, but the models still have to load.'], }, }, + { + id: 'run-modes', + title: {zh: '一次生成多条:批量、每行一条描述和循环', en: 'Several at once: batch, one prompt per line, loop'}, + summary: {zh: '用同一组设置连续生成多个版本,或一次试几种写法。', en: 'Make several takes with the same settings in a row, or try several prompts at once.'}, + media: { + type: 'image', + src: {zh: 'run-modes-1.webp', en: 'run-modes-2.webp'}, + alt: {zh: '“高级选项”窗口:“生成方式”中的“批量”、“生成数量”和“每行一条描述”已用红框标出。', en: 'The Advanced window, with "Batch", "Number of videos" and "One prompt per line" under "Generation mode" outlined in red.'}, + }, + steps: { + zh: ['点创作面板底部的“高级选项”(滑杆图标)。', '在“生成方式”中选“批量”,填写“生成数量”,再点生成:用当前设置连续生成这么多个视频,每个换一个种子。', '要一次试几种写法,打开“每行一条描述”,在描述框中每行写一条,每行生成一个视频。', '选“循环”后点“开始循环”,会一直生成新版本;点“完成当前后停止”结束。'], + en: ['Choose "Advanced" (the sliders icon) at the bottom of the creation panel.', 'Under "Generation mode", choose "Batch", set "Number of videos", then generate: that many videos are made in a row with the current settings, each with a new seed.', 'To try several prompts at once, turn on "One prompt per line" and write one prompt per line in the description. Each line becomes one video.', 'Choose "Loop" and then "Start loop" to keep making new takes; choose "Stop after this video" to end it.'], + }, + limits: { + zh: ['分段视频每次生成一条,“批量”和“循环”用于单段视频。', '打开“增强”时,每行一条描述按原文发送,不做增强。', '循环在关闭网页后停止。'], + en: ['Videos made in parts are made one at a time; "Batch" and "Loop" are for single-part videos.', 'With "Enhance" on, each line is sent as written, without enhancement.', 'A loop stops when the page is closed.'], + }, + }, { id: 'long-video', title: {zh: '连续的长视频', en: 'Make a longer video'}, @@ -741,6 +759,25 @@ export const TUTORIAL_CHAPTERS = [ en: ['A video that kept no prompt does not offer "Reuse settings".'], }, }, + { + id: 'upscale', + goto: ['works-entry'], + title: {zh: '放大视频', en: 'Upscale a video'}, + summary: {zh: '把生成好的视频放大成一个更大的新作品,原视频保留不变。', en: 'Make a larger copy of a finished video as a new creation. The original stays as it is.'}, + media: { + type: 'image', + src: {zh: 'upscale-1.webp', en: 'upscale-2.webp'}, + alt: {zh: '作品库中一条视频的右键菜单:两项“放大到 宽 × 高”已用红框标出。', en: 'The right-click menu of a video in Creations, with the two "Upscale to W × H" rows outlined in red.'}, + }, + steps: { + zh: ['在作品库中右键一条生成好的视频;大图查看和创作页结果下方的“⋯”菜单中也有同样的选项。', '选“放大到 宽 × 高”:尺寸较小的一项放大 1.5 倍,按原来的描述和种子重新生成细节;尺寸较大的一项放大到 4K 级别,逐帧放大。', '放大任务加入队列,完成后作为新作品出现在作品库中。'], + en: ['In Creations, right-click a finished video. The "⋯" menu in the large view and below a result in the creation panel has the same choices.', 'Choose "Upscale to W × H". The smaller size is 1.5 times larger and redraws detail from the original prompt and seed; the larger size is about 4K, upscaled frame by frame.', 'The upscale is queued and appears in Creations as a new creation when done.'], + }, + limits: { + zh: ['生成完成的 24 fps 视频可以放大;预览请先继续二采,再放大。', '本机能生成该尺寸和时长时,才出现放大 1.5 倍的一项;合并或导入的视频可放大到 4K。', '放大后保留视频原有的声音。'], + en: ['Finished 24 fps videos can be upscaled. For a preview, run the second pass first.', 'The 1.5 times size appears when this computer can generate that size and length. A merged or imported video can be upscaled to 4K.', 'The upscaled video keeps the original sound.'], + }, + }, { id: 'library-export', goto: ['works-entry'], @@ -752,14 +789,33 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '“作品库”:第一条作品已用红框标出。', en: 'Your creations, with the first video outlined in red.'}, }, steps: { - zh: ['点预览下方最近作品开头的“作品库”。', '选择一条视频,可播放,或点“接着生成”在剪辑视图中继续;要一次下载多个作品,点“选⁠择”选中它们,再点“下⁠载”,存成一个压缩包。', '在作品详情中点爱心图标收藏;列表上方选“收⁠藏”只看收藏的作品,选“全⁠部”看所有作品。', '需要成片时,在“剪辑视图”点“导⁠出”。', '在导出窗口选择范围、画质和内容;要更流畅的画面时,在“帧率”中选 48 或 60,中间的画面由显卡补出;要保留无损的声音,在“声音”中选“无损”。再点“导⁠出”。'], - en: ['Choose "Creations" at the start of the recent videos below the preview.', 'Pick a video to play it, or choose "Continue" to continue it in the Edit view. To download several at once, choose "Select", pick them, then choose "Download" to save them as one zip file.', 'In a creation\'s details, choose the heart to add it to favorites. Above the list, choose "Favorites" to see only those, or "All" to see every creation.', 'For a finished file, choose "Export" in the Edit view.', 'In the export window choose the range, quality and content. For smoother motion, choose 48 or 60 under "Frame rate"; the graphics card makes the frames in between. To keep the sound lossless, choose "Lossless" under "Sound". Then choose "Export".'], + zh: ['点预览下方最近作品开头的“作品库”。', '选择一条视频,可播放,或点“接着生成”在剪辑视图中继续;要一次下载多个作品,点作品右上角的勾选框选中它,再点其他作品一起选中,然后点“下⁠载”,存成一个压缩包。', '在作品详情中点爱心图标收藏;在左侧选“收⁠藏”只看收藏的作品,选“全⁠部”看所有作品。', '需要成片时,在“剪辑视图”点“导⁠出”。', '在导出窗口选择范围、画质和内容;要更流畅的画面时,在“帧率”中选 48 或 60,中间的画面由显卡补出;要保留无损的声音,在“声音”中选“无损”。再点“导⁠出”。'], + en: ['Choose "Creations" at the start of the recent videos below the preview.', 'Pick a video to play it, or choose "Continue" to continue it in the Edit view. To download several at once, choose the check box at the top right of a creation, choose the others to add them, then choose "Download" to save them as one zip file.', 'In a creation\'s details, choose the heart to add it to favorites. On the left, choose "Favorites" to see only those, or "All" to see every creation.', 'For a finished file, choose "Export" in the Edit view.', 'In the export window choose the range, quality and content. For smoother motion, choose 48 or 60 under "Frame rate"; the graphics card makes the frames in between. To keep the sound lossless, choose "Lossless" under "Sound". Then choose "Export".'], }, limits: { zh: ['删除作品前会确认;被剪辑使用的作品不能删除。', '导出窗口每次打开时,“内容”默认选“画面和声音”,“画质”默认选“高”;窗口里没有“帧率”时,这台电脑不支持 48 和 60 帧导出。', '导出过程中取消不会留下不完整的文件。'], en: ['FreeVideo asks before deleting a video, and a video used in an edit cannot be deleted.', 'The export window always opens with "Video and audio" as the content and "High" as the quality; when it has no "Frame rate", this computer cannot export at 48 or 60 fps.', 'Cancelling an export leaves no unfinished file.'], }, }, + { + id: 'library-organize', + goto: ['works-entry'], + title: {zh: '整理作品:标签、筛选和对比', en: 'Organize creations: tags, filters and compare'}, + summary: {zh: '用标签归类作品,按条件筛选,并把两个作品放在一起比较。', en: 'Group creations with tags, narrow the list with filters, and compare two creations.'}, + media: { + type: 'image', + src: {zh: 'library-organize-1.webp', en: 'library-organize-2.webp'}, + alt: {zh: '作品库中选中了两个作品:左侧的“标签”和中间对比上方的“并排”“滑块”已用红框标出。', en: 'Creations with two creations selected, with "Tags" on the left and "Side by side" and "Slider" above the comparison outlined in red.'}, + }, + steps: { + zh: ['在作品库左侧点“新建标签”,输入名称后按 Enter。', '点作品右上角的勾选框选中它,再点其他作品一起选中;在右侧上方点标签图标,选一个标签。之后在左侧点这个标签,只看带有它的作品。', '点上方的“筛⁠选”,按时间、图片来源等条件缩小范围;也可以在搜索框中按提示词或名称查找。', '正好选中两个作品时,画面中间对比显示它们,可切换“并⁠排”或“滑⁠块”。'], + en: ['On the left of Creations, choose "New tag", type a name and press Enter.', 'Choose the check box at the top right of a creation and choose others to add them. At the top right, choose the tag icon and pick a tag. Later, choose that tag on the left to see only the creations that have it.', 'Choose "Filter" at the top to narrow the list by time, picture source and more, or search by prompt or name in the search box.', 'With exactly two creations selected, they are compared in the middle; switch between "Side by side" and "Slider".'], + }, + limits: { + zh: ['标签保存在当前浏览器中,只在这个浏览器里显示。', '删除的作品在 10 秒内可在左侧“最近删除”中恢复。'], + en: ['Tags are kept in this browser and show only here.', 'A deleted creation can be brought back from "Recently deleted" on the left within 10 seconds.'], + }, + }, { id: 'system-status', title: {zh: '运行状态', en: 'System status'}, @@ -855,6 +911,7 @@ export const TUTORIAL_ALIASES = { 'lora': {zh: ['风格模型', '微调模型'], en: ['style model', 'fine-tuned model']}, 'quality-tiers': {zh: ['画质', '档位', '清晰度', '速度'], en: ['quality', 'speed', 'resolution']}, 'refine': {zh: ['预览', '二次采样', '精修'], en: ['preview', 'second pass', 'refine']}, + 'run-modes': {zh: ['批量生成', '多个版本', '循环生成', '多条描述'], en: ['batch', 'many takes', 'loop', 'multiple prompts']}, 'long-video': {zh: ['长视频', '多段', '连续生成'], en: ['long video', 'longer', 'multi-part']}, 'extend-video': {zh: ['续写', '延长', '接着生成', '视频续写'], en: ['extend', 'continue video', 'make longer']}, 'continue-or-new-shot': {zh: ['换镜头', '新镜头', '转场'], en: ['new shot', 'cut', 'transition']}, @@ -873,6 +930,8 @@ export const TUTORIAL_ALIASES = { 'drama-outline': {zh: ['短剧', '剧本', '大纲'], en: ['short drama', 'script', 'outline']}, 'film-project': {zh: ['成片', '短剧剪辑'], en: ['finished film', 'drama edit']}, 'library-reuse': {zh: ['同款', '复用', '再生成一次'], en: ['reuse', 'same settings', 'remix']}, + 'upscale': {zh: ['超分', '4K', '提高分辨率', '变大'], en: ['4K', 'enlarge', 'higher resolution', 'super resolution']}, + 'library-organize': {zh: ['分类', '归类', '整理', '找作品', '回收站'], en: ['organize', 'sort', 'find a video', 'trash', 'side by side']}, 'library-export': {zh: ['导出', '下载', '保存视频', '收藏'], en: ['export', 'download', 'save video', 'favorites']}, 'system-status': {zh: ['显存', '内存', '状态', '占用'], en: ['vram', 'memory', 'gpu', 'status']}, 'launcher-close': {zh: ['后台', '退出', '关闭'], en: ['background', 'quit', 'exit']},