yycc's picture
Viggle Remake
21665fa
Raw History Blame Contribute Delete
2.33 kB
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
# Run one of the two worked examples end to end, and in doing so check your install.
#
# Checked 2026-10-22 on one B200 at the default 480: each mode renders in about 60 s and peaks at
# 87.2 GiB allocated, plus about 50 s of loading.
#
# ./examples/demo.sh edit /path/to/MiniMax-H3 # lora/edit: remove wind turbines, 2 references
# ./examples/demo.sh swap /path/to/MiniMax-H3 # lora/swap: recast a person, 2 references
#
# Inputs are in examples/inputs/<name>/: source.mp4 (832x480, 24 fps, with the source
# soundtrack), and refN.png, frames of the target video painted in an image editor from
# source frame --pin. The prompt is examples/prompts/<name>.txt, the exact prompt behind
# the clip of the same name in examples/media/.
#
# --frames must stay at the value below: the prompt's timestamps are written for it.
# The clips on the model card were rendered at the 720 class (SHORT_EDGE=736), so the
# default 480 run will not match them pixel for pixel; it should show the same edit.
# If the edit run comes back with the turbines still there, or the swap run with the pizza
# maker instead of the pineapple mascot, the LoRA did not load.
set -euo pipefail
MODE="${1:?usage: demo.sh swap|edit /path/to/MiniMax-H3}"
BASE="${2:?usage: demo.sh swap|edit /path/to/MiniMax-H3}"
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/.." && pwd)"
OUT="${OUT:-$HERE/demo_out}"
SHORT_EDGE="${SHORT_EDGE:-480}"
mkdir -p "$OUT"
case "$MODE" in
edit)
NAME=edit-remove-turbines
ARGS=(--ref "$HERE/inputs/$NAME/ref1.png" --ref "$HERE/inputs/$NAME/ref2.png"
--pin 12 --pin 190
--frames 226)
;;
swap)
NAME=swap-pineapple-mascot
ARGS=(--ref "$HERE/inputs/$NAME/ref1.png" --ref "$HERE/inputs/$NAME/ref2.png"
--pin 12 --pin 184
--frames 226)
;;
*)
echo "usage: demo.sh swap|edit /path/to/MiniMax-H3"; exit 1
;;
esac
python "$REPO/inference/sample.py" \
--mode "$MODE" \
--video "$HERE/inputs/$NAME/source.mp4" \
--prompt "$HERE/prompts/$NAME.txt" \
"${ARGS[@]}" \
--short-edge "$SHORT_EDGE" \
--seed 0 \
--base "$BASE" \
--lora-repo "$REPO" \
--out "$OUT/$NAME.mp4"
echo
echo "wrote $OUT/$NAME.mp4 -- compare against the right half of $HERE/media/$NAME.mp4"