Download scripts/render-batch.sh from Frosty40/YuE2-Turbo-Radio: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/Frosty40/YuE2-Turbo-Radio/resolve/main/scripts/render-batch.sh
- Command line
-
hf download hf://Frosty40/YuE2-Turbo-Radio/scripts/render-batch.sh
-
curl -L -o render-batch.sh https://huggingface.co/Frosty40/YuE2-Turbo-Radio/resolve/main/scripts/render-batch.sh
1.6 kB
| # render-batch.sh DIR: render every song in DIR/manifest.json ([{slug, title, style, seed}], lyrics in DIR/<slug>.txt), | |
| # then trim dead tails and encode MP3. Skips songs that already have an MP3. Saves the semantic tokens of every take | |
| # (DIR/<slug>-s<seed>/semantic.json) so a take can be extended later with semantic_prefix_file. | |
| # Env: AUDIOCPP_CLI, YUE2_MODEL, PYTHON (needs numpy + PyAV for finish_track.py; default python3). | |
| set -u | |
| : "${AUDIOCPP_CLI:?set AUDIOCPP_CLI to your audiocpp_cli}" | |
| : "${YUE2_MODEL:?set YUE2_MODEL to the Yue2-3B-GGUF directory}" | |
| PYTHON=${PYTHON:-python3}; HERE=$(cd "$(dirname "$0")" && pwd) | |
| export ONEAPI_DEVICE_SELECTOR=${ONEAPI_DEVICE_SELECTOR:-level_zero:gpu} | |
| cd "$1" | |
| python3 -c "import json; [print(m['slug'], m['seed'], m['style'], sep='\t') for m in json.load(open('manifest.json'))]" | | |
| while IFS=$'\t' read -r slug seed style; do | |
| [ -f "$slug-s$seed.mp3" ] && { echo "skip $slug (done)"; continue; } | |
| start=$(date +%s) | |
| "$AUDIOCPP_CLI" --task gen --family yue2 --model "$YUE2_MODEL" --backend sycl --threads 8 \ | |
| --lyrics "$(cat "$slug.txt")" --request-option style="$style" --request-option cot=off \ | |
| --request-option semantic_max_tokens=6500 --request-option export_semantic=true \ | |
| --seed "$seed" --out-dir "$slug-s$seed" --out "$slug-s$seed.wav" --log > "$slug-s$seed.log" 2>&1 < /dev/null | |
| rc=$? | |
| echo "$slug rc=$rc wall=$(( $(date +%s)-start ))s $(grep -a 'yue2.semantic.tokens ' "$slug-s$seed.log" | awk '{print "tokens="$NF}')" | |
| [ $rc -eq 0 ] && "$PYTHON" "$HERE/finish_track.py" "$slug-s$seed.wav" "$slug-s$seed.mp3" | |
| done | |