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.

Keep 8 attention heads in Windows first passes with reference images or keyframes (0.3.19) (#134)

Bowen Xue1a78acf7526a
diff --git a/freevideo_engine/backends/base.py b/freevideo_engine/backends/base.py
index e21f731..6b45e83 100644
--- a/freevideo_engine/backends/base.py
+++ b/freevideo_engine/backends/base.py
@@ -52,6 +52,10 @@ class DeviceBackend(ABC):
@abstractmethod
def max_memory_reserved(self): ...
+ def memory_reserved(self):
+ """Bytes the allocator currently holds, or None where it is not exposed."""
+ return None
+
@abstractmethod
def reset_peak_memory_stats(self): ...
diff --git a/freevideo_engine/backends/cuda.py b/freevideo_engine/backends/cuda.py
index 841530f..5231ab9 100644
--- a/freevideo_engine/backends/cuda.py
+++ b/freevideo_engine/backends/cuda.py
@@ -38,6 +38,9 @@ class CUDABackend(DeviceBackend):
def max_memory_reserved(self):
return self.torch.cuda.max_memory_reserved()
+ def memory_reserved(self):
+ return self.torch.cuda.memory_reserved()
+
def reset_peak_memory_stats(self):
return self.torch.cuda.reset_peak_memory_stats()
diff --git a/freevideo_engine/policy.py b/freevideo_engine/policy.py
index b449fed..94c07b8 100644
--- a/freevideo_engine/policy.py
+++ b/freevideo_engine/policy.py
@@ -88,7 +88,15 @@ SMALL_ACTIVATION_RESERVES = ((8, int(8.2 * GiB)), (4, int(7.6 * GiB)))
# not prove that the linear-attention scan workspace remains the same.
# Larger groups can change floating-point rounding; bit identity is not a
# requirement for a measured chunking policy. Sixteen was no faster here.
-WINDOWS_SMALL_HEAD8_TOKENS = 18144
+#
+# The ceiling used to be that canvas alone, so one image reference or keyframe
+# (1008 rows at 1344x768) put a 10-second first pass back on four heads.
+# Native Windows int8, RTX 5060 Ti held to an 8 GiB laptop's 7.14 GB budget,
+# 1344x768x243 with one image reference: head 4/8 at 20.90/19.22 s per warm
+# first-pass step, 6.39/6.28 GB reserved with the pass cache. With four image
+# references (18144 + 4032 rows) eight heads peaked at 6.64 GB reserved, no
+# allocator retry and no sample over the local budget.
+WINDOWS_SMALL_HEAD8_TOKENS = 18144 + 4 * 1008
WINDOWS_SMALL_HEAD8_FRAMES = 243
# Keeping the attention outputs on the GPU instead of in host memory costs this
# much extra peak. See benchmarks/2026-09-15-consumer-capacity-grid.json. Measured at four corners of the band that uses the host
diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json
index 791b1c0..e486ef9 100644
--- a/freevideo_engine/release_notes.json
+++ b/freevideo_engine/release_notes.json
@@ -1,19 +1,36 @@
{
"schema": 1,
- "product_version": "0.3.18",
+ "product_version": "0.3.19",
"en": {
- "summary": "On Windows computers with little RAM, loading the video model reads much less from the disk.",
+ "summary": "On Windows, GPUs with 8 or 10 GB of memory sample the first pass a little faster when a video uses reference images, a first or last frame, or reference audio.",
"changes": [
- "On Windows, when RAM cannot hold the whole video model, loading no longer reads the model layers that sampling streams from the disk anyway; each is read when sampling first needs it. With 16 GB of RAM, that is about 13 GB less to read every time the model loads: on an RTX 5060 Ti test machine limited to the RAM of a 16 GB computer, loading took 7 seconds instead of 11, and on a slower drive the saving is a few minutes. Videos are unchanged. Computers that keep the whole model in RAM, Linux and Mac load as before."
+ "On Windows GPUs with 8 or 10 GB of memory, the first pass of a video up to 10 seconds long now runs attention 8 heads at a time when the video uses reference images, a first or last frame, or reference audio, as text-only videos already did, instead of 4. With one reference image, a 10-second 1344×768 video took about 8% less time per first-pass step on an 8 GB budget, staying within the same video memory budget. The same seed can give a slightly different video than before, as it already does between GPUs with different memory.",
+ "On Windows, the model layers kept on the GPU between first-pass steps no longer shrink from step to step, so fewer layers are transferred again on each step."
]
},
"zh": {
- "summary": "在内存较小的 Windows 电脑上,加载视频模型时从硬盘读取的数据少了很多。",
+ "summary": "在 Windows 上,8 GB 和 10 GB 显存的显卡生成带参考图、首尾帧或参考音频的视频时,第一遍采样稍快一些。",
"changes": [
- "在 Windows 上,内存放不下整个视频模型时,加载阶段不再预先读取那些采样时本来就要从硬盘读取的模型层,改为采样第一次用到时再读。16 GB 内存的电脑每次加载模型可少读约 13 GB:在按 16 GB 电脑的内存条件运行的 RTX 5060 Ti 测试机上,加载从 11 秒缩短到 7 秒;硬盘较慢时可节省几分钟。生成的视频不变。内存能放下整个模型的电脑、Linux 和 Mac 的加载方式不变。"
+ "在 8 GB 和 10 GB 显存的 Windows 显卡上,10 秒以内的视频如果带参考图、首帧或尾帧、参考音频,第一遍注意力改为每次计算 8 个头(原来是 4 个),与纯文本生成一致。带一张参考图生成 10 秒 1344×768 视频时,在 8 GB 显存预算下第一遍每步缩短约 8%,显存仍在原来的预算之内。同一个种子生成的视频可能与以前略有不同,就像在显存不同的显卡上本来就会有差异一样。",
+ "在 Windows 上,第一遍步与步之间保留在显卡上的模型层不再逐步减少,每步需要重新传输的层更少。"
]
},
"history": [
+ {
+ "product_version": "0.3.18",
+ "en": {
+ "summary": "On Windows computers with little RAM, loading the video model reads much less from the disk.",
+ "changes": [
+ "On Windows, when RAM cannot hold the whole video model, loading no longer reads the model layers that sampling streams from the disk anyway; each is read when sampling first needs it. With 16 GB of RAM, that is about 13 GB less to read every time the model loads: on an RTX 5060 Ti test machine limited to the RAM of a 16 GB computer, loading took 7 seconds instead of 11, and on a slower drive the saving is a few minutes. Videos are unchanged. Computers that keep the whole model in RAM, Linux and Mac load as before."
+ ]
+ },
+ "zh": {
+ "summary": "在内存较小的 Windows 电脑上,加载视频模型时从硬盘读取的数据少了很多。",
+ "changes": [
+ "在 Windows 上,内存放不下整个视频模型时,加载阶段不再预先读取那些采样时本来就要从硬盘读取的模型层,改为采样第一次用到时再读。16 GB 内存的电脑每次加载模型可少读约 13 GB:在按 16 GB 电脑的内存条件运行的 RTX 5060 Ti 测试机上,加载从 11 秒缩短到 7 秒;硬盘较慢时可节省几分钟。生成的视频不变。内存能放下整个模型的电脑、Linux 和 Mac 的加载方式不变。"
+ ]
+ }
+ },
{
"product_version": "0.3.17",
"en": {
@@ -232,29 +249,6 @@
"已保存的模型文件夹如果已被删除(例如删除了离线包目录),会自动跳过,不再阻止安装或离线导入。"
]
}
- },
- {
- "product_version": "0.3.6",
- "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.",
- "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."
- ]
- },
- "zh": {
- "summary": "int8 生成更多地留在显卡上:8 到 24 GB 显卡能更快地生成更长、更大的视频;偶尔显存不足也不再拖慢之后的视频。",
- "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 余量,权重缓存不再溢出到共享内存。",
- "离线安装可以一起导入可选的「音频参考缓存」包,用音频做参考时不必再联网下载对应的缓存。"
- ]
- }
}
]
}
diff --git a/freevideo_engine/runtime.py b/freevideo_engine/runtime.py
index d3ecd02..6331819 100644
--- a/freevideo_engine/runtime.py
+++ b/freevideo_engine/runtime.py
@@ -618,8 +618,10 @@ class Engine:
cached = offloader.cached_bytes()
free, _ = owner.device_backend.memory_info()
commit = system_memory().get('commit_available_bytes')
- allowance = pass_cache_allowance(live_budget, base_peak, free + cached,
- gpu_reserve_bytes, None if commit is None else commit + cached)
+ from .two_pass import reusable_cache_bytes
+ held = reusable_cache_bytes(cached, owner.device_backend.memory_reserved(), base_peak)
+ allowance = pass_cache_allowance(live_budget, base_peak, free + held,
+ gpu_reserve_bytes, None if commit is None else commit + held)
pass_cache.update(gpu_budget_bytes=live_budget, measured_peak_reserved_bytes=peak,
live_free_bytes=free, commit_available_bytes=commit, admitted_bytes=allowance)
# New planes fill during the next step and only save a
diff --git a/freevideo_engine/two_pass.py b/freevideo_engine/two_pass.py
index d8992d8..bde5664 100644
--- a/freevideo_engine/two_pass.py
+++ b/freevideo_engine/two_pass.py
@@ -186,6 +186,20 @@ def pass_cache_allowance(budget, peak_reserved, free, reserve, commit_available=
return max(0, int(min(bounds)) - 512 * 2**20)
+def reusable_cache_bytes(cached, reserved, workspace_peak):
+ """Device bytes a pass cache holds or can take back without a new allocation.
+
+ Planes dropped from the cache stay in the allocator's pool, where
+ mem_get_info no longer counts them as free. Counting only the planes still
+ cached shrank the cache again at every step: an 8 GiB Windows card filled
+ eight first-pass planes after its first step and ended the pass with one.
+ What the allocator holds beyond the step's own peak is the cache's to reuse.
+ """
+ if reserved is None:
+ return cached
+ return max(cached, reserved - workspace_peak)
+
+
def first_pass_policy(profile, canvas, sampling_plan):
"""Run the existing token-aware policy within the admitted request budgets.