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.
Repair replaces pinned Python packages whose files are missing, and a failed hardware probe...
Bowen Xue815e20be6985
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.pyindex f477cee..c238093 100644--- a/freevideo_engine/bootstrap.py+++ b/freevideo_engine/bootstrap.py@@ -158,7 +158,7 @@ def reinstall_download_bytes(dependencies, system, *, root=None, frontend_pythonWindows wheel (torch_download), elsewhere the package's installed size, anupper bound for its wheel. Marks each engine environment's damaged packages."""from .environments import ENVIRONMENTS- from .runtime_libraries import damaged, incomplete, installed_bytes+ from .runtime_libraries import damaged, incomplete, installed_bytes, missing_packagesfrom .torch_download import selecttotal = 0seen = set()@@ -173,6 +173,9 @@ def reinstall_download_bytes(dependencies, system, *, root=None, frontend_pythonrow['damaged'] = broken = damaged(row['python'])if frontend:broken = sorted(set(broken + incomplete(row['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, {})wheels = {w['package']: w for w in (select(pins['torch'], pins['cuda']) or [])} if system == 'Windows' and pins else {}for package in broken:@@ -1628,10 +1631,11 @@ class Installer:if install(uv, executable, role['torch'], role['cuda'], root=self.root,networking=self.network, env=self.env, ui=self.ui,run=lambda args, env: self.command(label + '-torch', args, env=env),- constraints=['-c', constraints_file(label, self.system)], check=check):+ constraints=['-c', constraints_file(label, self.system)], check=check,+ reinstall=self.missing_files(executable, label, gpu=True, wheels=role)):returnfrom .runtime_libraries import damaged, reinstall_arguments- fresh = self.check_runtime_libraries(executable, label)+ fresh = sorted(set(self.check_runtime_libraries(executable, label)) | set(self.missing_files(executable, label, gpu=True)))result = self.packages(label + '-torch', [*argv[:5], *reinstall_arguments(fresh), *argv[5:]], group)# Files linked from a changed uv cache arrive with a new environment.if not fresh:@@ -1647,7 +1651,8 @@ class Installer:'-c', constraints_file(name, self.system), 'pip', 'ninja', 'packaging', 'wheel', 'setuptools']if self.layout == 'unified':command += ['-r', SOURCE / 'constraints/encoder-runtime.txt']- task('runtime', lambda: self.packages(name + '-packages', command), (name + '-torch',), ('environment:' + name,))+ task('runtime', lambda: self.packages(name + '-packages', self.repairing(command, python, name)),+ (name + '-torch',), ('environment:' + name,))# Enqueue downloads as soon as their SDKs exist, before waiting for# source setup, encoder checks or acceleration compilation.task('models', lambda: self.command('models', [python, '-m', 'freevideo_engine.provision',@@ -1657,8 +1662,9 @@ class Installer:encoder_after = 'runtime'if self.layout == 'dual':def encoder_packages():- self.packages('encoder-packages', [uv, 'pip', 'install', '--python', encoder_python,- '-r', SOURCE / 'constraints/encoder-runtime.txt', '-c', constraints_file('encoder', self.system)])+ self.packages('encoder-packages', self.repairing([uv, 'pip', 'install', '--python', encoder_python,+ '-r', SOURCE / 'constraints/encoder-runtime.txt', '-c', constraints_file('encoder', self.system)],+ encoder_python, 'encoder'))self.packages('encoder-engine', [uv, 'pip', 'install', '--python', encoder_python, '--no-deps', '-e', SOURCE])task('encoder-runtime', encoder_packages, ('encoder-torch',), ('environment:encoder',))encoder_after = 'encoder-runtime'@@ -1690,6 +1696,33 @@ class Installer:tasks['models']['after'] = ('package-cache',)return tasks, pythons, comfy+ def missing_files(self, python, role, *, gpu=None, wheels=None):+ """Pinned packages of an environment whose files are gone (runtime_libraries.package_files).++ gpu=True keeps the PyTorch family, which is installed from the GPU wheels (and only+ those of `wheels`, an environment's spec, when given); gpu=False keeps the rest."""+ from .runtime_libraries import gpu_family, missing_packages, normalize_name+ try:+ names = missing_packages(python, constraints_file(role, self.system))+ except ValueError:+ return []+ if gpu is not None:+ names = [name for name in names if gpu_family(name) == gpu]+ if wheels is not None:+ from .torch_download import select+ catalog = {normalize_name(row['package']) for row in select(wheels['torch'], wheels['cuda']) or []}+ names = [name for name in names if normalize_name(name) in catalog]+ return names++ def repairing(self, argv, python, role):+ """An install command that also replaces the pinned packages whose files are gone.++ Installing the pinned version again does nothing when uv finds it installed,+ whatever state its files are in. The PyTorch family is replaced in its own step."""+ from .runtime_libraries import reinstall_arguments+ names = self.missing_files(python, role, gpu=False)+ return [*argv[:5], *reinstall_arguments(names), *argv[5:]] if names else argv+def check_runtime_libraries(self, python, role):from .runtime_libraries import damagedkey = role + '-runtime-libraries'diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.pyindex 7d8ec3d..af9d23c 100644--- a/freevideo_engine/failure_details.py+++ b/freevideo_engine/failure_details.py@@ -756,7 +756,9 @@ def _launcher_failure(value, *, zh=False, other_disk=False, disk_name='', can_re('Runtime files have been changed', '运行组件已被更改'),('Click Repair to reinstall a complete copy of PyTorch. Models and videos are kept.','请点“修复”,FreeVideo 会重新安装运行组件,模型和视频都会保留。')),- (r'ModuleNotFoundError|No module named|DLL load failed', 'dependencies', *DEPENDENCIES),+ # runtime_libraries.summary names packages whose files are gone (a numpy extension that cannot load).+ (r'ModuleNotFoundError|No module named|DLL load failed|Files of these Python packages are missing or have changed',+ 'dependencies', *DEPENDENCIES),(r'CUDA (?:error: )?out of memory|torch\.OutOfMemoryError|Insufficient currently available memory|crossed its RAM budget|paging file is too small|WinError 1455|os error 1455', 'memory',('Memory is unavailable for this step', '这一步可用内存不足'),('Close other memory-heavy applications and retry. Copy the details if it continues.', '关闭占用内存较多的程序后重试;仍失败时可复制详情反馈。')),diff --git a/freevideo_engine/runtime_libraries.py b/freevideo_engine/runtime_libraries.pyindex 2fc9e80..bb3d43a 100644--- a/freevideo_engine/runtime_libraries.py+++ b/freevideo_engine/runtime_libraries.py@@ -167,6 +167,10 @@ def diagnose(site=None):result.update(found)except Exception as error:result['check_error'] = '%s: %s' % (type(error).__name__, error)+ try:+ result['missing_files'] = {name: files for name, files in list(package_files(site).items())[:6]}+ except Exception as error:+ result['missing_files_error'] = '%s: %s' % (type(error).__name__, error)try:for path in loaded():inside = _canonical(os.path.dirname(path)) in directories@@ -187,6 +191,13 @@ def summary(result, repair=REINSTALL):if changed:lines.append("Some of FreeVideo's PyTorch library files do not match the installed version (%s). %s"% (', '.join(changed[:4]) + (', …' if len(changed) > 4 else ''), repair))+ missing = result.get('missing_files')+ if isinstance(missing, dict) and missing:+ names = ['%s (%s)' % (name, ', '.join(str(file).rsplit('/', 1)[-1] for file in files[:2]))+ for name, files in list(missing.items())[:4] if isinstance(files, list) and files]+ if names:+ lines.append('Files of these Python packages are missing or have changed: %s%s. %s'+ % (', '.join(names), ', …' if len(missing) > 4 else '', repair))outside = sorted({str(Path(p).parent) for p in result.get('outside', [])})if outside:lines.append('cuDNN was also loaded from outside FreeVideo: %s.' % '; '.join(outside[:3]))@@ -363,6 +374,83 @@ def incomplete(python):return []+def package_files(site, limit=3):+ """Files RECORD lists inside site-packages that are missing or have another size.++ Returns {distribution: [paths relative to site-packages, at most `limit`]}. Only+ files below site-packages count: console scripts and data files sit beside it, and+ their size depends on where the environment was created. A numpy extension that+ cannot load is usually one of these files gone (quarantined, cleaned up, cut short),+ which an ordinary install does not notice. No hashing, so it is cheap to run.+ Unreadable records and checks that cannot run find nothing.+ """+ found = {}+ try:+ site = Path(site)+ # Paths stay as RECORD spells them: a package folder that is a junction+ # to another drive is still checked.+ base = os.path.normcase(os.path.normpath(str(site))) + os.sep+ for distribution in importlib.metadata.distributions(path=[str(io_path(site))]):+ try:+ rows = list(csv.reader(io.StringIO(distribution.read_text('RECORD') or '')))+ name = distribution.metadata['Name']+ except (OSError, csv.Error, UnicodeDecodeError, KeyError):+ continue+ if not name:+ continue+ for row in rows:+ if len(row) < 3 or not row[2].isdigit():+ continue+ path = os.path.normpath(os.path.join(str(site), row[0]))+ if not os.path.normcase(path).startswith(base):+ continue+ try:+ size = os.path.getsize(io_path(path))+ except (FileNotFoundError, NotADirectoryError):+ size = None+ except OSError:+ continue+ if size != int(row[2]):+ files = found.setdefault(name, [])+ if len(files) >= limit:+ break+ files.append(row[0].replace('\\', '/'))+ except Exception:+ return {}+ return found+++def gpu_family(name):+ """The packages installed from the GPU wheels: PyTorch, its CUDA libraries and its compiler."""+ name = normalize_name(name)+ return name in ('torch', 'torchvision', 'torchaudio', 'triton', 'triton-windows') or name.startswith('nvidia-')+++def pinned_names(constraints):+ """Normalized names a constraints file pins, or None when it cannot be read."""+ rows = _requirement_rows(constraints)+ if rows is None:+ return None+ return {normalize_name(match[0]) for match in (re.match(r'[A-Za-z0-9][A-Za-z0-9._-]*', row) for row in rows) if match}+++def missing_packages(python, constraints):+ """Pinned distributions of this environment whose RECORD files are missing or cut short.++ Setup and repair reinstall these: uv treats a package at the pinned version+ as installed whatever its files look like. Packages the constraints do not+ pin (editable installs, kernels built on this machine) are left alone.+ """+ try:+ site = site_for(python)+ pinned = pinned_names(constraints)+ if site is None or pinned is None:+ return []+ return sorted(name for name in package_files(site, limit=1) if normalize_name(name) in pinned)+ except Exception:+ return []++def installed_bytes(python, name):"""Installed size of one distribution in this Python's environment, from its RECORD."""try: