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.

Leaner Windows int8 attention, offline packages checked by their runtime, tidier report downloads (0.3.10) (#109)

Bowen Xuefecab0f8e6bf
diff --git a/.github/ISSUE_TEMPLATE/bug_engine.yml b/.github/ISSUE_TEMPLATE/bug_engine.yml
index 0861f78..dde2515 100644
--- a/.github/ISSUE_TEMPLATE/bug_engine.yml
+++ b/.github/ISSUE_TEMPLATE/bug_engine.yml
@@ -16,4 +16,4 @@ body:
id: report
attributes:
label: Error or local report (optional) / 错误详情或本地报告(选填)
- description: Attach video.debug.json if available; it includes hardware and timing information. / 如有 video.debug.json,可拖入此处;其中已包含硬件和耗时信息。
+ description: Attach the diagnostic report (FreeVideo-report-….json, or video.debug.json in the output folder) if available; it includes hardware and timing information. / 如有诊断报告(FreeVideo-report-….json,或输出文件夹里的 video.debug.json),可拖入此处;其中已包含硬件和耗时信息。
diff --git a/.github/ISSUE_TEMPLATE/report.yml b/.github/ISSUE_TEMPLATE/report.yml
index 6aa232d..52a2cdb 100644
--- a/.github/ISSUE_TEMPLATE/report.yml
+++ b/.github/ISSUE_TEMPLATE/report.yml
@@ -13,8 +13,8 @@ body:
id: report
attributes:
label: Diagnostic report / 诊断报告
- description: Please drag video.debug.json here. In FreeVideo, select Diagnostic report under a finished video. / 请将 video.debug.json 拖到这里(在 FreeVideo 视频下方点击「诊断报告」即可获得)。
- placeholder: Drop video.debug.json here / 将 video.debug.json 拖到这里
+ description: Please drag the downloaded report (FreeVideo-report-….json) here. In FreeVideo, select Diagnostic report under a finished video. / 请将下载的诊断报告(FreeVideo-report-….json)拖到这里(在 FreeVideo 视频下方点击「诊断报告」即可获得)。
+ placeholder: Drop FreeVideo-report-….json here / 将 FreeVideo-report-….json 拖到这里
validations:
required: true
- type: input
diff --git a/freevideo_engine/comfy_library.py b/freevideo_engine/comfy_library.py
index 595da37..e46df75 100644
--- a/freevideo_engine/comfy_library.py
+++ b/freevideo_engine/comfy_library.py
@@ -126,10 +126,13 @@ def video_download(output_directory, identity):
return path, 'FreeVideo_%s_%s.mp4' % (stamp, identity.split('/')[-1][:12])
-# What a FreeVideo request writes into its own run folder. A creation whose
-# folder holds anything else, or any link, is not deleted at all.
-_OWNED_FILE = re.compile(r'video\.[A-Za-z0-9._-]+|prompt\.txt|workflow\.json|comfy-request\.json|generate\.log'
- r'|media\.json|input-conditioning\.pt|(?:first|last)\.png|reference-\d{2}\.(?:png|mp4|wav)')
+# What a FreeVideo request writes into its own run folder, including the
+# prompt-enhancement record and the staging copy monitoring.save keeps when
+# Windows would not let it replace a JSON record. A creation whose folder
+# holds anything else, or any link, is not deleted at all.
+_OWNED_FILE = re.compile(r'(?:video\.[A-Za-z0-9._-]+|prompt\.txt|workflow\.json|comfy-request\.json|generate\.log'
+ r'|media\.json|prompt-rewrite\.json|input-conditioning\.pt|(?:first|last)\.png'
+ r'|reference-\d{2}\.(?:png|mp4|wav))(?:\.[a-z0-9_]{8}\.tmp)?')
_OWNED_FOLDER = 'video.artifacts'
_REPARSE_POINT = 0x400
diff --git a/freevideo_engine/comfy_progress.py b/freevideo_engine/comfy_progress.py
index f3a0492..ac8de04 100644
--- a/freevideo_engine/comfy_progress.py
+++ b/freevideo_engine/comfy_progress.py
@@ -135,7 +135,7 @@ def register():
raise web.HTTPServiceUnavailable(text='Report not ready; try again') from None
return web.Response(body=data, content_type='application/json', headers={
'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff',
- 'Content-Disposition': 'attachment; filename="video.debug.json"'})
+ 'Content-Disposition': 'attachment; filename="FreeVideo-report-%s.json"' % time.strftime('%Y%m%d-%H%M%S')})
@server.routes.get('/freevideo/progress')
async def progress(request):
diff --git a/freevideo_engine/head_chunk.py b/freevideo_engine/head_chunk.py
index f72fece..7b9c4fb 100644
--- a/freevideo_engine/head_chunk.py
+++ b/freevideo_engine/head_chunk.py
@@ -5,11 +5,18 @@ No heads, windows, text states or scan frames are dropped. Sliced GEMMs can
change floating-point reduction order and must be reported as an ablation.
"""
from contextlib import nullcontext
+import gc
import types
import torch
import torch.nn.functional as F
+# Sequence lengths whose first attention call has run. That call compiles, and
+# the compile leaves each head group's frame, with its Q/K/V, in a reference
+# cycle: under Windows the next group then ran beside a dead group's Q/K/V.
+# The first call of each length collects after every group.
+COLLECTED_LENGTHS = set()
+
# Rows per output-projection tile on the GPU tail. Int8 results do not depend on
# the tiling; 1024-row tiles cost about 2% of a second-pass step in launches.
TAIL_ROWS = 8192
@@ -31,6 +38,17 @@ class RowPlanes:
yield slice(offset + row, offset + min(row + size, len(plane))), plane[row:row + size]
+def project_rows(planes, out, project, size=TAIL_ROWS):
+ """Project RowPlanes into out in ascending row tiles.
+
+ out may share storage with planes.lead when the plane is at least as wide
+ as out: tile [a, b) then writes over the lead's rows below b * out / width,
+ which this tile or an earlier one has already read.
+ """
+ for rows, part in planes.blocks(size):
+ out[rows] = project(part)
+
+
def install_head_chunks(transformer, policy, chunk, cpu_outputs=False, projection_chunk=1024, grouped_outputs=False,
parallelism=1):
if chunk < 1 or projection_chunk < 1:
@@ -208,9 +226,13 @@ def install_head_chunks(transformer, policy, chunk, cpu_outputs=False, projectio
for tensor in shared:
tensor.record_stream(stream)
try:
+ fresh = not streams and len(x) not in COLLECTED_LENGTHS
for index, start in enumerate(range(0, attn.num_heads, chunk)):
with torch.cuda.stream(streams[index % len(streams)]) if streams else nullcontext():
group(start)
+ if fresh:
+ gc.collect()
+ COLLECTED_LENGTHS.add(len(x))
finally:
# Output projection, offload cleanup and the next block cannot
# race unfinished groups, including after a recoverable OOM.
@@ -262,9 +284,17 @@ def install_head_chunks(transformer, policy, chunk, cpu_outputs=False, projectio
# written back into it.
if isinstance(soft, RowPlanes):
taken.clear() # x's int8 rows
- out = x.new_empty((len(x), output_width))
- for rows, part in soft.blocks(TAIL_ROWS):
- out[rows] = orig.to_out[1](orig.to_out[0](part))
+ # The softmax plane's leading rows occupy x's storage. Output rows
+ # [a, b) overwrite the bytes of softmax rows below b * out / width,
+ # all projected by this tile or an earlier one, so the output goes
+ # back into x instead of a new sequence buffer. Without expandable
+ # segments (Windows) that buffer was the allocation the freed
+ # attention temporaries could not hold: 1344x768x362 reserved
+ # 7.05 GiB for 5.74 allocated, 6.06 with the output in x.
+ inplace = (x.shape[1] == output_width and x.is_contiguous()
+ and soft.lead.shape[1] >= output_width)
+ out = x if inplace else x.new_empty((len(x), output_width))
+ project_rows(soft, out, lambda part: orig.to_out[1](orig.to_out[0](part)))
else:
owned = getattr(attn, '_freevideo_owns_input', False) and x.shape[1] == output_width and x.is_contiguous()
out = x if owned else x.new_empty((len(x), output_width))
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index 61a2982..8fde211 100644
--- a/freevideo_engine/launcher_session.py
+++ b/freevideo_engine/launcher_session.py
@@ -905,6 +905,10 @@ class Session:
if imported.get('packages'):
self.edit('model_method', 'manual')
self.persist()
+ if imported.get('runtime_skipped') and not any(p['kind'] == 'runtime' for p in imported.get('packages', [])):
+ # The runtime installs automatically; imported model packages still feed it.
+ self.edit('offline_runtime', '')
+ self.edit('environment_method', 'auto')
if imported['status'] == 'error':
self.import_retry = retry
self.error = imported['error']
diff --git a/freevideo_engine/offline_packages.py b/freevideo_engine/offline_packages.py
index ee36d0e..88e52ea 100644
--- a/freevideo_engine/offline_packages.py
+++ b/freevideo_engine/offline_packages.py
@@ -34,6 +34,7 @@ def pack_name(path):
def dependency_id():
+ """Hash of the whole dependency files; earlier EXEs compare Environment ZIPs by it."""
root = Path(__file__).resolve().parent
digest = hashlib.sha256()
for path in (root / 'dependencies.json', root / 'bootstrap_versions.json',
@@ -42,6 +43,43 @@ def dependency_id():
return digest.hexdigest()
+# An Environment ZIP holds Python with the pinned packages, the bootstrap tools,
+# and ComfyUI, vdn, diffusers and SageAttention at their pinned commits. Model
+# rows in dependencies.json are not part of it, so a model change keeps the ZIP.
+RUNTIME_KEYS = ('vdn', 'diffusers', 'encoder', 'sageattention')
+# Earlier ZIPs carry only dependency_id, which also hashes the model rows.
+# Each of these described the same runtime as runtime_id 5237c884... .
+EARLIER_RUNTIMES = dict.fromkeys((
+ '32bb93ff31957e629714fb5445562bad39acd51d22bd266705947646072f6175',
+ '5df201020be0ca6b9cd71f4be2c6b331b402280fec556c721388fd9ed28ec001',
+ 'a6a447449e2fb66b360846902498256e1f7a243a51bbc7d2269202a9b5786eac',
+ 'f8f960e68e4c6caac38ded62c87133097dc39e726e0918352460a5ae81397378',
+ 'ea87a269c0fafa5446d9d1c501c5accc3f1f1f6970ad6fa5d6d725fde33a9593',
+), '5237c88452f01b060b664dde4ac237329e28314c3f5a82fe4d1a01c9612543cb')
+SKIPPED_RUNTIME = '运行环境包与这个版本不配套,已跳过;运行环境改为自动安装,其余离线包照常使用。'
+
+
+class RuntimeMismatch(ValueError):
+ """An Environment ZIP for another runtime: skip it and install the runtime online."""
+
+
+def runtime_id():
+ """What the current version needs inside an Environment ZIP, independent of models."""
+ root = Path(__file__).resolve().parent
+ dependencies = json.loads((root / 'dependencies.json').read_text(encoding='utf-8'))
+ value = dict(dependencies={key: dependencies[key] for key in RUNTIME_KEYS if key in dependencies},
+ bootstrap=json.loads((root / 'bootstrap_versions.json').read_text(encoding='utf-8')),
+ constraints=(root.parent / 'constraints/windows-portable.txt').read_text(encoding='utf-8')
+ .replace('\r\n', '\n'))
+ return hashlib.sha256(json.dumps(value, sort_keys=True, separators=(',', ':')).encode()).hexdigest()
+
+
+def runtime_fits(value):
+ """Any earlier ZIP whose runtime is unchanged serves this version."""
+ found = value.get('runtime_id') or EARLIER_RUNTIMES.get(value.get('dependency_id'))
+ return value.get('schema_version') == 2 and found == runtime_id()
+
+
def inventory(rows):
seen = set()
for row in rows:
@@ -83,8 +121,8 @@ def inspect_archive(path):
value = json.loads(raw)
if marker == 'runtime.json':
check_runtime_platform()
- if value.get('schema_version') != 2 or value.get('dependency_id') != dependency_id():
- raise ValueError('运行环境包版本不匹配,请从下载页面获取配套的运行环境包。')
+ if not runtime_fits(value):
+ raise RuntimeMismatch(SKIPPED_RUNTIME)
value = dict(value, kind='runtime', variant=None)
elif value.get('schema_version') != 1 or value.get('kind') != 'models' or value.get('variant') not in MODEL_VARIANTS:
raise ValueError('Invalid model package')
@@ -170,8 +208,8 @@ def assemble(runtime, models, source):
check_runtime_platform()
runtime = Path(runtime)
config = json.loads((runtime / 'runtime.json').read_text(encoding='utf-8'))
- if config.get('schema_version') != 2 or config.get('dependency_id') != dependency_id():
- raise ValueError('运行环境包与安装器不匹配')
+ if not runtime_fits(config):
+ raise RuntimeMismatch(SKIPPED_RUNTIME)
candidates = []
for root in models:
path = Path(root) / 'models/model-pack.json'
@@ -251,6 +289,9 @@ class Importer:
try:
root = assemble(runtime, models, source)
self.state = dict(self.state, status='prepared', ready_root=str(root))
+ except RuntimeMismatch as error:
+ # An earlier import no longer fits after an update: the models stay.
+ self.state = dict(self.state, status='complete', runtime_skipped=True, detail=str(error))
except Exception as error:
self.state = dict(self.state, status='error', error=str(error))
self.thread = threading.Thread(target=work, name='freevideo-offline-prepare', daemon=True)
@@ -264,13 +305,21 @@ class Importer:
def update(**row):
self.state = dict(self.state, **row)
def work():
- try:
- packages = []
- for path in paths:
+ # Take every ZIP that fits; one that does not never holds back the others.
+ packages, skipped, failed = [], False, []
+ for path in paths:
+ try:
packages.append(import_archive(path, destination, update, self.cancelled.is_set))
- update(packages=list(packages))
- update(status='complete')
- except Exception as error:
- update(status='error', error=str(error))
+ except RuntimeMismatch:
+ skipped = True
+ except InterruptedError as error:
+ failed.append(str(error))
+ break
+ except Exception as error:
+ failed.append('%s:%s' % (Path(path).name, error))
+ update(packages=list(packages))
+ if skipped:
+ update(runtime_skipped=True, detail=SKIPPED_RUNTIME)
+ update(**(dict(status='error', error='\n'.join(failed)) if failed else dict(status='complete')))
self.thread = threading.Thread(target=work, name='freevideo-package-import', daemon=True)
self.thread.start()
diff --git a/freevideo_engine/offload.py b/freevideo_engine/offload.py
index d9e373b..fcc9d3d 100644
--- a/freevideo_engine/offload.py
+++ b/freevideo_engine/offload.py
@@ -171,8 +171,15 @@ class Slot:
# holds. It used to borrow the 8 GiB weight-cache allowance, which no 16 GiB
# machine reaches while sampling: a 16 GiB RTX 3060 Laptop reread all 21.6 GB
# of weights every step (about 80 s) with reads and compute never overlapping.
-# The runtime check in _queue_host stops read-ahead again under live pressure.
-HOST_PREFETCH_HEADROOM = 3 * 2**30
+# 3 GiB still kept 32 GiB machines busy with other applications (2-3.5 GiB
+# available while sampling) from overlapping. The read-ahead adds one block of
+# locked pages, and the reads happen either way. With 41 GiB held by another
+# process on a 56 GiB RTX 3090 machine (about 2 GiB available while sampling),
+# 1344x768x124 went from 15.5-15.9 to 10.7-10.9 s per first-pass step and
+# 29.8-30.0 to 26.0-26.1 per second-pass step at 1 GiB, twice each (327-332 s
+# to 283-294 s for the request). The runtime check in _queue_host stops
+# read-ahead again under live pressure.
+HOST_PREFETCH_HEADROOM = 1 * 2**30
def _host_prefetch_fits(extra_bytes):
diff --git a/freevideo_engine/packing.py b/freevideo_engine/packing.py
index 3a23ad5..236f4e2 100644
--- a/freevideo_engine/packing.py
+++ b/freevideo_engine/packing.py
@@ -14,6 +14,7 @@ is in-place under inference, modality projections are released immediately, and
the FP32 projections/output normalization run over bounded row chunks. GEMM
shape changes can alter rounding; this is an explicit optimization profile.
"""
+import gc
import types
import torch
from .fp8 import input_dtype
@@ -24,6 +25,25 @@ from diffusers.models.transformers.transformer_minimax_h3 import MiniMaxH3Transf
def install_streamed_forward(model, chunk=1024, residual_offload=False):
if chunk < 1:
raise ValueError('Projection chunk must be positive')
+ # Compiling for a new sequence length captures Python frames in reference
+ # cycles that also hold the first block's output. The second block stages
+ # that output to host memory and drops it, but the cycle keeps it alive
+ # through the second block's attention until the collector happens to run:
+ # on an RTX 3090 under Windows, 1344x768x362 second passes allocated
+ # 6.82 GiB instead of 5.74. A staged block collects once right after it
+ # drops its input, in the first forward of each new length.
+ collected = set()
+
+ def blocks(self, value, length, temb, adaln_indices, rotary):
+ first = length not in collected
+ collected.add(length)
+ for index, block in enumerate(self.transformer_blocks):
+ if first and index in (1, 2) and hasattr(value, 'collect_after_store'):
+ value.collect_after_store = True
+ value = block(value, temb, adaln_indices, rotary)
+ if first and index == 0 and not hasattr(value, 'collect_after_store'):
+ gc.collect()
+ return value
def forward(self, hidden_states, audio_hidden_states, encoder_hidden_states,
timestep, timestep_indices, token_tags, position_ids,
@@ -57,15 +77,13 @@ def install_streamed_forward(model, chunk=1024, residual_offload=False):
state = ResidualState(packed)
del packed
try:
- for block in self.transformer_blocks:
- state = block(state, temb, adaln_indices, rotary)
+ state = blocks(self, state, length, temb, adaln_indices, rotary)
packed = state.take()
self._freevideo_residual_stats = state.stats()
finally:
state.close()
else:
- for block in self.transformer_blocks:
- packed = block(packed, temb, adaln_indices, rotary)
+ packed = blocks(self, packed, length, temb, adaln_indices, rotary)
video_all = torch.empty((packed.shape[0], length, self.proj_out.out_features),
dtype=self.proj_out.weight.dtype, device=packed.device)
audio_all = torch.empty((packed.shape[0], length, self.audio_proj_out.out_features),
diff --git a/freevideo_engine/policy.py b/freevideo_engine/policy.py
index aab17bb..1f92899 100644
--- a/freevideo_engine/policy.py
+++ b/freevideo_engine/policy.py
@@ -294,30 +294,32 @@ RESIDUAL_ADMISSION_FLOOR = int(6.25 * GiB)
#
# Since the attention tail writes into the block's own input and the softmax
# plane borrows that input's storage (head_chunk.py), the same placement holds
-# one sequence buffer less. Second-pass peaks reserved, four heads, no
-# resident block, int8 ConvRot, 2026-10-07:
+# one sequence buffer less, and on Windows the output goes back into that input
+# too. The first attention call of each length compiles and used to leave dead
+# Q/K/V and the previous block's output in reference cycles until the
+# collector ran; that call now collects (head_chunk.py, packing.py). Second-pass
+# peaks reserved, four heads, no resident block, int8 ConvRot, measured
+# without instrumentation (the earlier Windows figures came from synchronizing
+# probes that hid the cycles: 7.03 GiB recorded where 8.23 was reserved):
#
-# tokens PRO 6000 (Linux) RTX 3090 (Windows, first step included)
+# tokens PRO 6000 (Linux) RTX 3090 (Windows)
# 55944 3.40 GiB 16.1 s
-# 72576 4.18 GiB 20.0 s 5.71 GiB 61.7 s/step (host outputs 79.0)
-# 107856 5.95 GiB 29.2 s 7.03 GiB 91.9 s/step (host outputs 117)
-# 218280 11.10 GiB 64.6 s 13.47 GiB 232 s/step (host outputs 283)
+# 72576 4.18 GiB 20.0 s 4.21 GiB 61.5 s/step (host outputs 79.0)
+# 107856 5.95 GiB 29.2 s 5.97 GiB 91.8 s/step (host outputs 117)
+# 218280 11.10 GiB 64.6 s 11.27 GiB 231.5 s/step (host outputs 283)
#
-# Capped at 6.64 and 6.2 GiB, budgets of 8 GiB cards, the 3090 ran
-# 1344x768x243 at 5.72 GiB reserved and the uncapped 61.6 s/step. On Linux,
-# 1184x672x243 with two resident blocks peaked at 4.20 GiB under the 4.76 GiB
-# budget of a 6 GiB laptop, and 1344x768x243 peaked at 4.18 under 4.55.
+# On Linux, 1184x672x243 with two resident blocks peaked at 4.20 GiB under the
+# 4.76 GiB budget of a 6 GiB laptop, and 1344x768x243 peaked at 4.18 under 4.55.
#
-# Windows keeps more reserved than allocated (5.72 allocated at 107856) and
-# changes its local budget at run time: a larger margin, and below the first
-# measured token count the measurement is not extrapolated. There the plan
-# keeps whichever of the two estimates allows the outputs on the card, so no
-# request that 0.3.3 placed on the card moves to host memory.
+# Windows changes its local budget at run time: a larger margin, and below the
+# first measured token count the measurement is not extrapolated. There the
+# plan keeps whichever of the two estimates allows the outputs on the card, so
+# no request that 0.3.3 placed on the card moves to host memory.
#
# A LoRA branch on an attention projection keeps the full-height tail, so a
# request with adapters is planned from the anchors measured before it.
INT8_GPU_OUTPUT_PEAKS = ((55944, 3.4), (72576, 4.18), (107856, 5.95), (218280, 11.1))
-INT8_GPU_OUTPUT_PEAKS_WINDOWS = ((72576, 5.71), (107856, 7.03), (218280, 13.47))
+INT8_GPU_OUTPUT_PEAKS_WINDOWS = ((72576, 4.21), (107856, 5.97), (218280, 11.27))
INT8_GPU_OUTPUT_PEAKS_FULL_TAIL = ((55944, 4.08), (72576, 5.14))
INT8_GPU_OUTPUT_MARGIN = int(.25 * GiB)
INT8_GPU_OUTPUT_MARGIN_WINDOWS = int(.5 * GiB)
@@ -1074,7 +1076,7 @@ def choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto',
residual_offload = True
# Staging the residual alone is the placement measured under
# Windows (INT8_GPU_OUTPUT_PEAKS_WINDOWS): 1920x1088x362 peaked at
- # 13.47 GiB reserved, where outputs in host memory pinned another
+ # 11.27 GiB reserved, where outputs in host memory pinned another
# 6 GiB of RAM for a slower step.
gpu_need = int8_gpu_output_need(effective_tokens, windows=True, full_tail=lora) if int8 else None
cpu_outputs = gpu_need is None or gpu_budget < gpu_need
diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json
index af94bb3..8029315 100644
--- a/freevideo_engine/release_notes.json
+++ b/freevideo_engine/release_notes.json
@@ -1,26 +1,26 @@
{
"schema": 1,
- "product_version": "0.3.9",
+ "product_version": "0.3.10",
"en": {
- "summary": "Updates no longer leave earlier versions behind, updating your ComfyUI no longer reinstalls PyTorch, and a FreeVideo page that does not load completely now says why.",
+ "summary": "Long videos on Windows cards with 6–16 GB run faster, Environment ZIPs from earlier versions import again, and creations made with prompt enhancement can be deleted.",
"changes": [
- "After an update, the launcher removes the earlier launcher copies and FreeVideo files it no longer uses, and shows how much space was freed. Models, outputs, files you changed and the copies your shortcuts or pinned icons open are kept.",
- "On Windows, the downloaded PyTorch packages (about 1.8 GB) are removed once every environment has them installed. They are only needed to create an environment again.",
- "When ComfyUI runs in FreeVideo's separate environment and you update ComfyUI, the launcher updates that environment before starting it, instead of downloading another one with PyTorch.",
- "An engine folder inside an existing ComfyUI is now ignored by git, so ComfyUI updaters that stash or clean untracked files no longer copy or move its models and environments.",
- "If FreeVideo’s page does not load completely in the browser, for example its styles or the creative workspace are missing, the page now says which file failed, why, and what to do. The launcher shows the same problem, and diagnostic reports include it.",
- "Opening FreeVideo from the launcher now always brings its workflow to the front, even when ComfyUI reopens the tabs from your last session."
+ "On Windows, int8 attention needs about a quarter less GPU memory. More long or large videos now keep attention results on the graphics card instead of in system memory, which makes their steps faster. The output is unchanged.",
+ "When little system memory is free, weights are now read ahead while the previous ones compute, from 1 GB of spare memory instead of 3 GB. Steps that read weights from disk get faster.",
+ "An offline Environment ZIP from an earlier version is accepted again. It now only has to contain the environment this version needs, whichever version it came with.",
+ "When several offline ZIPs are imported together, every one that fits is imported. One that cannot be used no longer stops the others; an environment that does not fit is installed automatically, and the imported models are still used.",
+ "Creations made with prompt enhancement can be deleted from Your creations again.",
+ "Each downloaded diagnostic report is named by when it was saved (FreeVideo-report-date-time.json), so downloading several no longer produces \"video.debug (1).json\", \"(2)\" and so on."
]
},
"zh": {
- "summary": "更新后不再残留旧版本文件;升级 ComfyUI 后不再重新安装 PyTorch;FreeVideo 页面没有完整加载时会说明原因。",
+ "summary": "Windows 上 6–16 GB 显卡生成长视频更快;早先版本的运行环境包重新可以导入;用过提示词增强的作品可以正常删除。",
"changes": [
- "更新完成后,启动器会自动删除不再使用的旧版启动器和 FreeVideo 文件,并显示释放的空间。模型、生成结果、你改动过的文件,以及快捷方式或固定图标会打开的副本都会保留。",
- "Windows 上,所有环境都装好 PyTorch 后,会删除已下载的 PyTorch 安装包(约 1.8 GB),这些安装包只在重新创建环境时才需要。",
- "ComfyUI 在 FreeVideo 准备的独立环境中运行时,升级 ComfyUI 后,启动器会在启动前更新这个环境,不再另外下载一整套带 PyTorch 的环境。",
- "放在已有 ComfyUI 里的引擎文件夹现在会被 git 忽略,ComfyUI 更新工具暂存或清理未跟踪文件时,不会再复制或移走其中的模型和环境。",
- "浏览器里的 FreeVideo 页面没有完整加载时(例如样式丢失或创作面板打不开),页面会写明是哪个文件、什么原因、该怎么处理;启动器也会显示同样的问题,诊断报告中也会包含。",
- "从启动器打开 FreeVideo 时,即使 ComfyUI 恢复了上次的标签页,FreeVideo 工作流也会显示在最前面。"
+ "Windows 上 int8 注意力占用的显存减少约四分之一,更多长视频或大尺寸视频的注意力结果可以留在显卡上,不再放到内存里,每步更快。生成结果不变。",
+ "内存余量较少时,现在只要有 1 GB 空闲(原来需要 3 GB)就会在计算的同时预读下一批权重,需要从硬盘读权重的步骤会更快。",
+ "早先版本附带的离线运行环境包重新可以导入。现在只检查包里的运行环境是否符合当前版本,不再看它来自哪个版本。",
+ "同时导入多个离线包时,能用的都会导入,某个包用不了也不会再挡住其他包;运行环境不符合时会改为自动安装,已导入的模型照常使用。",
+ "用过提示词增强的作品,现在可以在「你的作品」里正常删除。",
+ "下载的诊断报告按保存时间命名(FreeVideo-report-日期-时间.json),多次下载不会再出现「video.debug (1).json」「(2)」这样的文件名。"
]
}
}
diff --git a/freevideo_engine/residual.py b/freevideo_engine/residual.py
index 94d069c..17cc9a1 100644
--- a/freevideo_engine/residual.py
+++ b/freevideo_engine/residual.py
@@ -22,6 +22,9 @@ class ResidualState:
self.closed = False
self.copies = {'to_host': 0, 'to_device': 0}
self.copy_wall_seconds = 0.
+ # Set by the block loop: collect reference cycles once this block has
+ # dropped its input (packing.install_streamed_forward).
+ self.collect_after_store = False
def take(self):
if self.closed or self.tensor is None:
@@ -108,6 +111,10 @@ def residual_forward(pre, post):
normalized = pre(hidden, self.norm1.weight, self.norm1.eps, scale_a, shift_a, adaln_indices)
state.store(hidden)
del hidden
+ if state.collect_after_store:
+ state.collect_after_store = False
+ import gc
+ gc.collect()
branch = self.attn(normalized, rotary_emb, attention_mask)
del normalized
residual = state.restore()
diff --git a/web/report_issue.js b/web/report_issue.js
index 04c27ee..19932c2 100644
--- a/web/report_issue.js
+++ b/web/report_issue.js
@@ -3,7 +3,6 @@
// user closes it once.
const ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new';
const TIP_KEY = 'freevideo.report-tip';
-const REPORT_FILE = 'video.debug.json';
const gb = bytes => Number.isFinite(bytes) && bytes > 0 ? Math.round(bytes / 2 ** 30) : null;
@@ -37,11 +36,22 @@ export function reportIssueURL(report, productVersion = null) {
return `${ISSUE_FORM}?${params}`;
}
+// Each download is named by when it was saved, so saving reports again never
+// leaves "video.debug (1).json"-style copies; the card names the file just saved.
+let savedName = null;
+export function reportFileName(date = new Date()) {
+ const pad = value => String(value).padStart(2, '0');
+ return `FreeVideo-report-${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}`
+ + `-${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}.json`;
+}
+
export function saveReport(blob) {
const url = URL.createObjectURL(blob);
- const link = document.createElement('a'); link.href = url; link.download = REPORT_FILE;
+ savedName = reportFileName();
+ const link = document.createElement('a'); link.href = url; link.download = savedName;
document.body.append(link); link.click(); link.remove();
setTimeout(() => URL.revokeObjectURL(url), 1000);
+ return savedName;
}
// Open the prefilled form, saving the report first unless the user just
@@ -119,8 +129,11 @@ export function showReportTip(bar, anchor, t, {mode = 'invite', submit, onHide =
tip.classList.add('fv-report-tip-sent'); anchor.classList.remove('fv-report-attention');
mark.replaceChildren(glyph('done'));
title.textContent = t('Last step', '最后一步');
- lead.textContent = t(`Please drag ${REPORT_FILE} into "Diagnostic report", then select Submit new issue.`,
- `请将 ${REPORT_FILE} 拖入「诊断报告」,再点击 Submit new issue 即可。`);
+ lead.textContent = savedName
+ ? t(`Please drag ${savedName} into "Diagnostic report", then select Submit new issue.`,
+ `请将 ${savedName} 拖入「诊断报告」,再点击 Submit new issue 即可。`)
+ : t('Please drag the downloaded report into "Diagnostic report", then select Submit new issue.',
+ '请将下载的诊断报告拖入「诊断报告」,再点击 Submit new issue 即可。');
const link = el('a', null, t("Page didn't open? Go to GitHub", '页面没有打开?点此前往 GitHub'));
link.href = address; link.target = '_blank'; link.rel = 'noopener';
note.replaceChildren(link);