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.

889 B
Raw Blame
"""Small installation worker events: actual work, never elapsed-time counters."""
import json
import sys
import time


def emit(event, **row):
    sys.stdout.write(json.dumps(dict(event=event, **row)) + '\n')
    sys.stdout.flush()


def step(name, done=0, total=0):
    emit('installation_step', name=name, done=done, total=total)


def byte_progress(event, file, *, name='Model files', report=None):
    """Report bounded reads/writes, including both endpoints, at most twice/s."""
    last = None
    def progress(done, total):
        nonlocal last
        now = time.monotonic()
        if last is None or done == total or now - last >= .5:
            row = dict(file=str(file), name=name, done_bytes=done, total_bytes=total)
            if report is None:
                emit(event, **row)
            else:
                report(**row)
            last = now
    return progress