encoder.safetensors matches the stock encoder; pytorch_model.bin collapses with the official RVQ

#1
by scragnog - opened

Hi, thanks for putting this up. A cleaner HeartCodec encoder is something I'd really like to use, so I spent some time testing it and ran into two problems. I may well be missing a step, so I'd appreciate a pointer.

  1. encoder.safetensors is the stock encoder. Its SHA-256 matches the official HeartCodec-oss-20260123 encoder file exactly. The loading snippet on the card reads that file, so anyone following the card gets the original encoder and identical tokens.

  2. The fine-tuned weights in pytorch_model.bin don't seem to work with the official RVQ. I converted the bin into the split layout (same 1006 keys, shapes and dtypes, a strict load with nothing missing or unexpected) and paired it with the official RVQ and decoder from the Jan 23 release. With that setup:

codebook 1 collapses to roughly 25–60 distinct codes over a full song (the official encoder uses 600–800);
token agreement with the official encoder is under 0.3% on every codebook;
decoded audio is mostly hiss, even for a simple synth arpeggio (log-mel correlation to the source about 0.61, vs 0.90 for the official encoder).
The encoder output looks like it has stopped depending on the input: it largely cancels the CLS token, and its per-frame spread is about 5Γ— smaller than the official one. Gain, mono/stereo, sample rate and normalisation variants, and rescaling the output, all collapse the same way. Interpolating between the official and fine-tuned weights shows a smooth drift, not a loading error.

My guess is that the RVQ codebook was still updating during training (EMA plus dead-code replacement) and the encoder adapted to a codebook that didn't get uploaded. That's only a guess.

Could you share:

the inference/eval script the card mentions (I couldn't find it in the repo), and
the RVQ/codebook weights you trained against, if they differ from the official ones?
Happy to share my conversion and test scripts if they're useful. Thanks again.

Sign up or log in to comment