MMnode/download_models.sh
Z User 0c4987d090 T2V resolves to the same value as R2V; loader shows a single model
- T2V selections (editor default mode, explicit [start-end,t2v] override
  tags, raw t2v values) now resolve to r2v in every task-type resolver
  (h3_task_type, _multitrack_task_type, frontend getMultiTrackTaskType);
  h3_generation_mode maps raw t2v to reference conditioning as belt and
  braces. Reference-mode with zero reference media renders text-only
  locally; the cloud path falls back to its native t2va request instead
  of raising. i2v/l2v/v2v/edit flows unchanged.
- MoxieMultimediaLoader now presents a single model picker: LoRA, video
  VAE, audio VAE, and CLIP widgets removed and auto-selected from the
  pack's models/ folders (first sorted file, loud error when missing,
  LoRA applied at strength 1.0 when bundled). Outputs and load order
  unchanged; saved workflows keep working (extra widget values ignored).

Verified: py_compile; scripts/test_t2v_r2v_and_loader.py 50/50;
frontend vitest 566/567 (one pre-existing env failure on HEAD);
bun run build; scripts/test_rtx_upscale_integration.py all pass.
2026-09-27 05:50:35 +00:00

117 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# download_models.sh - fetch the MiniMax H3 model set for the Moxie Multimedia
# Loader and place it (renamed) into this node pack's models/ folders.
#
# Usage (from anywhere - the script targets its own pack directory):
# bash custom_nodes/MMnode/download_models.sh
#
# Files are downloaded to "<name>.part" first and moved into place when
# complete, so an interrupted run can be re-run safely (it resumes).
# Already-complete files are skipped, so the script is idempotent.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODELS_DIR="$SCRIPT_DIR/models"
# ---------------------------------------------------------------------------
# Model manifest: subdir/filename <- URL
# Add the turbo LoRA here once a URL is available, e.g.:
# "loras/Moxie-Turbo.safetensors|https://.../Moxie-Turbo.safetensors"
# ---------------------------------------------------------------------------
MANIFEST=(
"diffusion/Moxie-Multimedia.safetensors|https://huggingface.co/WarmBloodAban/Minimax-h3_Singularity/resolve/main/Minimax-h3_Singularity_ref2va_v1.3_Pruned_w4a8.safetensors"
"clip/MM-VL.safetensors|https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors"
"vae/video_vae.safetensors|https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_video_vae_int8_convrot.safetensors"
"audio_vae/audio_vae.safetensors|https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_audio_vae_fp32.safetensors"
)
# ---------------------------------------------------------------------------
# Downloader: curl first (resume via -C -), wget as fallback.
# ---------------------------------------------------------------------------
curl_supports_retry_all() {
# --retry-all-errors exists since curl 7.71.0; compare versions safely.
local v
v="$(curl --version 2>/dev/null | head -n1 | awk '{print $2}')"
[[ "$(printf '%s\n7.71.0\n' "$v" | sort -V | head -n1)" == "7.71.0" ]]
}
fetch() {
local url="$1" output="$2"
if command -v curl >/dev/null 2>&1; then
local retry_all=""
if curl_supports_retry_all; then
retry_all="--retry-all-errors" # HuggingFace answers bursts with 429/503
fi
curl -L --fail --retry 5 --retry-delay 5 $retry_all \
--connect-timeout 30 -C - -o "$output" "$url"
elif command -v wget >/dev/null 2>&1; then
wget -c -q --show-progress -O "$output" "$url"
else
echo "ERROR: neither curl nor wget is installed." >&2
return 1
fi
}
download_entry() {
local entry="$1"
local rel="${entry%%|*}"
local url="${entry#*|}"
local subdir="${rel%%/*}"
local filename="${rel#*/}"
local target_dir="$MODELS_DIR/$subdir"
local target="$target_dir/$filename"
local partial="$target.part"
if [[ -f "$target" ]]; then
echo "[skip] $subdir/$filename already present"
return 0
fi
mkdir -p "$target_dir"
echo "[get ] $subdir/$filename"
echo " from $url"
if ! fetch "$url" "$partial"; then
# A stale/incomplete .part can make resume fail (e.g. HTTP 416 when the
# file was already fully fetched but the move never happened).
if [[ -f "$partial" ]]; then
echo " resume failed - deleting partial and restarting download"
rm -f "$partial"
fetch "$url" "$partial"
else
return 1
fi
fi
mv -f "$partial" "$target"
echo "[done] $subdir/$filename ($(du -h "$target" | cut -f1))"
}
echo "Moxie Multimedia - model downloader"
echo " pack models dir: $MODELS_DIR"
echo
failed=0
for entry in "${MANIFEST[@]}"; do
if ! download_entry "$entry"; then
echo "ERROR: failed to download $entry" >&2
failed=1
fi
done
echo
if [[ "$failed" -eq 0 ]]; then
echo "All models ready:"
for entry in "${MANIFEST[@]}"; do
local_rel="${entry%%|*}"
printf ' %-40s %s\n' "$local_rel" "$(du -h "$MODELS_DIR/$local_rel" 2>/dev/null | cut -f1 || echo missing)"
done
echo
echo "Restart ComfyUI so the loader picks the files up."
else
echo "Some downloads failed - re-run this script to resume." >&2
exit 1
fi