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.
Linux setup falls back to a compatible compiler when the system one is too new for the GPU toolkit
Bowen Xue91ac7136b838
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.pyindex ead734a..abd474c 100644--- a/freevideo_engine/bootstrap.py+++ b/freevideo_engine/bootstrap.py@@ -328,6 +328,34 @@ def usable_git(path=None, env=None):return executable if version and version >= git_floor() else None+def gcc_major(executable, env=None):+ """Major version of a GCC driver, or None when it does not run or does not answer like GCC."""+ try:+ text = subprocess_output.output_external([str(executable), '-dumpfullversion', '-dumpversion'], env=env,+ stderr=subprocess.DEVNULL, timeout=30)+ return int(text.split()[0].split('.')[0])+ except (OSError, subprocess.SubprocessError, ValueError, IndexError):+ return None+++def host_compiler_choice(below, path=None, env=None, find=shutil.which, major=gcc_major):+ """Which C/C++ compiler builds GPU code when the toolkit accepts GCC only below major version `below`.++ ({}, ...) when the system compiler is accepted, or when its version cannot be told: the build then+ behaves as it always did. ({'CC': ..., 'CXX': ...}) when it is too new and a versioned pair+ (g++-15 and gcc-15 ...) is installed beside it. None when no installed compiler is accepted.+ """+ system = find('g++', path=path)+ version = major(system, env) if system else None+ if version is None or version < below:+ return {}+ for candidate in range(below - 1, 8, -1):+ cxx, cc = find('g++-%d' % candidate, path=path), find('gcc-%d' % candidate, path=path)+ if cxx and cc and major(cxx, env) == candidate and major(cc, env) == candidate:+ return {'CC': cc, 'CXX': cxx}+ return None++def existing_parent(path):while not path.exists():path = path.parent@@ -1060,6 +1088,8 @@ def setup_task(label):'windows-runtime-check': ('Check GPU runtime', 'Verify CUDA and the Windows runtime libraries'),'portable-git': ('Prepare Git', 'Install the verified Git packages'),'portable-git-check': ('Prepare Git', 'Check the installed Git'),+ 'portable-gcc': ('Prepare compiler', 'Install the verified compiler packages'),+ 'portable-gcc-check': ('Prepare compiler', 'Check the installed compiler'),}title, detail = tasks.get(key, ('Prepare dependencies', 'Prepare verified source files'))for prefix, name in (('h3-text-encoder-', 'text encoder'), ('SageAttention-', 'SageAttention 2')):@@ -1640,9 +1670,9 @@ class Installer:'torch=str(torch.__version__),cuda=torch.version.cuda,cxx11_abi=torch.compiled_with_cxx11_abi(), ''machine=platform.machine(),glibc=platform.libc_ver())))')identity = json.loads(subprocess_output.output_python([str(python), '-c', code], env=self.env))+ compiler = self.host_compiler(identity['cuda'])identity.update(arch='.'.join(map(str, self.plan['inventory']['hardware']['capability'])),- source=self.spec['sageattention']['commit'], compiler=subprocess_output.output_external(- ['g++', '--version']).splitlines()[0])+ source=self.spec['sageattention']['commit'], compiler=compiler['identity'])wheel_dir = Path(self.plan['wheel_cache']) / wheel_key(identity)manifest = wheel_dir / 'manifest.json'record = json.loads(manifest.read_text(encoding='utf-8')) if manifest.is_file() else None@@ -1672,6 +1702,7 @@ class Installer:build_env = dict(self.env, CUDA_HOME=str(toolkit), PATH=str(toolkit / 'bin') + os.pathsep + self.env['PATH'],CPATH=headers, TORCH_CUDA_ARCH_LIST=identity['arch'], MAX_JOBS=str(build['jobs']),EXT_PARALLEL='1', NVCC_APPEND_FLAGS='--threads=' + str(build['nvcc_threads']))+ build_env.update(compiler['env'] if compiler['env'] is not None else self.install_compiler_linux())self.command('sage2-toolchain-check', [python, '-c','from torch.utils.cpp_extension import is_ninja_available; ''assert is_ninja_available(), "Ninja must be visible in the build PATH; serial fallback is refused"'], env=build_env)@@ -1690,6 +1721,47 @@ class Installer:save(self.run_dir / 'sage-wheel.json', dict(record, reused=cached, cache=str(wheel_dir)))return manifest+ def host_compiler(self, cuda):+ """The compiler pair Sage is built with: the system's, a versioned one beside it, or FreeVideo's own.++ `env` is empty when the system compiler is used; `identity` names the compiler in the wheel cache key.+ A portable compiler is only installed when a build is needed (see install_compiler_linux).+ """+ spec = json.loads((PACKAGE / 'gcc_linux.json').read_text(encoding='utf-8'))+ below = spec['host_compiler_below'].get(cuda)+ choice = host_compiler_choice(below, self.env['PATH'], self.env) if below else {}+ if choice is None:+ return {'env': None, 'identity': 'conda-forge gcc ' + spec['version']}+ cxx = choice.get('CXX', 'g++')+ return {'env': choice, 'identity': subprocess_output.output_external([cxx, '--version']).splitlines()[0]}++ def install_compiler_linux(self):+ """GCC from conda-forge, pinned by package hashes, for a system compiler newer than the toolkit accepts."""+ spec = json.loads((PACKAGE / 'gcc_linux.json').read_text(encoding='utf-8'))+ prefix = self.root / 'tools' / ('gcc-' + spec['version'])+ triple = 'x86_64-conda-linux-gnu'+ compilers = {'CC': prefix / 'bin' / (triple + '-gcc'), 'CXX': prefix / 'bin' / (triple + '-g++')}+ receipt, content = prefix / '.freevideo-gcc.json', {k: spec[k] for k in ('version', 'packages')}+ if not (receipt.is_file() and json.loads(receipt.read_text(encoding='utf-8')) == content+ and all(path.is_file() for path in compilers.values())):+ micromamba, packages = self.fetch_conda_lock(spec, 'gcc-linux', 'compiler')+ if prefix.is_symlink():+ prefix.unlink()+ elif prefix.exists():+ shutil.rmtree(prefix)+ explicit = self.root / 'downloads' / 'gcc-linux' / 'explicit.txt'+ explicit.write_text('@EXPLICIT\n' + ''.join(path.resolve().as_uri() + '\n' for path in packages), encoding='utf-8')+ cache = self.root / 'tools' / 'micromamba-root'+ env = {k: v for k, v in self.env.items() if not k.upper().startswith(('CONDA', 'MAMBA'))}+ self.command('portable-gcc', [micromamba, 'create', '--yes', '--no-rc', '--offline',+ '--root-prefix', cache, '--prefix', prefix, '--file', explicit], env=env)+ save(receipt, content)+ shutil.rmtree(cache, ignore_errors=True)+ shutil.rmtree(explicit.parent, ignore_errors=True)+ micromamba.unlink(missing_ok=True)+ self.command('portable-gcc-check', [compilers['CXX'], '--version'])+ return {key: str(path) for key, path in compilers.items()}+def install_sage_windows(self, uv, python):spec = self.versions['windows']['sageattention']directory = Path(self.plan['wheel_cache']) / 'windows-sage2' / spec['sha256'][:16]@@ -1750,7 +1822,10 @@ class Installer:def fetch_git_linux(self, spec):"""micromamba and the locked packages, verified by SHA-256, as one step."""- directory = self.root / 'downloads' / 'git-linux'+ return self.fetch_conda_lock(spec, 'git-linux', 'Git')++ def fetch_conda_lock(self, spec, folder, label):+ directory = self.root / 'downloads' / foldertool = spec['micromamba']micromamba = self.root / 'tools' / ('micromamba-' + tool['version'])channels = spec['channels']@@ -1762,21 +1837,21 @@ class Installer:rows += [(directory / row['path'].split('/')[-1], [(n, channels[n] + '/' + row['path']) for n in names], row)for row in spec['packages']]total = sum(row['bytes'] for _, _, row in rows)- key = 'download-git-linux'- self.ui.begin(key, 'Prepare Git', detail='Download and verify Git %s' % spec['version'])+ key = 'download-' + folder+ self.ui.begin(key, 'Prepare ' + label, detail='Download and verify %s %s' % (label, spec['version']))done = 0try:for path, candidates, row in rows:def progress(current, size, speed, before=done):if self.cancel.is_set():raise RuntimeError('Installation cancelled; partial download retained.')- # One step for micromamba and the packages: the line names Git with the step's total.- self.ui.update(key, done=before + current, total=total, rate=speed, unit='bytes', scope='git',- activity='download', name='Git',+ # One step for micromamba and the packages: the line names the tool with the step's total.+ self.ui.update(key, done=before + current, total=total, rate=speed, unit='bytes', scope=label.lower(),+ activity='download', name=label,detail='%.1f MiB / %.1f MiB' % ((before + current) / 2**20, total / 2**20))def feedback(event):if event['action'] in ('retry', 'route-retry'):- self.ui.update(key, activity='resume', name='Git')+ self.ui.update(key, activity='resume', name=label)network.download(candidates, path, row['sha256'], progress,network=dict(self.network, quiet=True, event_callback=feedback),env=self.env, size=row['bytes'], category='github' if path == micromamba else 'download')diff --git a/freevideo_engine/gcc_linux.json b/freevideo_engine/gcc_linux.jsonnew file mode 100644index 0000000..b832a47--- /dev/null+++ b/freevideo_engine/gcc_linux.json@@ -0,0 +1,115 @@+{+ "version": "14.4.0",+ "host_compiler_below": {+ "12.9": 15,+ "13.0": 16+ },+ "micromamba": {+ "version": "2.9.0-0",+ "url": "https://github.com/mamba-org/micromamba-releases/releases/download/2.9.0-0/micromamba-linux-64",+ "sha256": "366cd9cd8be14df1ab8ed50352a82111082a36686b2d389fdb79a92c3fafb3e3",+ "bytes": 18292808+ },+ "channels": {+ "official": "https://conda.anaconda.org/conda-forge",+ "tuna": "https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge",+ "nju": "https://mirror.nju.edu.cn/anaconda/cloud/conda-forge"+ },+ "packages": [+ {+ "path": "linux-64/_openmp_mutex-4.5-20_gnu.conda",+ "sha256": "1dd3fffd892081df9726d7eb7e0dea6198962ba775bd88842135a4ddb4deb3c9",+ "bytes": 28948+ },+ {+ "path": "linux-64/binutils_impl_linux-64-2.46.1-default_hfdba357_103.conda",+ "sha256": "98f9ddc6dc5d56a824b7eaea5bab6ad4bb47642288fc70d6b1b4024ac39d5595",+ "bytes": 3706604+ },+ {+ "path": "linux-64/binutils_linux-64-2.46.1-default_h4852527_103.conda",+ "sha256": "606a42c754752fb905fe2012d52ff370d47b5b6adefd5f7befc4ec30ce758f23",+ "bytes": 36335+ },+ {+ "path": "linux-64/gcc_impl_linux-64-14.4.0-h4b2a866_7.conda",+ "sha256": "fe3d0c2cbd59755ddd8364c79b8e1a09b3125581d9df07170f102bc150740632",+ "bytes": 78647149+ },+ {+ "path": "linux-64/gcc_linux-64-14.4.0-hc469d41_2.conda",+ "sha256": "082fb68319027d485cc9b4d8effc3faa49d2edb13bc530f849acd321c8cfb6c2",+ "bytes": 30385+ },+ {+ "path": "linux-64/gxx_impl_linux-64-14.4.0-hc436dd5_7.conda",+ "sha256": "8082bf31bf210f55ab3e69bbc301e5131b8fe2986c743b4d4486d469dc737ac3",+ "bytes": 15847507+ },+ {+ "path": "linux-64/gxx_linux-64-14.4.0-h0047a55_2.conda",+ "sha256": "9801d3b03494c5530e6574eae1055d8b5bbb99d0ac75d3bca8757c17a2f3a001",+ "bytes": 28787+ },+ {+ "path": "linux-64/ld_impl_linux-64-2.46.1-default_hbd61a6d_103.conda",+ "sha256": "901649b1edbe841fd4ee7e2d491a05184ed540eb01cdae506872f344babc1d28",+ "bytes": 742109+ },+ {+ "path": "linux-64/libgcc-16.2.0-ha9f2e26_7.conda",+ "sha256": "e031634c3a928f9594eba868bc46ef5230d6571a364a0c63215b06c4563bfcea",+ "bytes": 1058444+ },+ {+ "path": "linux-64/libgomp-16.2.0-he0feb66_7.conda",+ "sha256": "92a0bb350c7be6a4eedcb4e111c60aefd176018e6b1c009a6e025dbe9bbcd758",+ "bytes": 640566+ },+ {+ "path": "linux-64/libsanitizer-14.4.0-hf39dbba_7.conda",+ "sha256": "7a4c47d699e6e9640aa8061f461ab31e71ba7d41994a451ea1e79a3801e8f6c3",+ "bytes": 7211298+ },+ {+ "path": "linux-64/libstdcxx-16.2.0-h934c35e_7.conda",+ "sha256": "fa7018298629fc429971fffd6ecba3d27a7b02e4e890d6a93ea01ffebe8cb745",+ "bytes": 6615436+ },+ {+ "path": "linux-64/libzlib-1.3.2-h25fd6f3_3.conda",+ "sha256": "eb8a0db0aa570124f7d2a93d7c7f596e3390df5e047818d873baad32985fc736",+ "bytes": 63713+ },+ {+ "path": "linux-64/zstd-1.5.7-hb78ec9c_7.conda",+ "sha256": "47d682b9f6d6ec9eb1a6e6c3e75ea6273e899e78fb7fc59f81d39745009fbc60",+ "bytes": 601301+ },+ {+ "path": "noarch/kernel-headers_linux-64-5.14.0-he073ed8_3.conda",+ "sha256": "c4d973dd80ab10028b3e4c58c1c6d8f437bfeaf6069dafb1130dabc550e9caf4",+ "bytes": 1410267+ },+ {+ "path": "noarch/libgcc-devel_linux-64-14.4.0-hd9a9cd0_107.conda",+ "sha256": "fb09fdc5d12cc929ff0af73fbd7cf33be7b473a46fe11353a21ec1ffa468c657",+ "bytes": 3090192+ },+ {+ "path": "noarch/libstdcxx-devel_linux-64-14.4.0-ha5b54cb_107.conda",+ "sha256": "a518b2878cecd324082d334d36907156b68074b18736c111b15ff34efcb22aaf",+ "bytes": 19512223+ },+ {+ "path": "noarch/sysroot_linux-64-2.34-h087de78_3.conda",+ "sha256": "08c50c314b331730eeb8f87c39a45e5426a5463e078392ab283e2552d753443e",+ "bytes": 40779381+ },+ {+ "path": "noarch/tzdata-2026c-h151e31d_0.conda",+ "sha256": "b928c30ddcb0e3f544c6eade8352737e6e610e263276b90232db6a578ef899d8",+ "bytes": 118849+ }+ ]+}diff --git a/pyproject.toml b/pyproject.tomlindex 0b0a3b9..b9d438d 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -32,4 +32,4 @@ include = ["freevideo_engine*"][tool.setuptools.package-data]"freevideo_engine.prompt_vlm" = ["model.json"]-freevideo_engine = ["stage_estimate_params.json", "build-version.txt", "build-identity.json", "release_notes.json", "dependencies.json", "model_files.json", "model_shares.json", "prepared_models.json", "macos_reference_catalog.json", "superseded_tables.json", "bootstrap_versions.json", "curl_windows.json", "git_linux.json", "uv_downloads.json", "torch_downloads.json", "test_prompts.json", "windows_bootstrap.ps1", "assets/*.png", "assets/*.ico", "launcher/*.qml", "launcher/licenses/*.txt", "licenses/*.txt", "licenses/runtime/*.txt", "subtitle_pack.json"]+freevideo_engine = ["stage_estimate_params.json", "build-version.txt", "build-identity.json", "release_notes.json", "dependencies.json", "model_files.json", "model_shares.json", "prepared_models.json", "macos_reference_catalog.json", "superseded_tables.json", "bootstrap_versions.json", "curl_windows.json", "git_linux.json", "gcc_linux.json", "uv_downloads.json", "torch_downloads.json", "test_prompts.json", "windows_bootstrap.ps1", "assets/*.png", "assets/*.ico", "launcher/*.qml", "launcher/licenses/*.txt", "licenses/*.txt", "licenses/runtime/*.txt", "subtitle_pack.json"]