From 3496dbcd68f8df272281ca04686c1d04635cb5b6 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 18:26:11 +0800 Subject: [PATCH 01/89] chore: open the next dev cycle at 3.3.0-dev The 3.2.0 release merged dev into main, so dev now carries the release history; VERSION moves to the next milestone (AI Toolkit, see docs/roadmap.md). --- CHANGELOG.md | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 840d82195..106f2c2b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ 本文件记录 **wochenlong/lora-scripts-next**(产品名 **Next Trainer**)面向镜像与 AutoDL 的发行说明;上游 kohya-ss/sd-scripts 的变更请见其仓库。 +--- +## 未发布(dev) + +(下一个开发周期:AI Toolkit 模型格式与训练体验,详见 docs/roadmap.md) + --- ## v3.2.0 — 2026-10-11 diff --git a/VERSION b/VERSION index 944880fa1..6d7d65910 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0 +3.3.0-dev From 9f6ae4588696964631db1add7eb19333c93940a6 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 18:26:33 +0800 Subject: [PATCH 02/89] docs: record the natural-language tagging deferral and Ideogram 4 status on the roadmap --- docs/roadmap.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index ac3db8f21..e875729b0 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -25,9 +25,12 @@ Next Trainer 的定位是多引擎专业训练工作台。3.x 持续扩大主流 **继续推进的范围:** - 简单预处理,例如放大、透明背景转白底。 -- 本地大模型自然语言打标,与 Tag 模型明确区分。 - 完善管理、打标、编辑与训练间的路径和操作衔接。 -- 常规模型支持更新,包括评估通过 Musubi 接入 Ideogram-4;须独立完成本仓适配与验收。 +- Ideogram-4 已通过 Musubi 接入(本仓适配与补丁完成),GPU 真机验收仍在进行([#424](https://github.com/wochenlong/lora-scripts-next/issues/424));验收完成前不在发布说明中作为已验收能力宣传。 + +**暂不在本版范围:** + +- 本地大模型自然语言打标(与 Tag 模型明确区分)按维护者决定推迟,待后续版本再评估(当前仍只有 Tag 模型打标与词库/本地模型/API 的中文释义)。 视频、音频管理以及 API 打标属于后续扩展,不因界面预留入口就列为首期已支持。发布准备时复查相关历史问题,记录风险与规避方式,不以清空所有历史 Issue 作为统一门槛。 From ea9ce5d4d06b062056a1b5caba280ef2118d06a2 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 18:43:33 +0800 Subject: [PATCH 03/89] fix(musubi): normalize legacy list-form extra_special_tokens in tokenizer_config (#416) transformers >= 4.5x expects a mapping; a bare list aborted tokenizer loading with an opaque TypeError. Normalize on download (including a custom asset path), and again in the krea2 / ideogram4 source patches so manually placed tokenizers are healed before launch too. --- mikazuki/model_assets.py | 42 +++++++++++++++++++++++- tests/test_model_assets.py | 66 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/mikazuki/model_assets.py b/mikazuki/model_assets.py index 85608ee83..0fac76280 100644 --- a/mikazuki/model_assets.py +++ b/mikazuki/model_assets.py @@ -17,6 +17,7 @@ from dataclasses import dataclass from pathlib import Path from typing import Any, Callable +import json import os import re @@ -189,6 +190,40 @@ def dir_complete(path: Path) -> bool: return all((path / name).is_file() for name in TOKENIZER_REQUIRED) +_TOKENIZER_CONFIG_NAME = "tokenizer_config.json" + + +def normalize_tokenizer_config(tokenizer_dir: Path, log: Callable[[str], None] = print) -> bool: + """Rewrite a tokenizer_config whose ``extra_special_tokens`` is a legacy list. + + transformers >= 4.5x expects a mapping (``{"additional_special_tokens": [...]}``); + a bare list raises while loading the tokenizer, which used to surface as an + opaque TypeError during preflight/training (#416). Idempotent, and never + touches a config that is already in the mapping form. + """ + config_path = Path(tokenizer_dir) / _TOKENIZER_CONFIG_NAME + if not config_path.is_file(): + return False + try: + payload = json.loads(config_path.read_text(encoding="utf-8")) + except (OSError, json.JSONDecodeError) as exc: + log(f"[tokenizer] cannot read {config_path} ({exc}); left unchanged") + return False + if not isinstance(payload, dict): + return False + value = payload.get("extra_special_tokens") + if not isinstance(value, list): + return False + payload["extra_special_tokens"] = { + "additional_special_tokens": [str(item) for item in value] + } + tmp = config_path.with_name(config_path.name + ".mikazuki-tmp") + tmp.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8") + os.replace(tmp, config_path) + log(f"[tokenizer] extra_special_tokens list -> mapping in {config_path}") + return True + + def asset_dir_complete(asset: AssetDef, path: Path) -> bool: if asset.key == "diffsynth_model_dir": from mikazuki.engines.diffsynth.adapter import weight_files @@ -232,6 +267,7 @@ def patch_krea2_tokenizer_path(source_root: Path, tokenizer_dir: Path, log: Call if not encoder.is_file(): return False tokenizer_dir = Path(tokenizer_dir) + normalize_tokenizer_config(tokenizer_dir, log) if not dir_complete(tokenizer_dir): return False text = encoder.read_text(encoding="utf-8") @@ -308,6 +344,7 @@ def patch_ideogram4_source(source_root: Path, tokenizer_dir: Path, log: Callable module = Path(source_root) / IDEOGRAM4_UTILS_REL if not module.is_file(): return False + normalize_tokenizer_config(Path(tokenizer_dir), log) text = module.read_text(encoding="utf-8") patched = text if _ROTARY_PATCH_MARK not in patched: @@ -403,8 +440,11 @@ def download_assets( if asset is None: raise ValueError(f"未知资产: {item.get('key')}") if asset.kind == "dir": - _download_dir_asset(asset, source, _target_path(str(item.get("path") or asset.default_path), project_root), log) + target_dir = _target_path(str(item.get("path") or asset.default_path), project_root) + _download_dir_asset(asset, source, target_dir, log) log(f"[done] {asset.label}") + if asset.key == "tokenizer": + normalize_tokenizer_config(target_dir, log) if train_type == "krea2-lora" and asset.key == "tokenizer": patch_krea2_tokenizer_everywhere(project_root, log) elif train_type == "ideogram4-lora" and asset.key == "tokenizer": diff --git a/tests/test_model_assets.py b/tests/test_model_assets.py index 0ac7b64fc..8c460b39d 100644 --- a/tests/test_model_assets.py +++ b/tests/test_model_assets.py @@ -1,5 +1,6 @@ from __future__ import annotations +import json import tempfile import unittest from pathlib import Path @@ -11,6 +12,7 @@ download_assets, krea2_tokenizer_dir, manifest_for, + normalize_tokenizer_config, patch_krea2_tokenizer_path, resolve_train_type, ) @@ -192,5 +194,69 @@ def test_patch_noop_without_tokenizer_files(self): self.assertEqual(encoder.read_text(encoding="utf-8"), self.ENCODER) +class TokenizerConfigNormalizeTests(unittest.TestCase): + """#416: legacy list form of extra_special_tokens breaks tokenizer loading.""" + + def _write_config(self, root: Path, payload) -> Path: + config_path = root / "tokenizer_config.json" + if isinstance(payload, str): + config_path.write_text(payload, encoding="utf-8") + else: + config_path.write_text(json.dumps(payload), encoding="utf-8") + return config_path + + def test_list_form_is_converted_to_mapping(self): + with tempfile.TemporaryDirectory() as td: + config_path = self._write_config( + Path(td), + {"tokenizer_class": "Qwen2TokenizerFast", "extra_special_tokens": ["<|a|>", "<|b|>"]}, + ) + logs = [] + self.assertTrue(normalize_tokenizer_config(Path(td), logs.append)) + payload = json.loads(config_path.read_text(encoding="utf-8")) + + self.assertEqual(payload["extra_special_tokens"], {"additional_special_tokens": ["<|a|>", "<|b|>"]}) + self.assertEqual(payload["tokenizer_class"], "Qwen2TokenizerFast") + self.assertTrue(any("extra_special_tokens" in line for line in logs)) + + def test_mapping_form_is_left_untouched(self): + original = {"extra_special_tokens": {"additional_special_tokens": ["<|a|>"]}} + with tempfile.TemporaryDirectory() as td: + config_path = self._write_config(Path(td), original) + before = config_path.read_text(encoding="utf-8") + + self.assertFalse(normalize_tokenizer_config(Path(td), lambda line: None)) + after = config_path.read_text(encoding="utf-8") + + self.assertEqual(after, before) + + def test_missing_or_malformed_config_is_safe(self): + with tempfile.TemporaryDirectory() as td: + root = Path(td) + self.assertFalse(normalize_tokenizer_config(root, lambda line: None)) + config_path = self._write_config(root, "{not json") + self.assertFalse(normalize_tokenizer_config(root, lambda line: None)) + self.assertEqual(config_path.read_text(encoding="utf-8"), "{not json") + + def test_krea2_patch_normalizes_before_pointing_at_the_dir(self): + with tempfile.TemporaryDirectory() as td: + root = Path(td) + source_root = root / "musubi" + encoder_dir = source_root / "src" / "musubi_tuner" / "krea2" + encoder_dir.mkdir(parents=True) + (encoder_dir / "krea2_encoder.py").write_text(Krea2TokenizerPatchTests.ENCODER, encoding="utf-8") + tokenizer_dir = root / "tokenizer" + tokenizer_dir.mkdir() + (tokenizer_dir / "tokenizer.json").write_text("{}", encoding="utf-8") + (tokenizer_dir / "tokenizer_config.json").write_text( + json.dumps({"extra_special_tokens": ["<|a|>"]}), encoding="utf-8" + ) + + self.assertTrue(patch_krea2_tokenizer_path(source_root, tokenizer_dir, lambda line: None)) + payload = json.loads((tokenizer_dir / "tokenizer_config.json").read_text(encoding="utf-8")) + + self.assertEqual(payload["extra_special_tokens"], {"additional_special_tokens": ["<|a|>"]}) + + if __name__ == "__main__": unittest.main() From 9ccb9c0153023db66deeec559bd5b8aa96984098 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 18:43:33 +0800 Subject: [PATCH 04/89] fix(anima): reject Anima 2.9B on the Kohya engine before launch (#408) vendor/sd-scripts builds the Anima DiT with num_blocks=28, so a 2.9B checkpoint only failed later with a wall of 'Unexpected keys ... blocks.28.*' names and the user could not tell they picked the wrong engine. validate_model now reads the safetensors header (no weights, no GPU), counts DiT blocks and returns an actionable message pointing at Anima Fast; unreadable headers are not treated as 2.9B and the Anima Fast path is untouched. --- mikazuki/utils/train_utils.py | 46 +++++++++++++++- tests/test_anima_kohya_guard.py | 95 +++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 tests/test_anima_kohya_guard.py diff --git a/mikazuki/utils/train_utils.py b/mikazuki/utils/train_utils.py index 2af0fd87b..9ca6ee540 100644 --- a/mikazuki/utils/train_utils.py +++ b/mikazuki/utils/train_utils.py @@ -5,7 +5,7 @@ import shutil import sys import json -from typing import Dict +from typing import Dict, Optional import toml @@ -268,6 +268,35 @@ def read_safetensors_metadata(path) -> Dict: return json.loads(meta) +# vendor/sd-scripts/library/anima_utils.py builds the Anima DiT with num_blocks=28; +# a 2.9B checkpoint carries more blocks and can only be trained by Anima Fast (#408). +KOHYA_ANIMA_MAX_BLOCKS = 28 + + +def anima_checkpoint_block_count(path) -> Optional[int]: + """DiT block count from a safetensors header, or None when unreadable / not Anima. + + Reads only the JSON header: cheap, and never loads weights or touches the GPU. + """ + try: + metadata = read_safetensors_metadata(path) + except Exception: # noqa: BLE001 - a broken header simply means "cannot tell" + return None + if not isinstance(metadata, dict): + return None + highest = None + for key in metadata: + if not isinstance(key, str): + continue + match = re.match(r"^blocks\.(\d+)\.", key) + if match is None: + continue + index = int(match.group(1)) + if highest is None or index > highest: + highest = index + return None if highest is None else highest + 1 + + def guess_model_type(path): if path.endswith("safetensors"): metadata = read_safetensors_metadata(path) @@ -286,6 +315,21 @@ def guess_model_type(path): def validate_model(model_name: str, training_type: str = "sd-lora"): if training_type in ["anima-lora", "sd3-lora", "anima-finetune"]: + # vendor/sd-scripts/library/anima_utils.py hardcodes num_blocks=28, so an + # Anima 2.9B checkpoint only fails later with a wall of "Unexpected keys ... + # blocks.28.*" names. Detect it from the safetensors header (no weights, no + # GPU) and point the user at the engine that supports it (#408). + if os.path.isfile(model_name) and str(model_name).lower().endswith(".safetensors"): + try: + blocks = anima_checkpoint_block_count(model_name) + except Exception as exc: # noqa: BLE001 - unreadable headers surface in the trainer + log.warning(f"Can't inspect model file {model_name}: {exc}") + blocks = None + if blocks is not None and blocks > KOHYA_ANIMA_MAX_BLOCKS: + return False, ( + f"检测到 Anima 2.9B 底模({blocks} 个 block),Kohya 引擎不支持该规格。" + "请改用 Anima Fast 引擎(可在「设置 → 训练引擎」中安装),或改用 Anima 2B 底模。" + ) return True, "ok" if os.path.exists(model_name): diff --git a/tests/test_anima_kohya_guard.py b/tests/test_anima_kohya_guard.py new file mode 100644 index 000000000..94cdf91cb --- /dev/null +++ b/tests/test_anima_kohya_guard.py @@ -0,0 +1,95 @@ +"""#408: Kohya must reject Anima 2.9B checkpoints before the trainer starts.""" + +from __future__ import annotations + +import json +import tempfile +import unittest +from pathlib import Path + +from mikazuki.utils.train_utils import ( + KOHYA_ANIMA_MAX_BLOCKS, + anima_checkpoint_block_count, + validate_model, +) + + +def write_safetensors_header(path: Path, tensor_names: list[str]) -> None: + """A safetensors file with a real header and no tensor data is enough for the + header-only guard, which never reads weights.""" + payload = { + name: {"dtype": "F16", "shape": [1], "data_offsets": [0, 2]} + for name in tensor_names + } + blob = json.dumps(payload).encode("utf-8") + with open(path, "wb") as handle: + handle.write(len(blob).to_bytes(8, "little")) + handle.write(blob) + + +def anima_like_names(blocks: int) -> list[str]: + names = ["input_embed.weight", "final_layer.linear.weight"] + for index in range(blocks): + names.append(f"blocks.{index}.adaln_modulation_caption.1.weight") + names.append(f"blocks.{index}.attention.qkv.weight") + return names + + +class AnimaBlockCountTests(unittest.TestCase): + def test_counts_blocks_from_the_header(self): + with tempfile.TemporaryDirectory() as td: + model = Path(td) / "anima2b.safetensors" + write_safetensors_header(model, anima_like_names(28)) + + self.assertEqual(anima_checkpoint_block_count(model), 28) + + def test_unreadable_or_foreign_files_return_none(self): + with tempfile.TemporaryDirectory() as td: + root = Path(td) + self.assertIsNone(anima_checkpoint_block_count(root / "missing.safetensors")) + text = root / "not_a_checkpoint.safetensors" + text.write_text("SDXL base model", encoding="utf-8") + self.assertIsNone(anima_checkpoint_block_count(text)) + + +class KohyaAnimaGuardTests(unittest.TestCase): + def test_kohya_rejects_2_9b_with_actionable_message(self): + with tempfile.TemporaryDirectory() as td: + model = Path(td) / "whatever-name.safetensors" + write_safetensors_header(model, anima_like_names(KOHYA_ANIMA_MAX_BLOCKS + 1)) + + ok, message = validate_model(str(model), "anima-lora") + + self.assertFalse(ok) + self.assertIn("2.9B", message) + self.assertIn("Anima Fast", message) + + def test_kohya_accepts_2b(self): + with tempfile.TemporaryDirectory() as td: + model = Path(td) / "anima2b.safetensors" + write_safetensors_header(model, anima_like_names(KOHYA_ANIMA_MAX_BLOCKS)) + + self.assertEqual(validate_model(str(model), "anima-lora"), (True, "ok")) + + def test_anima_fast_is_not_blocked_by_this_check(self): + """The guard lives in the Kohya branch only: the Fast engine runs through its + own adapter and never calls validate_model, so a 2.9B checkpoint must not be + rejected with the Kohya message here.""" + with tempfile.TemporaryDirectory() as td: + model = Path(td) / "anima29b.safetensors" + write_safetensors_header(model, anima_like_names(KOHYA_ANIMA_MAX_BLOCKS + 1)) + + _ok, message = validate_model(str(model), "anima-lora-fast") + + self.assertNotIn("Kohya 引擎不支持", message) + + def test_broken_or_unrecognised_weights_are_not_reported_as_2_9b(self): + with tempfile.TemporaryDirectory() as td: + model = Path(td) / "broken.safetensors" + model.write_bytes(b"\x00\x01\x02\x03") + + self.assertEqual(validate_model(str(model), "anima-lora"), (True, "ok")) + + +if __name__ == "__main__": + unittest.main() From 5cb57052003bbd6fe98680b8b61c17ef9fb75708 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 18:43:33 +0800 Subject: [PATCH 05/89] fix(diffsynth): content-based runtime fingerprint with legacy migration (#410) The fingerprint mixed in size+mtime_ns, so cloud images, Docker layers, backups and directory copies reported a healthy install as broken and pushed users into a multi-GB repair. It now hashes content (timestamps excluded, files >8 MiB pinned by size, symlinks by target), stores the scheme alongside the hash, and migrates a legacy state once instead of failing it; content changes are still detected. --- mikazuki/engines/diffsynth/extension_state.py | 65 +++++++-- mikazuki/engines/diffsynth/install_worker.py | 4 +- tests/test_diffsynth_fingerprint.py | 126 ++++++++++++++++++ 3 files changed, 183 insertions(+), 12 deletions(-) create mode 100644 tests/test_diffsynth_fingerprint.py diff --git a/mikazuki/engines/diffsynth/extension_state.py b/mikazuki/engines/diffsynth/extension_state.py index c1e090dcd..565a936fa 100644 --- a/mikazuki/engines/diffsynth/extension_state.py +++ b/mikazuki/engines/diffsynth/extension_state.py @@ -1,10 +1,19 @@ import json import hashlib +import os import subprocess from .settings import TRAIN_SCRIPT, feature_enabled +# Bumped whenever the ingredient list or hashing changes. A state file written +# with an older scheme is migrated once instead of being reported as broken. +FINGERPRINT_SCHEME = "content-v2" +# Files larger than this are pinned by size alone: hashing multi-GB weights on +# every status poll is wasteful, and those entries are never user-edited. +FINGERPRINT_MAX_HASH_BYTES = 8 * 1024 * 1024 + + def write_state(runtime, state, facts=None, reason=""): runtime.root.mkdir(parents=True, exist_ok=True) temporary = runtime.state_file.with_suffix(".tmp") @@ -12,21 +21,47 @@ def write_state(runtime, state, facts=None, reason=""): temporary.replace(runtime.state_file) +def _fingerprint_entry(path, runtime): + try: + identity = path.relative_to(runtime.root).as_posix() + except ValueError: + identity = path.name + if path.is_symlink(): + stat = path.lstat() + return [identity, stat.st_size, "symlink", os.readlink(path)] + stat = path.stat() + if stat.st_size > FINGERPRINT_MAX_HASH_BYTES: + return [identity, stat.st_size, "size", ""] + digest = hashlib.sha256() + with open(path, "rb") as handle: + for chunk in iter(lambda: handle.read(1024 * 1024), b""): + digest.update(chunk) + return [identity, stat.st_size, "sha256", digest.hexdigest()] + + def fingerprint(runtime): + """Content-based fingerprint of the runtime (#410). + + Timestamps are excluded on purpose: cloud images, Docker layers, backups and + plain directory copies rewrite mtimes without touching the environment, and a + timestamp-only difference used to report a healthy install as broken, pushing + users into a multi-GB repair. Content hashes still catch same-length edits. + """ files = [runtime.python, runtime.source / TRAIN_SCRIPT, runtime.source / "pyproject.toml"] files += sorted(runtime.source.glob("diffsynth/**/*.py")) files += sorted((runtime.root / ".venv").glob("**/*.dist-info/METADATA")) - stats = [] + entries = [] for path in files: - if not path.is_file(): + if not path.is_file() and not path.is_symlink(): continue - try: - identity = path.relative_to(runtime.root).as_posix() - except ValueError: - identity = path.name - stats.append((identity, path.stat().st_size, path.stat().st_mtime_ns)) + entries.append(_fingerprint_entry(path, runtime)) head = subprocess.run(["git", "-C", str(runtime.source), "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip() - return hashlib.sha256(json.dumps([head, stats]).encode()).hexdigest() + return hashlib.sha256(json.dumps([FINGERPRINT_SCHEME, head, entries]).encode()).hexdigest() + + +def fingerprint_facts(runtime): + """Facts to persist next to a ready state (hash + the scheme that produced it).""" + return {"fingerprint": fingerprint(runtime), "fingerprint_scheme": FINGERPRINT_SCHEME} def read_status(runtime): @@ -38,8 +73,18 @@ def read_status(runtime): data.update(state="broken", reason="安装中断,请修复 DiffSynth 环境。") if data["state"] == "ready" and not (runtime.python.is_file() and (runtime.source / TRAIN_SCRIPT).is_file()): data.update(state="broken", reason="训练入口或独立 Python 缺失,请修复环境。") - if data["state"] == "ready" and data["facts"].get("fingerprint") != fingerprint(runtime): - data.update(state="broken", reason="环境或源码已变化,请修复后重新检查。") + if data["state"] == "ready": + stored = data["facts"].get("fingerprint") + current = fingerprint(runtime) + if stored is None or data["facts"].get("fingerprint_scheme") != FINGERPRINT_SCHEME: + # Legacy state (no scheme / size+mtime hash): its hash cannot be compared + # with the content scheme, and the mtime rewrites this issue is about are + # exactly what produced a false mismatch. The runtime is present (checked + # above), so refresh once instead of sending the user into a reinstall. + data["facts"].update({"fingerprint": current, "fingerprint_scheme": FINGERPRINT_SCHEME}) + write_state(runtime, "ready", data["facts"], data.get("reason", "")) + elif stored != current: + data.update(state="broken", reason="环境或源码已变化,请修复后重新检查。") data["feature_enabled"] = feature_enabled() if not data["feature_enabled"]: data["state"] = "disabled" diff --git a/mikazuki/engines/diffsynth/install_worker.py b/mikazuki/engines/diffsynth/install_worker.py index a5bbfbcb3..71b319c61 100644 --- a/mikazuki/engines/diffsynth/install_worker.py +++ b/mikazuki/engines/diffsynth/install_worker.py @@ -7,7 +7,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[3])) from mikazuki.engines.diffsynth.environment import install_env, audit_environment -from mikazuki.engines.diffsynth.extension_state import write_state, fingerprint +from mikazuki.engines.diffsynth.extension_state import fingerprint_facts, write_state from mikazuki.engines.diffsynth.manifest import UPSTREAM from mikazuki.engines.diffsynth.resource import environment_lock from mikazuki.engines.diffsynth.settings import Runtime @@ -35,7 +35,7 @@ def main(): print(json.dumps(audit, ensure_ascii=False), flush=True) if not audit['ok']: raise RuntimeError('; '.join(audit['errors'])) - write_state(rt, 'ready', {**facts, 'audit': audit, 'source_commit': UPSTREAM['commit'], 'fingerprint': fingerprint(rt)}) + write_state(rt, 'ready', {**facts, 'audit': audit, 'source_commit': UPSTREAM['commit'], **fingerprint_facts(rt)}) print('[mikazuki-progress] ' + json.dumps({'percent': 100, 'message': '环境检查完成'}, ensure_ascii=False), flush=True) except Exception as exc: write_state(rt, 'broken', facts, str(exc)) diff --git a/tests/test_diffsynth_fingerprint.py b/tests/test_diffsynth_fingerprint.py new file mode 100644 index 000000000..a9b3ea2c3 --- /dev/null +++ b/tests/test_diffsynth_fingerprint.py @@ -0,0 +1,126 @@ +"""#410: the DiffSynth runtime fingerprint must not depend on file timestamps.""" + +from __future__ import annotations + +import json +import os +import tempfile +import unittest +from pathlib import Path + +from mikazuki.engines.diffsynth.extension_state import ( + FINGERPRINT_SCHEME, + fingerprint, + read_status, + write_state, +) +from mikazuki.engines.diffsynth.settings import TRAIN_SCRIPT, Runtime + + +def make_runtime(project_root: Path) -> Runtime: + runtime = Runtime(project_root) + (runtime.source / "diffsynth" / "models").mkdir(parents=True, exist_ok=True) + (runtime.source / TRAIN_SCRIPT).parent.mkdir(parents=True, exist_ok=True) + (runtime.source / TRAIN_SCRIPT).write_text("print('train')\n", encoding="utf-8") + (runtime.source / "pyproject.toml").write_text("[project]\nname = 'diffsynth'\n", encoding="utf-8") + (runtime.source / "diffsynth" / "models" / "model.py").write_text("x = 1\n", encoding="utf-8") + runtime.python.parent.mkdir(parents=True, exist_ok=True) + runtime.python.write_text("#!/python\n", encoding="utf-8") + metadata = runtime.root / ".venv" / "lib" / "torch-2.8.0.dist-info" + metadata.mkdir(parents=True, exist_ok=True) + (metadata / "METADATA").write_text("Name: torch\nVersion: 2.8.0\n", encoding="utf-8") + return runtime + + +class FingerprintContentTests(unittest.TestCase): + def test_mtime_only_changes_keep_the_fingerprint(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + before = fingerprint(runtime) + + for path in ( + runtime.source / TRAIN_SCRIPT, + runtime.source / "diffsynth" / "models" / "model.py", + runtime.root / ".venv" / "lib" / "torch-2.8.0.dist-info" / "METADATA", + ): + stat = path.stat() + os.utime(path, ns=(stat.st_atime_ns, stat.st_mtime_ns + 5_000_000_000)) + + self.assertEqual(fingerprint(runtime), before) + + def test_same_length_content_change_is_detected(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + source = runtime.source / "diffsynth" / "models" / "model.py" + before = fingerprint(runtime) + + source.write_text("x = 2\n", encoding="utf-8") + + self.assertNotEqual(fingerprint(runtime), before) + + def test_symlinked_python_is_fingerprinted_by_target(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + target = Path(td) / "outside-python" + target.write_text("#!/python\n", encoding="utf-8") + runtime.python.unlink() + try: + runtime.python.symlink_to(target) + except (OSError, NotImplementedError): + self.skipTest("symlinks unavailable on this platform") + + self.assertEqual(len(fingerprint(runtime)), 64) + + +class FingerprintMigrationTests(unittest.TestCase): + def test_legacy_state_is_refreshed_instead_of_broken(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + # State written before the content scheme: hash of the old ingredients, + # no scheme marker at all. + write_state(runtime, "ready", {"fingerprint": "0" * 64, "source_commit": "abc"}, "audit passed") + + status = read_status(runtime) + persisted = json.loads(runtime.state_file.read_text(encoding="utf-8")) + + self.assertEqual(status["state"], "ready") + self.assertEqual(status["facts"]["fingerprint_scheme"], FINGERPRINT_SCHEME) + self.assertEqual(persisted["facts"]["fingerprint_scheme"], FINGERPRINT_SCHEME) + self.assertEqual(persisted["facts"]["source_commit"], "abc") + + def test_matching_state_stays_ready_without_rewriting(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + write_state(runtime, "ready", {"fingerprint": fingerprint(runtime), "fingerprint_scheme": FINGERPRINT_SCHEME}, "") + before = runtime.state_file.read_text(encoding="utf-8") + + status = read_status(runtime) + after = runtime.state_file.read_text(encoding="utf-8") + + self.assertEqual(status["state"], "ready") + self.assertEqual(after, before) + + def test_current_scheme_mismatch_is_still_broken(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + write_state(runtime, "ready", {"fingerprint": "0" * 64, "fingerprint_scheme": FINGERPRINT_SCHEME}, "") + + status = read_status(runtime) + + self.assertEqual(status["state"], "broken") + self.assertIn("已变化", status["reason"]) + + def test_missing_runtime_files_are_still_broken(self): + with tempfile.TemporaryDirectory() as td: + runtime = make_runtime(Path(td)) + write_state(runtime, "ready", {"fingerprint": fingerprint(runtime), "fingerprint_scheme": FINGERPRINT_SCHEME}, "") + (runtime.source / TRAIN_SCRIPT).unlink() + + status = read_status(runtime) + + self.assertEqual(status["state"], "broken") + self.assertIn("训练入口", status["reason"]) + + +if __name__ == "__main__": + unittest.main() From 9c0ba26c88c36604006cad38e815e00db0f3cfec Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 18:43:47 +0800 Subject: [PATCH 06/89] docs: changelog entries for the first batch of recent bug fixes --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 106f2c2b8..dee1868d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ (下一个开发周期:AI Toolkit 模型格式与训练体验,详见 docs/roadmap.md) +### 修复(近一个月 issue 第一批) + +- **Krea2 tokenizer 的 `extra_special_tokens` 为 list 时加载失败(#416)**:探测/下载/启动前会把旧的 list 形态规范化为 transformers 期望的 mapping,手动放置的 tokenizer 同样会被治好 +- **Kohya 加载 Anima 2.9B 前明确拦截(#408)**:只读 safetensors 头部统计 block 数,超过 28 即拒绝并提示改用 Anima Fast,不再等到加载时抛一串 `blocks.28.*` 权重名 +- **DiffSynth 指纹不再含 mtime(#410)**:目录拷贝 / 云镜像 / 备份还原导致的时间戳变化不再误报环境异常;旧状态一次性迁移,不要求重装;内容改动仍能识别 + --- ## v3.2.0 — 2026-10-11 From 15b15cee3b1ee428680694252a426b8f3be7f2bb Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 19:06:49 +0800 Subject: [PATCH 07/89] fix(diffsynth): do not resolve the leaf symlink before the weight suffix check (#390) absolute() called Path.resolve(), so an AutoDL-style '*.safetensors' name that points at an extension-less real file lost its suffix and weight_files() rejected a perfectly valid path. Normalise without following symlinks instead; the suffix check stays strict for genuinely wrong paths. --- mikazuki/engines/diffsynth/inputs.py | 9 +++++- tests/test_diffsynth_symlink_paths.py | 46 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/test_diffsynth_symlink_paths.py diff --git a/mikazuki/engines/diffsynth/inputs.py b/mikazuki/engines/diffsynth/inputs.py index 13485a73c..0795ae8e7 100644 --- a/mikazuki/engines/diffsynth/inputs.py +++ b/mikazuki/engines/diffsynth/inputs.py @@ -3,6 +3,7 @@ import hashlib import json import math +import os from .formats import conversion_plan import re @@ -21,7 +22,13 @@ def __init__(self, field, message, path=None): def absolute(value, root): path = Path(str(value)).expanduser() - return (path if path.is_absolute() else root / path).resolve() + if not path.is_absolute(): + path = root / path + # Deliberately not resolve(): AutoDL-style mounts expose a '*.safetensors' + # name that points at an extension-less real file, and weight_files() checks + # the suffix of the name the user picked (#390). normpath/abspath still + # normalise '..' and relative roots without touching the filesystem. + return Path(os.path.abspath(str(path))) def required_path(config, key, root): diff --git a/tests/test_diffsynth_symlink_paths.py b/tests/test_diffsynth_symlink_paths.py new file mode 100644 index 000000000..1c5c6e4a7 --- /dev/null +++ b/tests/test_diffsynth_symlink_paths.py @@ -0,0 +1,46 @@ +"""#390: AutoDL-style mounts name a *.safetensors link over an extension-less file.""" + +from __future__ import annotations + +import pytest + +from mikazuki.engines.diffsynth.inputs import InputError, absolute, weight_files + + +def _symlink_or_skip(link, target): + try: + link.symlink_to(target) + except (OSError, NotImplementedError): + pytest.skip("symlinks unavailable on this platform") + + +def test_symlinked_safetensors_name_survives_absolute(tmp_path): + target = tmp_path / "autodl-hash-file" # real file without an extension + target.write_bytes(b"\x00" * 32) + link = tmp_path / "qwen_image_2.1_bf16.safetensors" + _symlink_or_skip(link, target) + + path = absolute(str(link), tmp_path) + + assert path.name == "qwen_image_2.1_bf16.safetensors" + assert weight_files(path, "dit_path") == [path] + + +def test_relative_path_with_parent_segments_is_still_normalised(tmp_path): + model = tmp_path / "sd-models" / "qwen" / "dit.safetensors" + model.parent.mkdir(parents=True) + model.write_bytes(b"\x00" * 8) + + path = absolute("sd-models/qwen/../qwen/dit.safetensors", tmp_path) + + assert path == model + assert path.is_absolute() + + +def test_extension_less_target_without_a_link_still_fails(tmp_path): + """The suffix check must stay strict for genuinely wrong paths.""" + plain = tmp_path / "autodl-hash-file" + plain.write_bytes(b"\x00" * 8) + + with pytest.raises(InputError): + weight_files(absolute(str(plain), tmp_path), "dit_path") From 3fd09ad741889e1d938b49f577af2e45888311ef Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 19:06:49 +0800 Subject: [PATCH 08/89] fix(api): unique autosave snapshot name for single submissions (#334) /api/run named the snapshot from the second alone, so two submissions inside the same second shared one file and the later write silently replaced the config the earlier task was about to read (agents submit back-to-back). The batch endpoint already carried a random suffix; single runs now use the same scheme. --- mikazuki/app/api.py | 6 +++++- tests/test_batch_enqueue.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mikazuki/app/api.py b/mikazuki/app/api.py index 347c20e06..9c7a6a6a0 100644 --- a/mikazuki/app/api.py +++ b/mikazuki/app/api.py @@ -241,7 +241,11 @@ async def normalize_export_config(request: Request): @router.post("/run") async def create_toml_file(request: Request): - timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") + # Per-request random component: two submissions inside the same second must + # not share the autosave snapshot name, or the later write silently replaces + # the config the earlier task is about to read (#334). Same scheme as the + # batch endpoint below. + timestamp = f"{datetime.now().strftime('%Y%m%d-%H%M%S')}-{uuid.uuid4().hex[:4]}" autosave_dir = os.path.join(os.getcwd(), "config", "autosave") os.makedirs(autosave_dir, exist_ok=True) json_data = await request.body() diff --git a/tests/test_batch_enqueue.py b/tests/test_batch_enqueue.py index 463c55d10..6effe15bd 100644 --- a/tests/test_batch_enqueue.py +++ b/tests/test_batch_enqueue.py @@ -222,3 +222,33 @@ def fake_dispatch(model_train_type, config, ctx): # per-request autosave timestamps handed to the engine. self.assertEqual(len(dispatched), 2) self.assertEqual(len(set(dispatched)), 2) + +class SingleRunAutosaveUniquenessTests(unittest.TestCase): + """#334: a single submission must not reuse another one's snapshot name.""" + + def test_same_second_single_runs_get_distinct_timestamps(self): + import json as _json + import tempfile + + class _Request: + def __init__(self, payload): + self._payload = payload + + async def body(self): + return self._payload + + dispatched = [] + + def fake_dispatch(model_train_type, config, ctx): + dispatched.append(ctx.timestamp) + return APIResponseSuccess(data={"task_id": "t"}) + + payload = _json.dumps({"model_train_type": "sd-lora", "output_name": "x"}).encode("utf-8") + with tempfile.TemporaryDirectory() as td, mock.patch.object(api, "dispatch_run", side_effect=fake_dispatch), mock.patch.object(api, "ensure_unique_output_name", return_value=None), mock.patch("mikazuki.app.api.os.getcwd", return_value=td): + asyncio.run(api.create_toml_file(_Request(payload))) + asyncio.run(api.create_toml_file(_Request(payload))) + + self.assertEqual(len(dispatched), 2) + self.assertEqual(len(set(dispatched)), 2) + for timestamp in dispatched: + self.assertRegex(timestamp, r"^\d{8}-\d{6}-[0-9a-f]{4}$") From 747e7f156304e2f09a0574c412a767cd510cdda5 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 19:08:07 +0800 Subject: [PATCH 09/89] fix(anima-fast): warn when batch size will make bucket sampling drop images (#338) Upstream bucket sampling only batches inside one bucket, so small aspect-ratio heavy datasets silently lose most images (one WARNING deep in the launch log) while the run finishes normally with far fewer steps. The preflight now says so up front, with the usual mitigations. #333 (caption_dropout_rate baked into the TE cache) is documented as a known limitation until the upstream cache key is versioned. --- CHANGELOG.md | 7 ++++++ docs/dev-progress.md | 7 ++++++ mikazuki/engines/anima_fast/preflight.py | 32 ++++++++++++++++++++++++ tests/test_anima_fast_bucket_warning.py | 31 +++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 tests/test_anima_fast_bucket_warning.py diff --git a/CHANGELOG.md b/CHANGELOG.md index dee1868d7..4bb50643f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ (下一个开发周期:AI Toolkit 模型格式与训练体验,详见 docs/roadmap.md) +### 修复(近一个月 issue 第二批) + +- **DiffSynth 软链权重误报(#390)**:路径规范化不再跟随叶子软链,AutoDL 那类「`*.safetensors` 名字指向无后缀实体」的挂载不再被后缀校验拒绝 +- **单条提交的 autosave 快照重名(#334)**:`/api/run` 的配置快照名加入随机后缀,同一秒内连续提交不再互相覆盖(批量提交此前已修) +- **anima-fast 小数据集丢图提示(#338)**:预检在「图片数偏少 + train_batch_size>1」时明确警告上游 bucket 采样会整桶丢弃图片(及 1 batch 步数远低于预期的原因),并给出 batch_size=1 / num_repeats / bucket_reso_steps / validation_split_num 的处理建议 +- **Anima TE 缓存固化 caption_dropout_rate(#333)**:先在文档中写明「改动该值需删除 `_anima_te.npz` 再重训」的限制;上游缓存键的一致性校验待跟进 + ### 修复(近一个月 issue 第一批) - **Krea2 tokenizer 的 `extra_special_tokens` 为 list 时加载失败(#416)**:探测/下载/启动前会把旧的 list 形态规范化为 transformers 期望的 mapping,手动放置的 tokenizer 同样会被治好 diff --git a/docs/dev-progress.md b/docs/dev-progress.md index faa2b1cec..9e35636e3 100644 --- a/docs/dev-progress.md +++ b/docs/dev-progress.md @@ -73,6 +73,13 @@ Anima 底模选择适用于 Kohya LoRA、Anima Fast LoRA 和 Anima 全量微调 详细环境、参数和平台限制以 [DiffSynth 指南](diffsynth.md) 为准。 +### Anima 的 TE 输出缓存(#333 已记录的限制) + +Anima(Kohya)开启文本编码器输出缓存后,`caption_dropout_rate` 会被固化进 `_anima_te.npz`,训练时从缓存读取, +**改动该值不会生效且没有任何提示**。改动 caption dropout(或 shuffle/keep_tokens 等影响 TE 输出的项)后, +请删除数据集目录下的 `_anima_te.npz` 缓存再重训;上游缓存键的一致性校验仍待跟进。 + + ## 界面参考 以下为历史界面截图,用于说明工作流程,不代表当前页面逐像素外观;数据集管理首页、标签编辑页与引擎列表已更新。 diff --git a/mikazuki/engines/anima_fast/preflight.py b/mikazuki/engines/anima_fast/preflight.py index 3ec93b242..ae552c99a 100644 --- a/mikazuki/engines/anima_fast/preflight.py +++ b/mikazuki/engines/anima_fast/preflight.py @@ -270,6 +270,31 @@ def _int_value(value: Any, default: int = 0) -> int: return default +# Below this image count, batch sizes > 1 are likely to hit upstream bucket +# sampling, which drops every bucket holding fewer images than a batch (#338). +BUCKET_DROP_HINT_MAX_IMAGES = 500 + + +def bucket_drop_warning(image_count: int, batch_size: int, validation_split: int) -> str | None: + """Warn when small datasets are likely to lose most images to bucket sampling. + + The upstream sampler only forms batches inside one bucket, so images spread + over many aspect-ratio buckets are silently skipped (a single WARNING in the + launch log) and the run still finishes "normally". Surface it before launch. + """ + training_images = image_count - max(0, validation_split) + if batch_size <= 1 or image_count <= 0 or training_images <= 0: + return None + if image_count >= BUCKET_DROP_HINT_MAX_IMAGES: + return None + return ( + f"数据集只有 {image_count} 张图,而 train_batch_size={batch_size}:上游 bucket 采样只会在同一个桶内" + "组 batch,图片数不足一个 batch 的桶会被整桶丢弃(启动日志里只有一条 WARNING),宽高比差异大时可能" + "有大半图片完全不参与训练、步数也远低于预期。小数据集建议 train_batch_size=1,或提高 num_repeats、" + "放宽 bucket_reso_steps 合并近邻桶;把 validation_split_num 调到 0 可避免验证集图片白扣。" + ) + + def _resolve(value: Any, base: Path) -> Path | None: if value is None or str(value).strip() == "": return None @@ -571,6 +596,13 @@ def run_preflight(config: dict[str, Any], runtime: RuntimeConfig, probe: Depende captioned = sum(1 for image in images if image.with_suffix(".txt").is_file()) if images and captioned < len(images): warnings.append(f"{len(images) - captioned} image(s) do not have .txt captions") + drop_hint = bucket_drop_warning( + len(images), + _int_value(config.get("train_batch_size") or config.get("batch_size"), 1), + _int_value(config.get("validation_split_num"), 0), + ) + if drop_hint: + warnings.append(drop_hint) blocks_to_swap = _int_value(config.get("blocks_to_swap"), 0) cpu_offload = _truthy(config.get("cpu_offload_checkpointing")) diff --git a/tests/test_anima_fast_bucket_warning.py b/tests/test_anima_fast_bucket_warning.py new file mode 100644 index 000000000..b5207ff48 --- /dev/null +++ b/tests/test_anima_fast_bucket_warning.py @@ -0,0 +1,31 @@ +"""#338: warn small datasets whose batch size will make bucket sampling drop images.""" + +from __future__ import annotations + +from mikazuki.engines.anima_fast.preflight import ( + BUCKET_DROP_HINT_MAX_IMAGES, + bucket_drop_warning, +) + + +def test_small_dataset_with_batch_size_above_one_is_flagged(): + warning = bucket_drop_warning(100, 4, 16) + + assert warning is not None + assert "100 张图" in warning + assert "train_batch_size=1" in warning + assert "桶" in warning + + +def test_batch_size_one_is_never_flagged(): + assert bucket_drop_warning(100, 1, 16) is None + + +def test_large_datasets_are_not_flagged(): + assert bucket_drop_warning(BUCKET_DROP_HINT_MAX_IMAGES, 4, 16) is None + assert bucket_drop_warning(BUCKET_DROP_HINT_MAX_IMAGES + 2000, 4, 16) is None + + +def test_degenerate_inputs_are_not_flagged(): + assert bucket_drop_warning(0, 4, 0) is None + assert bucket_drop_warning(10, 4, 10) is None # validation split ate the dataset From 8b066218d1eae267a0db56236da0ff1c9607543b Mon Sep 17 00:00:00 2001 From: wochenlong Date: Mon, 12 Oct 2026 19:52:22 +0800 Subject: [PATCH 10/89] feat(portable): Windows launcher NextTrainer.exe for the 2026 packages (#435) A thin C# (NativeAOT, ~5 MB, no .NET runtime needed) shell over the existing portable layout: it delegates app startup to launch_portable.bat (which owns the embedded-Python environment policy), opens the browser once the GUI port answers, and owns the process tree. Keys: Q stops the tree, U stops + runs the package updater + offers to restart. Missing pieces produce a readable Chinese error instead of a console that vanishes. --selftest starts, waits for the port, stops and reports an exit code so packaging CI can assert it end-to-end. The .bat entries stay as the fallback entry points. --- .gitignore | 4 + CHANGELOG.md | 4 + build-scripts/06-build-launcher.ps1 | 28 +++ build-scripts/build_portable_2026_full.ps1 | 4 + docs/portable-getting-started.md | 11 + launcher/NextTrainer.Launcher.csproj | 16 ++ launcher/Program.cs | 249 +++++++++++++++++++++ 7 files changed, 316 insertions(+) create mode 100644 build-scripts/06-build-launcher.ps1 create mode 100644 launcher/NextTrainer.Launcher.csproj create mode 100644 launcher/Program.cs diff --git a/.gitignore b/.gitignore index 51584393f..8901f682b 100644 --- a/.gitignore +++ b/.gitignore @@ -148,3 +148,7 @@ extensions/diffsynth/ # User-owned settings, credentials, presets and task archives. /user_data/ + +# launcher (.NET) build artifacts +launcher/bin/ +launcher/obj/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb50643f..11ffdb656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ (下一个开发周期:AI Toolkit 模型格式与训练体验,详见 docs/roadmap.md) +### 新增 + +- **Windows 启动器 `NextTrainer.exe`(#435)**:放在整合包根目录(与 `启动.bat` 并存)。双击启动等价于 `启动.bat`,但接管进程树:关窗 / `Q` 真正停掉服务,端口占用或启动失败给中文提示,`U` 一键更新(先停服 → 运行更新脚本 → `R` 重启)。C# NativeAOT 编译(约 5 MB,无 .NET 运行时依赖)。构建脚本 `build-scripts/06-build-launcher.ps1`,已接入 `build_portable_2026_full.ps1` 的打包流程 + ### 修复(近一个月 issue 第二批) - **DiffSynth 软链权重误报(#390)**:路径规范化不再跟随叶子软链,AutoDL 那类「`*.safetensors` 名字指向无后缀实体」的挂载不再被后缀校验拒绝 diff --git a/build-scripts/06-build-launcher.ps1 b/build-scripts/06-build-launcher.ps1 new file mode 100644 index 000000000..95ba05673 --- /dev/null +++ b/build-scripts/06-build-launcher.ps1 @@ -0,0 +1,28 @@ +#Requires -Version 5.1 +<# +.SYNOPSIS + Compile the NextTrainer.exe launcher (NativeAOT) and place it at the portable + package root, next to the existing .bat fallbacks (#435). +#> +param( + [Parameter(Mandatory = $true)][string]$PackageRoot +) + +$ErrorActionPreference = "Stop" +$repoRoot = Split-Path $PSScriptRoot -Parent +$project = Join-Path $repoRoot "launcher" +$outDir = Join-Path $env:TEMP "nexttrainer-launcher" + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (-not $dotnet) { + Write-Warning "dotnet SDK 未安装,跳过启动器编译(包内仍保留 .bat 入口)。请安装 .NET 9 SDK 后重跑。" + return +} + +& dotnet publish $project -c Release -r win-x64 -p:PublishAot=true -o $outDir +if ($LASTEXITCODE -ne 0) { throw "dotnet publish launcher failed (exit $LASTEXITCODE)" } + +$exe = Join-Path $outDir "NextTrainer.exe" +if (-not (Test-Path $exe)) { throw "launcher exe missing after publish: $exe" } +Copy-Item -LiteralPath $exe -Destination (Join-Path $PackageRoot "NextTrainer.exe") -Force +Write-Host " launcher -> $(Join-Path $PackageRoot 'NextTrainer.exe')" diff --git a/build-scripts/build_portable_2026_full.ps1 b/build-scripts/build_portable_2026_full.ps1 index c1ae7bda3..e23682b95 100644 --- a/build-scripts/build_portable_2026_full.ps1 +++ b/build-scripts/build_portable_2026_full.ps1 @@ -134,6 +134,10 @@ if (-not $SkipMusubi) { Write-Log "[4/5] Applying 2026 root (启动 / 检查更新 / 说明)..." "Cyan" & $applyRoot -PortableRoot $portableDir +# ---- Step 4b: launcher exe (thin shell over 启动.bat, #435) ---- +Write-Log "[4b/5] Building NextTrainer.exe launcher..." "Cyan" +& (Join-Path $PSScriptRoot "06-build-launcher.ps1") -PackageRoot $portableDir + # ---- Step 5: 7z ---- $7zExe = "C:\Program Files\7-Zip\7z.exe" if (-not (Test-Path $7zExe)) { diff --git a/docs/portable-getting-started.md b/docs/portable-getting-started.md index dd8259c4e..c2245c384 100644 --- a/docs/portable-getting-started.md +++ b/docs/portable-getting-started.md @@ -2,6 +2,17 @@ 面向 **Next Trainer 便携整合包**(归档名 `Next-Trainer-v*.7z`)用户的进阶说明。快速上手:下载 → 双击 `启动.bat` → 浏览器开练。 +## 启动器(NextTrainer.exe) + +整合包根目录同时提供一个 **`NextTrainer.exe`**(C# NativeAOT,约 5 MB,无 .NET 运行时依赖): + +- 双击启动 = 等价于 `启动.bat`(启动服务并自动打开浏览器),但会**接管进程树**:关闭窗口或按 `Q` 会真正停掉整个服务,不会留下后台残留 +- 按 `U` 一键更新:先停服 → 运行 `检查更新.bat` → 按 `R` 重启 +- 端口被占用或启动失败时给出中文提示(不是一闪而过) +- 开发/自检:`NextTrainer.exe --selftest`(启动 → 等端口 → 停服 → 退出码 0/1) + +启动器只做壳,不预装任何东西;`启动.bat` 仍是兜底入口。 + 当前最新正式版:**v3.0.0**([GitHub Release](https://github.com/wochenlong/lora-scripts-next/releases/tag/v3.0.0) · [魔搭 Next-Lab/next-trainer-releases](https://www.modelscope.cn/datasets/Next-Lab/next-trainer-releases))。 > **Krea 2**:请用 **musubi** 包(魔搭 `releases/v3.0.0/Next-Trainer-v3.0.0-musubi.7z`),步骤见 **[portable-1.5-krea2-guide.md](portable-1.5-krea2-guide.md)**。 diff --git a/launcher/NextTrainer.Launcher.csproj b/launcher/NextTrainer.Launcher.csproj new file mode 100644 index 000000000..005f9a892 --- /dev/null +++ b/launcher/NextTrainer.Launcher.csproj @@ -0,0 +1,16 @@ + + + + Exe + net9.0 + enable + enable + NextTrainer + 3.2.0 + + win-x64 + true + true + + + diff --git a/launcher/Program.cs b/launcher/Program.cs new file mode 100644 index 000000000..161956a4a --- /dev/null +++ b/launcher/Program.cs @@ -0,0 +1,249 @@ +// Next Trainer Windows launcher (#435): a thin shell around the portable package. +// +// It delegates the actual app startup to Next-Trainer/scripts/portable/launch_portable.bat +// (which owns the embedded-Python environment policy and evolves with the repo), opens the +// browser once the GUI port answers, relays the app log into this console, and owns the +// stop / update loop: +// Q - stop the app tree and exit +// U - stop the app, run the package updater (检查更新), then offer to restart + +using System.Diagnostics; + +const int GuiPort = 28000; +const int GuiWaitMinutes = 15; // first launch may verify embedded dependencies + +var root = Path.GetFullPath(AppContext.BaseDirectory); +var selfTest = args.Contains("--selftest", StringComparer.OrdinalIgnoreCase); + +Console.Title = "Next Trainer"; +Console.OutputEncoding = System.Text.Encoding.UTF8; + +Log("Next Trainer 启动器"); +Log($"包根目录: {root}"); + +// The launcher ships at the package root; tolerate it being moved into tools\. +var launchScript = Path.Combine(root, "Next-Trainer", "scripts", "portable", "launch_portable.bat"); +if (!File.Exists(launchScript)) +{ + var parent = Directory.GetParent(root)?.FullName; + if (parent is not null) + { + var candidate = Path.Combine(parent, "Next-Trainer", "scripts", "portable", "launch_portable.bat"); + if (File.Exists(candidate)) + { + root = parent; + launchScript = candidate; + } + } +} +if (!File.Exists(launchScript)) +{ + return Fail("找不到 Next-Trainer\\scripts\\portable\\launch_portable.bat,请确认整合包已完整解压。"); +} +Log($"启动脚本: {launchScript}"); + +Process? child = null; +Console.CancelKeyPress += (_, e) => +{ + e.Cancel = true; + StopTree(child); + Environment.Exit(0); +}; + +var startError = StartApp(); +if (startError is not null) return Fail(startError); +if (child is null) return Fail("无法启动训练进程(未知原因)"); + +var guiUrl = $"http://127.0.0.1:{GuiPort}"; +Log($"正在启动(首次运行会校验内嵌依赖,可能要几分钟)。GUI: {guiUrl}"); +Log("按 Q 停止并退出 · 按 U 检查更新(会先停止服务)"); + +if (selfTest) +{ + var ok = await WaitForGui(guiUrl, TimeSpan.FromMinutes(GuiWaitMinutes), child); + StopTree(child); + if (!ok) return Fail($"GUI 端口 {GuiPort} 在 {GuiWaitMinutes} 分钟内未就绪"); + Log("[selftest] 端口就绪,退出"); + return 0; +} + +// Background: open the browser once the GUI answers; keep the console free for keys. +_ = Task.Run(async () => +{ + if (await WaitForGui(guiUrl, TimeSpan.FromMinutes(GuiWaitMinutes), child)) + { + OpenBrowser(guiUrl); + return; + } + if (child is not null && child.HasExited) + { + Log("服务进程已退出,请查看上面的日志。"); + return; + } + Log($"GUI 端口 {GuiPort} 超时未就绪(服务可能仍在初始化),请稍后手动访问 {guiUrl}"); +}); + +var exitTask = child.WaitForExitAsync(); +while (!exitTask.IsCompleted) +{ + if (Console.KeyAvailable) + { + var key = Console.ReadKey(intercept: true).Key; + if (key is ConsoleKey.Q or ConsoleKey.Escape) + { + Log("正在停止服务…"); + StopTree(child); + return 0; + } + if (key is ConsoleKey.U) + { + var restart = await RunUpdateAsync(); + if (restart is null) return 0; + child = restart; + exitTask = child.WaitForExitAsync(); + } + } + await Task.Delay(200); +} +Log("服务进程已退出。"); +return 0; + +string? StartApp() +{ + var psi = new ProcessStartInfo + { + FileName = "cmd.exe", + Arguments = $"/c \"{launchScript}\"", + WorkingDirectory = root, + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = false, + }; + psi.Environment["PYTHONUTF8"] = "1"; + try + { + child = Process.Start(psi); + } + catch (Exception exc) + { + return $"启动失败: {exc.Message}"; + } + if (child is null) return "启动失败: 进程未创建"; + child.OutputDataReceived += (_, e) => { if (e.Data is not null) Console.WriteLine(e.Data); }; + child.ErrorDataReceived += (_, e) => { if (e.Data is not null) Console.WriteLine(e.Data); }; + child.BeginOutputReadLine(); + child.BeginErrorReadLine(); + return null; +} + +async Task RunUpdateAsync() +{ + var candidates = new[] + { + Path.Combine(root, "检查更新.bat"), + Path.Combine(root, "tools", "Update-Next-Trainer.bat"), + }; + var updateScript = candidates.FirstOrDefault(File.Exists); + if (updateScript is null) + { + Log("未找到更新脚本(检查更新.bat / tools\\Update-Next-Trainer.bat),请确认整合包完整。"); + return child; + } + + Log("正在停止服务以检查更新…"); + StopTree(child); + child = null; + + Log($"运行 {updateScript}"); + var psi = new ProcessStartInfo + { + FileName = "cmd.exe", + Arguments = $"/c \"{updateScript}\"", + WorkingDirectory = root, + UseShellExecute = false, + }; + var updater = Process.Start(psi); + if (updater is null) + { + Log("无法启动更新脚本。"); + return null; + } + await updater.WaitForExitAsync(); + + Log("按 R 重启服务,按其它键退出。"); + var key = Console.ReadKey(intercept: true).Key; + if (key is not ConsoleKey.R) return null; + var startError = StartApp(); + if (startError is not null) + { + Log(startError); + return null; + } + return child; +} + +async Task WaitForGui(string url, TimeSpan timeout, Process? process) +{ + using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(2) }; + var deadline = DateTime.UtcNow + timeout; + var attempts = 0; + while (DateTime.UtcNow < deadline) + { + if (process is not null && process.HasExited) return false; + attempts += 1; + if (attempts % 15 == 0) Log("仍在初始化(首次会校验内嵌依赖,可能要几分钟)…"); + try + { + using var response = await client.GetAsync(url); + if (response.IsSuccessStatusCode) + { + Log($"GUI 就绪: {url}"); + return true; + } + } + catch + { + // Not ready yet. + } + await Task.Delay(1000); + } + return false; +} + +void StopTree(Process? process) +{ + if (process is null || process.HasExited) return; + try + { + process.Kill(entireProcessTree: true); + process.WaitForExit(10_000); + } + catch (Exception exc) + { + Log($"停止服务失败: {exc.Message}"); + } +} + +void OpenBrowser(string url) +{ + try + { + Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); + Log($"已打开 {url}"); + } + catch (Exception exc) + { + Log($"打开浏览器失败({exc.Message}),请手动访问 {url}"); + } +} + +int Fail(string message) +{ + Console.WriteLine($"[错误] {message}"); + Console.WriteLine("按任意键退出…"); + try { Console.ReadKey(intercept: true); } catch { /* console unavailable */ } + return 1; +} + +void Log(string message) => Console.WriteLine($"[launcher] {message}"); From d6ccdb177d4b9107597085763406c41c54fdac24 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Tue, 13 Oct 2026 00:06:38 +0800 Subject: [PATCH 11/89] feat(portable): ship the launcher in every 2026 package flavor (#435) musubi-only, kohya-only and the resume flow now build and place NextTrainer.exe just like the full package. Packaging tests assert the wiring so a future build script cannot silently drop the launcher. --- CHANGELOG.md | 2 +- build-scripts/build_portable_kohya_only.ps1 | 3 ++ build-scripts/build_portable_musubi_only.ps1 | 3 ++ build-scripts/resume_portable_2026_full.ps1 | 3 ++ tests/test_portable_packaging_scripts.py | 36 ++++++++++++++++++++ 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11ffdb656..bd5114ecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ ### 新增 -- **Windows 启动器 `NextTrainer.exe`(#435)**:放在整合包根目录(与 `启动.bat` 并存)。双击启动等价于 `启动.bat`,但接管进程树:关窗 / `Q` 真正停掉服务,端口占用或启动失败给中文提示,`U` 一键更新(先停服 → 运行更新脚本 → `R` 重启)。C# NativeAOT 编译(约 5 MB,无 .NET 运行时依赖)。构建脚本 `build-scripts/06-build-launcher.ps1`,已接入 `build_portable_2026_full.ps1` 的打包流程 +- **Windows 启动器 `NextTrainer.exe`(#435)**:放在整合包根目录(与 `启动.bat` 并存)。双击启动等价于 `启动.bat`,但接管进程树:关窗 / `Q` 真正停掉服务,端口占用或启动失败给中文提示,`U` 一键更新(先停服 → 运行更新脚本 → `R` 重启)。C# NativeAOT 编译(约 5 MB,无 .NET 运行时依赖)。构建脚本 `build-scripts/06-build-launcher.ps1`,已接入 2026 全量 / musubi-only / kohya-only / resume 的打包流程 ### 修复(近一个月 issue 第二批) diff --git a/build-scripts/build_portable_kohya_only.ps1 b/build-scripts/build_portable_kohya_only.ps1 index 0e8ef7e40..62c93bf3f 100644 --- a/build-scripts/build_portable_kohya_only.ps1 +++ b/build-scripts/build_portable_kohya_only.ps1 @@ -82,4 +82,7 @@ if (Test-Path $note) { "@ } +# ---- launcher exe (thin shell over the .bat entries, #435) ---- +& (Join-Path $PSScriptRoot "06-build-launcher.ps1") -PackageRoot $portableDir + Write-Host "DONE kohya-only v$Version" -ForegroundColor Green diff --git a/build-scripts/build_portable_musubi_only.ps1 b/build-scripts/build_portable_musubi_only.ps1 index f3660c65b..829304ed5 100644 --- a/build-scripts/build_portable_musubi_only.ps1 +++ b/build-scripts/build_portable_musubi_only.ps1 @@ -126,6 +126,9 @@ $applyRoot = Join-Path $PSScriptRoot "apply_portable_2026_root.ps1" if (Test-Path $applyRoot) { Write-Log "Applying 2026 root..." "Cyan" & $applyRoot -PortableRoot $portableDir + +# ---- launcher exe (thin shell over the .bat entries, #435) ---- +& (Join-Path $PSScriptRoot "06-build-launcher.ps1") -PackageRoot $portableDir } $note = Join-Path $portableDir "说明.txt" diff --git a/build-scripts/resume_portable_2026_full.ps1 b/build-scripts/resume_portable_2026_full.ps1 index beaa04ee8..23b9b7fed 100644 --- a/build-scripts/resume_portable_2026_full.ps1 +++ b/build-scripts/resume_portable_2026_full.ps1 @@ -63,6 +63,9 @@ if (-not $SkipMusubi) { Write-Log "[2/3] Applying 2026 root..." "Cyan" & $applyRoot -PortableRoot $portableDir +# ---- launcher exe (thin shell over the .bat entries, #435) ---- +& (Join-Path $PSScriptRoot "06-build-launcher.ps1") -PackageRoot $portableDir + $archiveName = "Next-Trainer-v${Version}-kohya-musubi.7z" $archivePath = Join-Path $buildDir $archiveName $7zExe = "C:\Program Files\7-Zip\7z.exe" diff --git a/tests/test_portable_packaging_scripts.py b/tests/test_portable_packaging_scripts.py index 2a2581413..91dafd273 100644 --- a/tests/test_portable_packaging_scripts.py +++ b/tests/test_portable_packaging_scripts.py @@ -242,3 +242,39 @@ def test_installers_bundle_the_tag_dictionary_for_offline_translation(): assert "prefetch_tag_dictionary.py" in builder assert "assets\\tag_translation\\danbooru" in builder assert "SkipTagDictionaryPrefetch" in builder + + +def test_launcher_build_script_compiles_and_places_the_exe(): + script = (ROOT / "build-scripts/06-build-launcher.ps1").read_text(encoding="utf-8") + assert "PublishAot=true" in script + assert "NextTrainer.exe" in script + assert "PackageRoot" in script + assert "Copy-Item" in script + + +def test_every_2026_packaging_script_wires_the_launcher(): + for relative in ( + "build-scripts/build_portable_2026_full.ps1", + "build-scripts/build_portable_musubi_only.ps1", + "build-scripts/build_portable_kohya_only.ps1", + "build-scripts/resume_portable_2026_full.ps1", + ): + content = (ROOT / relative).read_text(encoding="utf-8") + assert "06-build-launcher.ps1" in content, relative + + +def test_launcher_delegates_to_the_portable_batch_entry(): + program = (ROOT / "launcher/Program.cs").read_text(encoding="utf-8") + csproj = (ROOT / "launcher/NextTrainer.Launcher.csproj").read_text(encoding="utf-8") + # The shell must stay a shell: the batch entry owns the environment policy. + assert "launch_portable.bat" in program + assert "entireProcessTree" in program + assert "--selftest" in program + assert "win-x64" in csproj + assert "PublishSingleFile" in csproj + + +def test_launcher_artifacts_are_ignored_by_git(): + ignore = (ROOT / ".gitignore").read_text(encoding="utf-8") + assert "launcher/bin/" in ignore + assert "launcher/obj/" in ignore From d05b9691e57461398076b09edc14c59c7663df8e Mon Sep 17 00:00:00 2001 From: wochenlong Date: Tue, 13 Oct 2026 00:34:43 +0800 Subject: [PATCH 12/89] docs: note the main backport and the image rebuild steps for the fingerprint fix (#410) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd5114ecd..b0d333d97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - **Krea2 tokenizer 的 `extra_special_tokens` 为 list 时加载失败(#416)**:探测/下载/启动前会把旧的 list 形态规范化为 transformers 期望的 mapping,手动放置的 tokenizer 同样会被治好 - **Kohya 加载 Anima 2.9B 前明确拦截(#408)**:只读 safetensors 头部统计 block 数,超过 28 即拒绝并提示改用 Anima Fast,不再等到加载时抛一串 `blocks.28.*` 权重名 - **DiffSynth 指纹不再含 mtime(#410)**:目录拷贝 / 云镜像 / 备份还原导致的时间戳变化不再误报环境异常;旧状态一次性迁移,不要求重装;内容改动仍能识别 + - 已回移到 `main`(PR #438)。**预装 DiffSynth 的定制镜像需同步 `mikazuki/engines/diffsynth/extension_state.py` 与 `install_worker.py` 后重建镜像**;只改 `install_state.json` 不算修复(时间戳再变仍会复发)——文件到位后,现存实例在下一次状态检查时会自动迁移,无需重装 --- ## v3.2.0 — 2026-10-11 From 6ccde8799a3561ef7210d9ec289cb085ccdc9875 Mon Sep 17 00:00:00 2001 From: wochenlong Date: Tue, 13 Oct 2026 02:29:06 +0800 Subject: [PATCH 13/89] fix(dataset): load managed datasets when the picker is opened through the controlled open prop (#440) DatasetEditorPage hides the picker's own button and drives the dialog through v-model:open, so toggle() never ran: the dialog opened with an empty dataset list even though the API returned the datasets. The controlled open transition now runs the same initialisation (source/serverPath/browse), and reopening refreshes without stacking requests. --- CHANGELOG.md | 4 +++ .../dataset/ManagedDatasetPicker.test.ts | 29 +++++++++++++++++++ .../dataset/ManagedDatasetPicker.vue | 21 ++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d333d97..097636a5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ (下一个开发周期:AI Toolkit 模型格式与训练体验,详见 docs/roadmap.md) +### 修复(近一个月 issue 第三批) + +- **标签编辑的「选择已有数据集」弹窗为空(#440)**:`ManagedDatasetPicker` 现在会监听受控的 `open` 属性(标签编辑隐藏内部按钮、直接控制弹窗),弹窗打开时执行与内部按钮相同的初始化并拉取数据集列表;关闭后重开正常刷新,`browse()` 的 generation 机制继续防止并发响应覆盖 + ### 新增 - **Windows 启动器 `NextTrainer.exe`(#435)**:放在整合包根目录(与 `启动.bat` 并存)。双击启动等价于 `启动.bat`,但接管进程树:关窗 / `Q` 真正停掉服务,端口占用或启动失败给中文提示,`U` 一键更新(先停服 → 运行更新脚本 → `R` 重启)。C# NativeAOT 编译(约 5 MB,无 .NET 运行时依赖)。构建脚本 `build-scripts/06-build-launcher.ps1`,已接入 2026 全量 / musubi-only / kohya-only / resume 的打包流程 diff --git a/frontend/src/components/dataset/ManagedDatasetPicker.test.ts b/frontend/src/components/dataset/ManagedDatasetPicker.test.ts index 7c9c09a5b..17bd1bb65 100644 --- a/frontend/src/components/dataset/ManagedDatasetPicker.test.ts +++ b/frontend/src/components/dataset/ManagedDatasetPicker.test.ts @@ -96,3 +96,32 @@ it("keeps a typed path when native folder selection is cancelled", async () => { expect((wrapper.get(".dataset-source-path input").element as HTMLInputElement).value).toBe("D:/existing") wrapper.unmount() }) + +it("loads managed datasets when the controlled open prop opens the dialog (#440)", async () => { + const list = vi.spyOn(datasetsApi, "list").mockResolvedValue({ + root: "/data", exists: true, datasets: [ + { name: "test", path: "/data/test", overview: { state: "ready", file_count: 4, captioned_count: 3, total_bytes: 1024, updated_at: "2026-10-13T00:00:00Z" } }, + ], + }) + const wrapper = mount(ManagedDatasetPicker, { + props: { open: false, hideButton: true }, + global: { plugins: [i18n], stubs: { ElDialog: { template: "
" }, PathPickerDialog: true } }, + }) + await flushPromises() + // Closed on mount: no request. + expect(list).not.toHaveBeenCalled() + + await wrapper.setProps({ open: true }) + await flushPromises() + expect(list).toHaveBeenCalledTimes(1) + expect(wrapper.text()).toContain("test") + + // Reopening refreshes, without stacking a second request per transition. + await wrapper.setProps({ open: false }) + await flushPromises() + await wrapper.setProps({ open: true }) + await flushPromises() + expect(list).toHaveBeenCalledTimes(2) + + wrapper.unmount() +}) diff --git a/frontend/src/components/dataset/ManagedDatasetPicker.vue b/frontend/src/components/dataset/ManagedDatasetPicker.vue index 16aa5d262..d50712c96 100644 --- a/frontend/src/components/dataset/ManagedDatasetPicker.vue +++ b/frontend/src/components/dataset/ManagedDatasetPicker.vue @@ -1,5 +1,5 @@ -
+
{ :title="label" :hint="hint" :loading="loading" - :show-install="status.featureEnabled && !working" - :show-reinstall="status.state === 'broken'" - @install="install(false)" - @reinstall="install(true)" + :show-install="false" + :show-reinstall="false" + :show-refresh="statusUnknown" + :show-manage="statusUnknown" + @refresh="refresh()" /> -
+
ANIMA FAST RUNTIME

Anima LoRA Fast

{{ t("animaFast.intro") }}

@@ -178,18 +198,22 @@ onBeforeUnmount(() => {

-
- {{ label }} - {{ status.state }} -
{{ t("animaFast.auditTitle") }}

{{ error }}

-
+
+ @@ -197,7 +221,7 @@ onBeforeUnmount(() => {
-