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.

Load the update modules next to the engine when ComfyUI imports the node folder as a package

Bowen Xueb674f7bbde4a
diff --git a/freevideo_engine/desktop_runtime.py b/freevideo_engine/desktop_runtime.py
index e307a11..f03c768 100644
--- a/freevideo_engine/desktop_runtime.py
+++ b/freevideo_engine/desktop_runtime.py
@@ -172,9 +172,10 @@ def check_launcher_payload(source, destination):
def materialize_source(bundle=None, destination=None):
"""A one-file executable's temporary extraction must never back an editable install."""
if bundle is None:
- import freevideo_source_bootstrap
- if freevideo_source_bootstrap.ACTIVE:
- return Path(plain(freevideo_source_bootstrap.ACTIVE['source']))
+ from .top_level_modules import update_modules
+ active = update_modules()[2].ACTIVE
+ if active:
+ return Path(plain(active['source']))
if bundle is None and not getattr(sys, 'frozen', False):
return Path(plain(resolved(__file__).parents[1]))
bundle = io_path(bundle or Path(sys._MEIPASS) / 'engine-source')
diff --git a/freevideo_engine/launcher_update.py b/freevideo_engine/launcher_update.py
index 15d38ef..8f684d4 100644
--- a/freevideo_engine/launcher_update.py
+++ b/freevideo_engine/launcher_update.py
@@ -20,15 +20,16 @@ import urllib.error
import urllib.parse
import urllib.request
-import freevideo_ed25519 as ed25519
-import freevideo_update_keys as keys
from . import execution_paths
+from .top_level_modules import load
from .monitoring import save
from .long_paths import io_path, resolved, plain, plain_errors
from . import disk_space, network
from .launcher_settings import default_language
from .system import windows
+ed25519, keys = load('freevideo_ed25519'), load('freevideo_update_keys')
+
REPOSITORY = 'FlashML-org/FreeVideo'
# Mirror repository on the ModelScope domestic site; the release script uploads each release there.
MIRROR_BASE = 'https://modelscope.cn/models/BowenXue/FreeVideo-releases/resolve/master'
diff --git a/freevideo_engine/source_update.py b/freevideo_engine/source_update.py
index 7c53244..292ac46 100644
--- a/freevideo_engine/source_update.py
+++ b/freevideo_engine/source_update.py
@@ -6,11 +6,11 @@ import re
import shutil
import sys
-import freevideo_ed25519 as ed25519
-import freevideo_source_bootstrap as source
-import freevideo_update_keys as keys
from . import disk_space, execution_paths, network
from . import launcher_update as update
+from .top_level_modules import update_modules
+
+ed25519, keys, source = update_modules()
log = logging.getLogger(__name__)
DOMAIN = b'FreeVideo source manifest v1\x00'
diff --git a/freevideo_engine/top_level_modules.py b/freevideo_engine/top_level_modules.py
new file mode 100644
index 0000000..99ed7ae
--- /dev/null
+++ b/freevideo_engine/top_level_modules.py
@@ -0,0 +1,33 @@
+"""Import the source-update modules that sit beside the engine package.
+
+The launcher puts them on sys.path, but ComfyUI loads this folder as a package by file location and the
+folder is not on sys.path, so they are loaded from the folder next to freevideo_engine under their own names.
+"""
+import importlib
+import importlib.util
+import sys
+from pathlib import Path
+
+
+def load(name):
+ if name in sys.modules:
+ return sys.modules[name]
+ try:
+ return importlib.import_module(name)
+ except ModuleNotFoundError as error:
+ if error.name != name:
+ raise
+ spec = importlib.util.spec_from_file_location(name, Path(__file__).resolve().parents[1] / (name + '.py'))
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[name] = module
+ try:
+ spec.loader.exec_module(module)
+ except BaseException:
+ sys.modules.pop(name, None)
+ raise
+ return module
+
+
+def update_modules():
+ """(ed25519, update keys, source bootstrap); the bootstrap imports the first two by their own names."""
+ return load('freevideo_ed25519'), load('freevideo_update_keys'), load('freevideo_source_bootstrap')