Repository navigation
fix(torch_bin): read checkpoints that wrap the state dict and hold lists - #1174
Merged
Merged
Conversation
Semantic-DACVAE's weights.pth (the Irodori-TTS codec) is saved as
{"state_dict": OrderedDict, "metadata": {...}}, and its metadata holds two
lists. The reader stopped at EMPTY_LIST and would then have treated the
outer dict as the state dict. It now builds lists (EMPTY_LIST, APPEND,
APPENDS) and, when the top-level dict has a dict under "state_dict", reads
the tensors from it, as tests/irodori_tts/convert_dacvae_pth_to_safetensors.py
does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
Will test tomorrow. |
Owner
|
@KKTTSPJ Merged. Thanks! |
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
audiocpp_ggufcannot read the Irodori-TTS codec checkpointweights.pthfromAratako/Semantic-DACVAE-Japanese-32dim:
The file is a training checkpoint saved as
{"state_dict": OrderedDict, "metadata": {...}}, and itsmetadata holds two lists. The reader in
src/framework/assets/torch_bin.cpphas no list opcodes(93 is
EMPTY_LIST), and without them it would then take the outer dict as the state dict. Today the.pthhas to go throughtests/irodori_tts/convert_dacvae_pth_to_safetensors.py, which needs PyTorch.This PR:
EMPTY_LIST,APPENDandAPPENDS(aListvalue, built like the existing tuples and dicts);"state_dict", reads the tensors from that dict, which iswhat
convert_dacvae_pth_to_safetensors.pydoes (payload["state_dict"]).Checkpoints that are a plain state dict, or a single tensor, are read as before.
Checks
New case in
tests/unittests/test_torch_bin_storage_offset.cpp: a checkpoint shaped like that one(wrapped state dict with two views of one storage, metadata with an
APPENDSlist and anAPPENDlist) yields exactly its 2 tensors with the values
torch.loadreturns. The existing cases still pass.The real file:
audiocpp_gguf --type origfromweights.pthand from the safetensors thatconvert_dacvae_pth_to_safetensors.pywrites:Irodori-TTS v4 Large Q4_K converted with
--input codec_weights=weights.pth, compared with the sameconversion from the safetensors: all 1708 tensors (model and codec) are identical, and the model
loads and generates speech.
Without the change, the new unit test fails with the same
unsupported opcode: 93error.Why
This lets a Windows user without Python build the Irodori-TTS v4 Large GGUF, which is not published
(the Gemma Terms of Use apply to its text encoder), from the two original Hugging Face repositories
with
audiocpp_ggufalone.🤖 Generated with Claude Code