#1064·ai-toolkit

YuE2: SheetSage2 remote code is loaded unpinned, and the ABC repair path skips upstream's chord spelling

Author: Many0therFunctionsCreated Sep 25, 2026Updated Sep 25, 2026

Two small things in the yue2 extension's SheetSage2 wrapper.

1. The SheetSage2 remote code isn't pinned

src/tokenizer.py#L122 and #L124 load m-a-p/SheetSage2 with trust_remote_code=True and no revision. That code gets executed, so whatever lands on that repo's main branch runs on the next load, and when offline it's whichever copy happened to be cached.

Upstream has been changing it regularly. For example, the chord-spelling fixes on 2026-09-21 and 2026-09-24 changed exports_sheetsage2.py and tokenization_sheetsage2.py. Passing revision= and code_revision= to AutoConfig.from_pretrained, and revision= to get_class_from_dynamic_module, with a reviewed commit makes runs reproducible. 55bfe14 is the current one and includes both fixes.

2. The repair path writes chords with the decoder's sharp names

When the strict export rejects a sheet, src/sheetsage_repair.py rebuilds the ABC from the raw decoded events. Upstream now does key-aware spelling inside export_result: it normalizes the key names and respells every chord by the local key. This path bypasses that step, so repaired sheets come out with the decoder's sharp names (A# for Bb, G# for Ab in C minor, and so on) even on the current SheetSage2 code.

Calling upstream's own normalize_key_name and correct_chord_rows from chord_spelling_sheetsage2 on intervals["key"] and intervals["chord"] right after they're built matches what export_result does. They can be imported the same way the file already imports the notation and exports modules.

Why it matters

YuE2 reads the chord symbols in the ABC as text, so G#7 and Ab7 are different tokens to the model even though they're the same pitches. Upstream's changelog says the spelling fixes change names only, not pitches, timing or weights.