Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Count model libraries once each and skip deleted saved folders (0.3.7) (#97)

Bowen Xuebc3f14f26b2b
diff --git a/freevideo_engine/comfy_launcher_runtime.py b/freevideo_engine/comfy_launcher_runtime.py
index 3dc5b1f..08944cc 100644
--- a/freevideo_engine/comfy_launcher_runtime.py
+++ b/freevideo_engine/comfy_launcher_runtime.py
@@ -507,6 +507,9 @@ class Controller:
if not isinstance(extra, list) or any(not isinstance(p, str) for p in extra):
raise ValueError('Model folders must be a list of directory paths')
extra = extra + ([values['models']] if values.get('models') else [])
+ # A saved folder that no longer exists (for example a removed offline
+ # package) has nothing to reuse; it must not stop the installation.
+ extra = [p for p in dict.fromkeys(extra) if p.strip() and Path(p).expanduser().is_dir()]
self.setup.inspect(dict(root=str(engine), extra_libraries=extra, copy=False,
sampling_caches=bool(values.get('sampling_caches')), prepared_format=values.get('prepared_format'),
frontend=dict(root=descriptor['root'], separate=descriptor['separate'], download=fresh)))
diff --git a/freevideo_engine/comfy_setup.py b/freevideo_engine/comfy_setup.py
index cdc3d3f..a4dd6cf 100644
--- a/freevideo_engine/comfy_setup.py
+++ b/freevideo_engine/comfy_setup.py
@@ -55,7 +55,9 @@ def discover_libraries(folder_paths, environ=None):
existing.append(str(path))
except (OSError, RuntimeError):
pass
- return library_roots(existing)
+ # A folder registered under several model types is listed once; finding
+ # more than 64 folders keeps the first 64 rather than failing setup.
+ return library_roots(list(dict.fromkeys(existing)), keep_first=True)
# The calibration encodes this once and every variant reads it, so the
@@ -236,7 +238,10 @@ class Setup:
extra = value.get('extra_libraries', [])
if not isinstance(extra, list) or not isinstance(value.get('copy', False), bool):
raise ValueError('Invalid setup choices')
- libraries = library_roots(discover_libraries(self.folder_paths) + extra)
+ # Folders the user chose are validated and kept first; folders found
+ # automatically fill the remaining places.
+ chosen = library_roots(extra)
+ libraries = library_roots(chosen + discover_libraries(self.folder_paths), keep_first=True)
self.logs.mkdir(parents=True, exist_ok=True)
manifest = self.logs / ('libraries-' + uuid.uuid4().hex + '.json')
save(manifest, dict(version=1, roots=libraries))
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index 7037494..57a98c6 100644
--- a/freevideo_engine/launcher_session.py
+++ b/freevideo_engine/launcher_session.py
@@ -184,7 +184,9 @@ class Session:
def add_folder(self, folder):
from .local_models import library_roots
- self.edit('model_dirs', library_roots(self.form['model_dirs'] + [folder]))
+ # Saved folders that were deleted since are dropped instead of blocking the new one.
+ kept = [p for p in self.form['model_dirs'] if Path(p).expanduser().is_dir()]
+ self.edit('model_dirs', library_roots(kept + [folder]))
def remove_folder(self, index):
removed = self.form['model_dirs'][index]
diff --git a/freevideo_engine/local_models.py b/freevideo_engine/local_models.py
index eb69ac8..00ffca9 100644
--- a/freevideo_engine/local_models.py
+++ b/freevideo_engine/local_models.py
@@ -12,12 +12,18 @@ BLOCK = 4 * 2**20
MAX_ENTRIES = 200_000
MAX_CANDIDATES = 2048
MAX_ROOTS = 64
+MAX_LISTED = 4096 # Paths accepted before duplicates and nested folders are merged.
-def library_roots(values):
- """Normalize explicitly selected libraries without walking entire drives."""
- if not isinstance(values, list) or len(values) > MAX_ROOTS:
- raise ValueError('Select at most 64 model libraries')
+def library_roots(values, *, keep_first=False):
+ """Normalize selected libraries without walking entire drives.
+
+ The 64-library limit counts distinct folders: a folder named twice, or one
+ inside another listed folder, counts once. With keep_first, a list found
+ automatically keeps its first 64 folders instead of failing.
+ """
+ if not isinstance(values, list) or len(values) > MAX_LISTED:
+ raise ValueError('Invalid model library list')
roots = []
for value in values:
if not isinstance(value, str) or not value.strip() or len(value) > 4096:
@@ -29,7 +35,12 @@ def library_roots(values):
roots.append(path)
# Explicit symlink/junction roots are resolved above. Internal directory
# links are still skipped by files(); never follow an arbitrary graph.
- return [str(path) for path in roots if not any(parent in roots for parent in path.parents)]
+ roots = [path for path in roots if not any(parent in roots for parent in path.parents)]
+ if len(roots) > MAX_ROOTS:
+ if not keep_first:
+ raise ValueError('Select at most 64 model libraries')
+ roots = roots[:MAX_ROOTS]
+ return [str(path) for path in roots]
def scan_many(directories, rows, *, prior=None, callback=None):
diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json
index 1629d26..8406bb7 100644
--- a/freevideo_engine/release_notes.json
+++ b/freevideo_engine/release_notes.json
@@ -1,24 +1,18 @@
{
"schema": 1,
- "product_version": "0.3.6",
+ "product_version": "0.3.7",
"en": {
- "summary": "int8 generation keeps more of its work on the graphics card: 8 to 24 GB cards render longer and larger videos faster, and running out of graphics memory once no longer slows later videos.",
+ "summary": "Installation no longer stops with \"Select at most 64 model libraries\" when ComfyUI has many model folders.",
"changes": [
- "int8 attention needs 1 to 2.7 GB less graphics memory, with identical results. Videos that used to keep attention in system memory now stay on the card where they fit, for example 1344x768 for 10 s on 8 GB cards, 20 s on 12 GB cards and 1920x1088 on 16 GB cards. Their refinement steps run up to about 1.3x faster on Windows and 2x on Linux.",
- "Long 1920x1088 videos on 16 GB cards keep attention on the card and stage only the residual stream in system memory, which also leaves about 6 GB more system memory free.",
- "After running out of graphics memory, the retry only halves the attention head group instead of shrinking every work partition. If the retry had memory to spare, the next video tries the planned settings again.",
- "On Windows the first pass keeps half a gigabyte below the graphics memory budget, so its weight cache no longer spills into shared memory.",
- "Offline installation also takes the optional Reference audio pack. Imported with the other packs, it lets audio references work without downloading their tables first."
+ "Fixed installation stopping with \"Select at most 64 model libraries\" when ComfyUI has more than ten model folders. Each folder now counts once, and when more than 64 are found, the first 64 are used and installation continues.",
+ "A saved model folder that has since been deleted, such as a removed offline package folder, is skipped instead of blocking installation or offline import."
]
},
"zh": {
- "summary": "int8 生成更多地留在显卡上:8 到 24 GB 显卡能更快地生成更长、更大的视频;偶尔显存不足也不再拖慢之后的视频。",
+ "summary": "修复 ComfyUI 模型目录较多时,安装提示「Select at most 64 model libraries」的问题。",
"changes": [
- "int8 注意力少用 1 到 2.7 GB 显存,生成结果完全相同。以前需要把注意力放到内存的视频,现在放得下就留在显卡上,例如 8 GB 显卡的 1344×768 10 秒、12 GB 显卡的 20 秒、16 GB 显卡的 1920×1088。这些视频的精修步骤在 Windows 上最多快约 1.3 倍,在 Linux 上约 2 倍。",
- "16 GB 显卡生成 1920×1088 长视频时,注意力留在显卡上,只把残差放到内存,内存也多空出约 6 GB。",
- "显存不足时,重试只把注意力分组减半,不再把所有分块都降到最小;如果重试时显存还有富余,下一个视频会重新使用原来的设置。",
- "Windows 上第一遍会在显存预算下留出 0.5 GB 余量,权重缓存不再溢出到共享内存。",
- "离线安装可以一起导入可选的「音频参考缓存」包,用音频做参考时不必再联网下载对应的缓存。"
+ "修复 ComfyUI 模型目录超过十个时,安装停在「Select at most 64 model libraries」的问题。同一个目录现在只计一次;找到的目录超过 64 个时使用前 64 个,安装照常进行。",
+ "已保存的模型文件夹如果已被删除(例如删除了离线包目录),会自动跳过,不再阻止安装或离线导入。"
]
}
}