Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
32148ce
Short host memory no longer empties the card: models wholly on the ca…
KBRASK Nov 21, 2026
5cc68a3
Models load as FreeVideo starts on a desktop too: the kinds used late…
KBRASK Nov 21, 2026
bf5653c
A picture worker's release names what really ended it, not a video th…
KBRASK Nov 21, 2026
83b5898
A model comes back only when host memory holds what it needs: what it…
KBRASK Nov 21, 2026
62a1a27
A model that made room keeps coming back: the wait doubles with each …
KBRASK Nov 21, 2026
7edede5
A failed warm-up logs where it failed, not only the kind of error
KBRASK Nov 21, 2026
1d8789d
Models the video worker gives back by itself are recorded with the ot…
KBRASK Nov 21, 2026
fb580cd
The warm-up loads the video model with the last video's settings, and…
KBRASK Nov 21, 2026
b786438
The video model comes back after a picture took its room
KBRASK Nov 21, 2026
2f462f4
The hardware probe started from inside ComfyUI finds the engine sourc…
KBRASK Nov 21, 2026
379d12d
The warm-up and the encoder placement run the GPU kernel checks under…
KBRASK Nov 21, 2026
f400daf
Placing the encoder beside kept video models no longer stops them: a …
KBRASK Nov 21, 2026
fc1925a
A starting video or picture no longer waits for the lease a backgroun…
KBRASK Nov 21, 2026
4bb1d10
Tutorial: batch download and lossless sound in Library & export
KBRASK Nov 21, 2026
4bf7ba7
Editor header z-index above the timeline drag overlays
KBRASK Nov 21, 2026
8731776
Launcher: folder path tip shows only when the path is cut
KBRASK Nov 21, 2026
4596d2a
A failure that names its cause is not shown as an unexplained process…
KBRASK Nov 21, 2026
069403a
Reverse prompt: a clip that gave one frame is read as it is, and the …
KBRASK Nov 21, 2026
0167b1a
Video on 8 GB cards: attention readouts kept on the host are joined i…
KBRASK Nov 21, 2026
583f116
Prompt model and dubbing jobs that run out of disk say so instead of …
KBRASK Nov 21, 2026
fa0255c
Slow-interface notice stays in the notification list until closed
KBRASK Nov 21, 2026
bce3a89
Editor: closing it clears the 'last edit not found' card
KBRASK Nov 21, 2026
81ffc3b
A failure whose cause the engine puts under the worker header gets th…
KBRASK Nov 22, 2026
2b8bc5a
Mac: references with first and last frames say to choose one of the two
KBRASK Nov 22, 2026
80a5f6d
Agent status reasons read the cause the engine lists under the worker…
KBRASK Nov 22, 2026
a2f5a87
Mac: references with first and last frames card keeps one of the two …
KBRASK Nov 22, 2026
7bdca56
Background compile gives way within seconds
KBRASK Nov 22, 2026
804a763
Mac: a generation refused at the start records the chip, system and c…
KBRASK Nov 22, 2026
6006e14
A release for another program on the card is recorded with how much o…
KBRASK Nov 22, 2026
d3e8639
Idle encoder build stops between layers once cancelled, so a video st…
KBRASK Nov 22, 2026
ec58ecb
Command palette: tutorial chapters can be found by title or by the wo…
KBRASK Nov 22, 2026
b9aa637
Result menu: offer the same Upscale rows as the library menu
KBRASK Nov 22, 2026
878f5eb
Launcher names FreeVideo where it meant the running service; setup la…
KBRASK Nov 22, 2026
0ec3cb7
The LoRA check names step-distillation adapters stored other ways (a …
KBRASK Nov 22, 2026
22518be
Editor: on a phone the bar fits its row, margins included
KBRASK Nov 22, 2026
71cd6b9
Windows on Arm gets its own pinned runtime set: the CUDA 13.4 torch f…
KBRASK Nov 22, 2026
7dab848
Launcher: keep the previous setup step label
KBRASK Nov 22, 2026
0bf3f72
Release 0.6.8: update notes
KBRASK Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions constraints/windows-arm64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Windows on Arm (win_arm64, CPython 3.12) portable runtime. Same set as windows-portable.txt except the rows below.
# torch, torchvision and torchaudio come from NVIDIA's nvtorch_oot index (pypi.nvidia.com/nvtorch_oot/); every other wheel is on PyPI.
# Differences from the x64 set: the torch family (cu134), triton-windows 3.8, blake3 / cryptography / kornia-rs at the newest versions that ship a win_arm64 wheel.
# SageAttention has no win_arm64 build and is left out. Diffusers and antlr4-python3-runtime are built from source as on x64.
accelerate==1.14.0
aiohappyeyeballs==2.7.1
aiohttp==3.14.3
aiosignal==1.4.0
alembic==1.20.0
annotated-doc==0.0.5
annotated-types==0.8.0
antlr4-python3-runtime==4.9.3
anyio==4.15.1
attrs==26.1.0
av==18.1.0
blake3==1.0.11
certifi==2026.7.22
cffi==2.1.1
charset-normalizer==3.5.1
click==8.5.0
colorama==0.4.6
comfy-aimdo==0.5.3
comfy-angle==0.1.1
comfy-kitchen==0.2.33
comfyui-embedded-docs==0.5.11
comfyui-frontend-package==1.51.10
cryptography==46.0.3
diffusers==0.40.0.dev0
einops==0.8.2
filelock==3.32.3
frozenlist==1.8.0
fsspec==2026.7.0
greenlet==3.5.5
h11==0.16.0
hf-xet==1.6.1a0
httpcore==1.0.9
httpx==0.28.1
huggingface-hub==1.30.0
idna==3.19
importlib-metadata==9.0.1
jinja2==3.1.6
kornia==0.8.3
kornia-rs==0.1.15
mako==1.4.1
markdown-it-py==4.2.0
markupsafe==3.0.3
mdurl==0.1.2
modelscope-hub==0.4.2
mpmath==1.3.0
multidict==6.8.0
networkx==3.6.1
ninja==1.13.2
numpy==2.5.2
omegaconf==2.3.1
packaging==26.3
peft==0.20.0
pillow==12.3.0
pip==26.2.1
propcache==0.5.2
psutil==7.2.2
pycparser==3.0
pydantic==2.13.5
pydantic-core==2.46.5
pydantic-settings==2.15.0
pygments==2.21.0
pyopengl==3.1.10
pysocks==1.7.1
python-dotenv==1.2.3
pyyaml==6.0.3
regex==2026.9.3
requests==2.34.2
rich==15.0.0
safetensors==0.8.0
scipy==1.18.1
sentencepiece==0.2.2
setuptools==78.1.0
shellingham==1.5.4
simpleeval==1.0.8
socksio==1.0.0
spandrel==0.4.2
sqlalchemy==2.0.52
sympy==1.14.0
tokenizers==0.23.0rc0
torch==2.14.0+cu134
torchaudio==2.11.0+cu134
torchsde==0.2.6
torchvision==0.29.0+cu134
tqdm==4.70.0
trampoline==0.1.2
transformers==5.15.0
triton-windows==3.8.0.post28
typer==0.27.2
typing-extensions==4.16.0
typing-inspection==0.4.4
urllib3==2.7.0
wheel==0.48.0
yarl==1.24.5
zipp==4.1.0
33 changes: 17 additions & 16 deletions freevideo_engine/activation_staging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Contiguous D2H head groups with double-buffered CPU projection tiles."""
"""Contiguous D2H head groups, joined into projection tiles on the device."""
import collections
import contextlib
import torch
Expand Down Expand Up @@ -123,8 +123,6 @@ def __init__(self, rows, head_widths, dtype, tile_rows):
self.dtype = dtype
self.tile_rows = tile_rows
self.groups = [torch.empty((self.capacity, width), dtype=dtype, pin_memory=True) for width in head_widths]
self.tiles = [torch.empty((tile_rows, sum(head_widths)), dtype=dtype, pin_memory=True) for _ in range(2)]
self.events = [None, None]
self.copies = LockedCopies()

def supports(self, rows, head_widths, dtype, tile_rows):
Expand All @@ -137,19 +135,22 @@ def store(self, group, values):

def project(self, module, output, rows):
# The caller synchronizes once after all D2H groups have been written.
stream = torch.cuda.current_stream(output.device)
for index, start in enumerate(range(0, rows, self.tile_rows)):
slot = index % 2
if self.events[slot] is not None:
self.events[slot].synchronize()
# Each group's rows of a tile are contiguous on the host, so they go to the
# device as they are and the tile is joined there. Joining it on the host,
# one strided copy per group and tile, kept the processor busy for most of
# the second pass at 1344x768x362 while the device waited (about 200k
# small copies a step). The tile holds the same values in the same rows,
# so the projection is unchanged bit for bit. The host-to-device copies and
# the next layer's device-to-host stores share the current stream, so a
# group is not overwritten before its rows have been read.
width = sum(self.widths)
for start in range(0, rows, self.tile_rows):
count = min(self.tile_rows, rows - start)
tile = self.tiles[slot][:count]
device_values = torch.empty((count, width), dtype=self.dtype, device=output.device)
offset = 0
for group, width in zip(self.groups, self.widths):
tile[:, offset:offset + width].copy_(group[start:start + count])
offset += width
device_values = self.copies.to_device(tile, output.device)
done = torch.cuda.Event()
done.record(stream)
self.events[slot] = done
for group, group_width in zip(self.groups, self.widths):
part = self.copies.to_device(group[start:start + count], output.device)
device_values[:, offset:offset + group_width].copy_(part)
del part
offset += group_width
yield slice(start, start + count), module(device_values)
3 changes: 2 additions & 1 deletion freevideo_engine/agent/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ def _failure_line(error):
lines = str(error.get('message') or '').strip().splitlines()
line = lines[0] if lines else ''
if line.startswith('FreeVideo generation failed') and len(lines) > 1:
line = lines[1].strip()
# The engine puts the child's last error here as "Cause: <error>" (failure_details).
line = re.sub(r'^Cause:\s+', '', lines[1].strip())
return re.sub(r'^(?:[\w.]*Error|[\w.]*Exception):\s*', '', line)


Expand Down
8 changes: 8 additions & 0 deletions freevideo_engine/agent/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def __init__(self, code, message, **details):
self.code, self.message, self.details = code, message, details

def view(self):
if self.details.get('show') is True:
# A fixed sentence written at the raise site (no path, name or backend text): it is the reason.
return errors.build(self.code, validation=True, message=self.message, details=[],
retry_after_seconds=self.details.get('retry_after_seconds'),
kind=self.details.get('kind'), report_id=self.details.get('report_id'))
return errors.build(self.code, details=self.details.get('details'),
owner=self.details.get('owner'),
retry_after_seconds=self.details.get('retry_after_seconds'),
Expand Down Expand Up @@ -1797,6 +1802,9 @@ def run():
except specs.SpecError as error:
failure = ('failed', dict(code='invalid_request', message=str(error), details=error.errors))
except Exception as error: # noqa: BLE001 - a job must always end with a reason
# The request_id in the user's message is searched in the log: record the cause under it.
logging.getLogger(__name__).exception('agent job %s (%s) failed unexpectedly, request %s',
row.get('id'), row.get('kind'), row.get('request_id'))
failure = ('failed', dict(code='internal_error', message='%s: %s' % (
type(error).__name__, str(error)[:2000])))
finally:
Expand Down
2 changes: 1 addition & 1 deletion freevideo_engine/agent/stems.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run_stems(jobs, row, *, poll=.5):
raise JobError('stems_failed', 'The clip media is not readable', kind='stems') from error
source = found['audio']
if source is None:
raise JobError('stems_failed', 'The clip has no sound', kind='stems')
raise JobError('stems_failed', 'The clip has no sound', kind='stems', show=True)
folder = '%s/%s-%s' % (FOLDER, row['id'], secrets.token_hex(4))
out = port.output_path(folder + '/dialogue.mp4', create=True).parent

Expand Down
2 changes: 1 addition & 1 deletion freevideo_engine/agent/voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def context(jobs, spec):
raise JobError('voice_failed', 'The clip media is not readable') from error
path = found_source['audio']
if path is None:
raise JobError('voice_failed', 'The clip has no sound')
raise JobError('voice_failed', 'The clip has no sound', show=True)
wav = Path(path).with_suffix('.wav')
return dict(clip=clip, parent=parent, dialogue=dialogue, separated=dialogue is not None,
base=carrier.get('in', 0) / FPS, start=start, end=min(end, length),
Expand Down
40 changes: 39 additions & 1 deletion freevideo_engine/background_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
# Windows ends a stopped tree asynchronously: CUDA memory and the lease can
# outlive the top process by seconds.
RELEASE_SECONDS = 15.
# Beside the installation's receipt: its presence stops the run (precompile.STOP_ENV).
STOP_FILE = 'precompile.stop'

ATTEMPTS = 8


Expand Down Expand Up @@ -74,6 +77,9 @@ def __init__(self):
self.attempts = []
self.root = None

def stop_path(self):
return Path(self.root) / STOP_FILE

def start(self, command, *, environment, cwd, log, lock, busy, delay=START_DELAY):
"""Run `command` once the session is quiet; False when this session already did.

Expand Down Expand Up @@ -109,8 +115,23 @@ def stop(self, *, final=False):
# instead of reading the exit as a finished run.
row['stopped'] = True
record(self.root, 'not_started', reason='foreground_work', final=final)
# The file first: the run gives way at its next checkpoint on
# every platform, before the signal's grace would end in a kill.
try:
if self.root is not None:
io_path(self.stop_path()).touch()
except OSError:
pass
processes.stop(process, grace=STOP_GRACE)
row['stop_seconds'] = time.monotonic() - tick
if gave_way(process):
# Its supervisor ended the tree and the run closed its own
# lease: a lease still held belongs to whoever took the card.
row.update(gave_way=True, released=None, release_seconds=row['stop_seconds'])
logging.info('[FreeVideo] Background compile gave way in %.1f s.', row['stop_seconds'])
return dict(row)
elif gave_way(process):
return None
# Every process of the tree holds the lease; once it is free the
# tree is gone, even when the top process had already exited. On a
# timeout the request reports the busy lease. One deadline for all.
Expand Down Expand Up @@ -170,10 +191,14 @@ def _work(self, command, environment, cwd, log, busy, delay):
row = dict(started=time.time())
self.attempts.append(row)
try:
# A stop file left by the last stop would end this run at once.
io_path(self.stop_path()).unlink(missing_ok=True)
with io_path(log).open('ab') as stream:
from .triton_compat import temporary_environment
from .precompile import STOP_ENV
environment = temporary_environment(environment.get('FREEVIDEO_HOME') or self.lock.parent,
environment)
environment = dict(environment, **{STOP_ENV: str(self.stop_path())})
process = self.process = processes.popen(
command, env=environment, cwd=cwd, stdin=subprocess.DEVNULL, stdout=stream,
stderr=subprocess.STDOUT, start_new_session=True, supervise=True)
Expand All @@ -193,7 +218,9 @@ def _work(self, command, environment, cwd, log, busy, delay):
with self.guard:
# A stop in progress holds the guard and has marked the row.
stopped = row.get('stopped')
if not stopped and self.process is process:
if not stopped and self.process is process and gave_way(process):
self.process = None
elif not stopped and self.process is process:
# Ended by itself: confirm its tree let go before forgetting
# it, so a later stop never waits on someone else's lease.
row['released'] = self._released(time.monotonic() + RELEASE_SECONDS)
Expand All @@ -212,4 +239,15 @@ def _work(self, command, environment, cwd, log, busy, delay):
record(self.root, 'not_started')


def gave_way(process):
"""The compile exited because the card or the memory was taken (BUSY_EXIT).

Its supervisor (the Linux and Mac process hosts, the Windows Job closed by poll) ends every descendant before this
code is passed on, so the tree is gone. A lease still held belongs to whoever took the card, such as a warm-up
or a kept picture model, and a stop must not wait for it: a starting video stops those after this returns.
"""
from .precompile import BUSY_EXIT
return process.poll() == BUSY_EXIT


COMPILE = BackgroundCompile()
7 changes: 4 additions & 3 deletions freevideo_engine/comfy_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
from .monitoring import save


# Longer than the idle encoder's yield window (YIELD_SECONDS plus its join slack), so a speculative
# warm-up of the previous request on the same device releases the lease before the wait runs out.
DEVICE_LEASE_WAIT_SECONDS = 20.
# Longer than the longest yield window of a speculative placement (idle_encoder.KEPT_YIELD_SECONDS when the
# worker keeps video models, plus its join slack), so a warm-up of the previous request on the same device
# releases the lease before the wait runs out.
DEVICE_LEASE_WAIT_SECONDS = 30.


@contextlib.contextmanager
Expand Down
20 changes: 17 additions & 3 deletions freevideo_engine/comfy_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def disk_free(path):
return int(free) if isinstance(free, (int, float)) and free >= 0 else None


def snapshot(reader, root, busy, paused):
def snapshot(reader, root, busy, paused, local=True):
"""local: the request came from this machine; others (the LAN) see only how much of the card another program
held, never its name or pid."""
result = {'busy': bool(busy), 'paused': bool(paused)}
result.update(reader.read())
free = disk_free(root)
Expand All @@ -107,12 +109,24 @@ def snapshot(reader, root, busy, paused):
try:
from . import server_mode
# Why the video or picture models last left the card, newest last.
result['model_releases'] = server_mode.releases()
events = server_mode.releases()
if not local:
for event in events:
others = event.pop('other_programs', None)
if isinstance(others, list):
event['other_programs_gpu_bytes'] = [other.get('gpu_bytes') for other in others]
result['model_releases'] = events
except Exception:
pass
return result


def from_this_machine(request):
"""A request made on this machine itself, not one the LAN access proxy forwarded from another device."""
from .proxy_identity import HEADER
return request.remote in ('127.0.0.1', '::1') and HEADER not in request.headers


def register():
from aiohttp import web
import asyncio
Expand Down Expand Up @@ -143,7 +157,7 @@ def reply(value, status=200):

@server.routes.get('/freevideo/monitor')
async def read(request):
return reply(await asyncio.to_thread(snapshot, reader, root, busy(), gate.paused))
return reply(await asyncio.to_thread(snapshot, reader, root, busy(), gate.paused, from_this_machine(request)))

@server.routes.post('/freevideo/monitor/stop')
async def stop(request):
Expand Down
12 changes: 8 additions & 4 deletions freevideo_engine/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import os
import subprocess
import sys
from contextlib import nullcontext
from .hardware import detect, installed_backends
from .paths import vdn_root, base_path, checkpoint_path, comfy_root
from .locking import LOCK_ENV, runtime_lock
Expand All @@ -17,7 +17,9 @@ def missing_required_paths(result, *, video_models=True):
return [k for k, row in result['paths'].items() if k not in skipped and not row['exists']]


def doctor(*, probe=False, hardware=None, backends=None, progress=None):
def doctor(*, probe=False, hardware=None, backends=None, progress=None, lease=None):
"""``lease``: the descriptor of the GPU-work lease a caller already holds; the probes run under it
instead of taking the lease again, which the caller's own hold would refuse."""
if progress is None and os.environ.get('FREEVIDEO_INSTALL_PROGRESS') == '1':
from .install_activity import step
progress = step
Expand All @@ -36,14 +38,16 @@ def doctor(*, probe=False, hardware=None, backends=None, progress=None):
'validation': 'Package and path discovery only. Run bench to check actual kernels and performance.'}
if probe:
result['kernel_probes'] = []
with runtime_lock() as descriptor:
with (nullcontext(lease) if lease is not None else runtime_lock()) as descriptor:
env = dict(os.environ, **{LOCK_ENV: str(descriptor)})
linear = ['linear'] + (['linear-int8'] if hardware.system in ('Windows', 'Linux') else [])
probes = [*sorted(backends), *linear]
for index, backend in enumerate(probes):
if progress:
progress('GPU tests running', index, len(probes))
command = [sys.executable, '-m', 'freevideo_engine.probe', backend]
# The check finds this source itself (through the launch view, as compilers need): ComfyUI
# loads the engine by file location and starts without PYTHONPATH.
command = processes.module_command('freevideo_engine.probe', backend)
try:
child = subprocess_output.run_python(command, capture_output=True, timeout=180, env=env,
pass_fds=(descriptor,), runner=processes.run)
Expand Down
Loading