Skip to content

Check the prompt or conditioning file before planning a generation - #79

Open
ischencheng wants to merge 1 commit into
FlashML-org:mainfrom
ischencheng:fix/prompt-file-check-20261006
Open

ischencheng wants to merge 1 commit into
FlashML-org:mainfrom
ischencheng:fix/prompt-file-check-20261006

Conversation

@ischencheng

@ischencheng ischencheng commented Oct 6, 2026 •

Copy link
Copy Markdown

Change

generate reads --prompt-file and --conditioning only after GPU detection, planning and artifacts.mkdir(exist_ok=False). A mistyped path, an empty prompt or a non-UTF-8 file fails there and leaves <out>.artifacts behind. After fixing the path, every retry with the same --out stops at

FileExistsError: [Errno 17] File exists: '/tmp/fv/out/fox.artifacts'

until the directory is deleted by hand.

This checks the input right after argument parsing. The prompt is read as UTF-8 and must be nonempty (same message as the encoder worker and the Mac path). --conditioning must be a file. Nothing is created when the check fails. exist_ok=False and the artifacts kept from real attempts are unchanged. The check runs before the macOS dispatch, so the Mac path, which creates <out>.artifacts first, gets it too.

Validation

Linux on a Modal L4 (sm89), driver 580.95.05, torch 2.13.0+cu130, Python 3.12, pip install --no-deps -e .. Compared main 5f26105 with this branch. The container has no models and did not run setup, so retries end at the encoder child. What matters here is whether a retry gets past <out>.artifacts.

Each step runs python -m freevideo_engine generate ... --cache <stub fp8 manifest> --width 768 --height 448 --seconds 2:

Step main this PR
--prompt-file promt.txt (typo) FileNotFoundError after 4.3 s (detection + planning), leaves fox.artifacts/ FileNotFoundError after 0.16 s, nothing created
retry with prompt.txt, same --out FileExistsError: .../fox.artifacts gets past it, encoder starts
--prompt-file empty.txt encoder child starts, leaves blank.artifacts/ ValueError: A nonempty prompt is required after 0.14 s
retry, same --out FileExistsError: .../blank.artifacts gets past it, encoder starts
--conditioning conditioning.pt (missing) FileNotFoundError after 4.0 s, leaves cond.artifacts/ FileNotFoundError: Conditioning file not found after 0.14 s
retry, same --out FileExistsError: .../cond.artifacts gets past it, encoder starts

In this container the encoder child then stops with "Worker memory monitoring is incomplete", because the gVisor sandbox has no /proc/self/smaps_rollup. Both branches behave the same there. Reading encode_worker.py, on a normal host the empty prompt would stop at the worker's nonempty check instead, still after <out>.artifacts exists.

Also ran locally (macOS): python scripts/check_installation.py, bash -n setup.sh test.sh freevideo scripts/bootstrap_linux.sh, ./freevideo --help and generate --help. A GBK-encoded prompt now fails at once with UnicodeDecodeError.

Not run: a full generation, and the Mac app path. On macOS I only checked that the new check fires before dispatch.

Repro
mkdir -p /tmp/fv/cache /tmp/fv/out && cd /tmp/fv
echo '{"precision": "fp8"}' > cache/manifest.json
echo 'A red fox runs through fresh snow at dawn.' > prompt.txt
gen() { python -m freevideo_engine generate "$@" --cache cache --width 768 --height 448 --seconds 2; }
gen --prompt-file promt.txt --out out/fox.mp4    # typo
gen --prompt-file prompt.txt --out out/fox.mp4   # main: FileExistsError .../fox.artifacts

generate copied --prompt-file and --conditioning only after GPU detection,
planning and creating <out>.artifacts. A mistyped, missing or empty input
failed there and left that directory behind, so every retry with the same
--out stopped at FileExistsError until the directory was deleted by hand.
Read the prompt (UTF-8, nonempty) or check the conditioning file right
after argument parsing instead, before anything is created.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant