Repository navigation
feat: download models from our mirror first and verify SHA-256 (v0.48.0) - #317
Merged
Merged
Conversation
Model files were fetched from the UVR repo (TRvlvr/model_repo) first even when our model-configs release had an identical copy, and nothing was verified apart from Demucs's filename checksums. - Try the audio-separator model-configs release first for every file, falling back to the original source (UVR repo, Meta's CDN). VIP models still come from Anjok07's repo first. - Ship model-checksums.json: SHA-256 for all 243 published model files, covering every file the library can download. Downloads that don't match are discarded and the next source is tried; cached files are checked once per process and replaced if they don't match. - Download to a .partial file and rename when complete, so an interrupted download no longer leaves a truncated model that later runs treat as present. - tools/update-model-checksums.py regenerates the manifest after new uploads (only hashes files it doesn't already know). Hashes were streamed from all three release repos plus Meta's CDN on the build host: every byte count matches GitHub's listed size, the 89 files published in more than one place are byte-identical everywhere, and the Demucs hashes match the checksums embedded in their filenames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012RYLVTA9CYSnmncNv3GRHJ
…cksum tool Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012RYLVTA9CYSnmncNv3GRHJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
model-configsrelease first, with the original source as fallback (UVR'sTRvlvr/model_repo, or Meta's CDN for Demucs). Before this, the UVR repo was tried first even though we host identical copies, so about half the models, including karaoke-gen's default RoFormer models, always came from a third-party repo. VIP models still come from Anjok07's repo first.audio_separator/model-checksums.jsonlists all 243 published model files, which covers all 273 file references in the supported-model list. A download that doesn't match is discarded and the next source is tried. Cached files are checked once per process (cached by path, size and mtime) and re-downloaded if they don't match. Files with no published checksum are still accepted, so newly added UVR models keep working until the manifest is regenerated. Mutable metadata lists such asdownload_checks.jsonare never checked.<file>.<pid>.partialand are renamed only after they pass verification. Before this, an interrupted download left a truncated file that every later run treated as present.tools/update-model-checksums.pyregenerates the manifest after new uploads. It only hashes files it doesn't already have, unless--rehashis passed.Follow-up to #316 (GHSA-4g2m-m2pr-7g4g): with this, a compromised upstream can't swap in a different file at all, malicious or just corrupted.
How the manifest was built
Every asset in all three release repos (331) plus the 7 Demucs files on Meta's CDN was streamed and hashed on the build host, about 108 GB in total.
Testing
tests/unit/test_model_download_integrity.pycovers source order (mirror / upstream / VIP / MDXC yaml), tampered downloads falling through to the next source, all sources tampered, tampered cached files being replaced, verified cached files not being re-hashed, files without a checksum, metadata not being checked, and the bundled manifest covering the default models.test_mps_native_fp16failures also happen on main.UVR-MDX-NET-Inst_HQ_4.onnx: fetched from the mirror and verified. Re-verifying it in a new process took 0.03 s. After appending a byte, it was detected and re-downloaded.model-checksums.json.@coderabbitai ignore
🤖 Generated with Claude Code
https://claude.ai/code/session_012RYLVTA9CYSnmncNv3GRHJ