Skip to content

gigaam: convert GigaAM Multilingual Large CTC from its HF snapshot - #251

Open
vlsi wants to merge 1 commit into
handy-computer:mainfrom
vlsi:codex/gigaam-multilingual-convert
Open

vlsi wants to merge 1 commit into
handy-computer:mainfrom
vlsi:codex/gigaam-multilingual-convert

Conversation

@vlsi

@vlsi vlsi commented Nov 7, 2026 •

Copy link
Copy Markdown

Summary

Previously, the converter was loading GigaAM models via gigaam.load_model(), but the pinned version of gigaam package was not able to load Multilingual. The new scripts/lib/gigaam_hf.py takes config.json and the weights from ai-sage/GigaAM-Multilingual (branch large_ctc, pinned commit) and builds the model from the same package.

The config.json for Multilingual does not have mel_scale, mel_norm parameters, so the converter takes them from the loaded model.

The repo and commit of every GigaAM variant live in one table, VARIANTS in scripts/lib/gigaam_hf.py, which the converter, the reference dumper, and the WER runner read; a unit test compares it with the golden manifests, and the dumper refuses a --revision (which validate.py now passes for gigaam) that differs from the pin.

With $TRANSCRIBE_MODELS_DIR set, a revision that is a commit hash, full or abbreviated, now downloads into $TRANSCRIBE_MODELS_DIR/<slug>@<commit>/ instead of <slug>/. This applies to every converter and dumper that pins a commit through lib.hf_source.download_snapshot (gigaam, ecapa_tdnn, any --revision <hash>): offline, huggingface_hub returns a non-empty <slug>/ without checking its commit, so a pinned load could read another commit's files or files another tool saved there. An existing <slug>/ copy is not reused for a pinned run; the first online run downloads the commit again, and an offline run without it fails with a LocalEntryNotFoundError that names the directory.

Part of #87.

Scope

GigaChat3.1-Audio is not included in this PR (it could be added separately).

The WER runner (scripts/wer/run_reference_gigaam_author.py) accepts multilingual_large_ctc and was run on one recording; a full WER run for Multilingual is not part of this PR.

The gigaam package pin stays at 6e4b027c. Upstream 559d88d adds multilingual_large_ctc, but loads it from the author CDN by MD5, and 8555893 and 559d88d change encoder.py, which would move the reference of the four v3 variants; whether to bump is a maintainer decision.

AI Assistance

This was assisted by Opus 5.5 (implementation, review, fix), and Codec GPT 6.1 (review).

Validation

uv run scripts/validate.py all --family gigaam --variant gigaam-multilingual-large-ctc: 13 of 13 tensors are ok against tests/tolerances/gigaam-multilingual-large-ctc.json, which is now 1.5× the observed error (the recipe of the finalized gigaam.json). The transcript is ok.

Preflight: Gate A without FAIL, the same profile as in gigaam-v3-ctc. Gate B: 5/5 PASS.

The Multilingual GGUF and all four GigaAM v3 GGUFs are byte-identical between the old and the new converters. The author CDN served an expired TLS certificate, so gigaam.load_model("v3_*") could not download; the v3 comparison fed both converters the same model built from the pinned ai-sage/GigaAM-v3 Hugging Face branches.

I compared C++ transcripts with PyTorch for 9 recordings: samples/ru.wav, samples/fleurs-ru.wav, samples/fleurs-en.wav, and two 6-12 sec samples from FLEURS validation for each of kk_kz, ky_kg, uz_uz. For F32, F16 and Q8_0 (CPU and Metal) and for Q6_K and Q5_K_M (Metal) C++ transcripts match PyTorch. For Q4_K_M one transcript kk differs with one letter.

I posted performance measurements here: anomalyco/hex#1448

@vlsi
vlsi requested a review from cjpais as a code owner November 7, 2026 07:18
@vlsi vlsi closed this Nov 7, 2026
@vlsi
vlsi force-pushed the codex/gigaam-multilingual-convert branch from 13bb2c0 to 5700f12 Compare November 7, 2026 10:00
@vlsi vlsi reopened this Nov 7, 2026
Previously, the converter was loading GigaAM models via gigaam.load_model(),
but the package gigaam was not able to load Multilingual.
The new scripts/lib/gigaam_hf.py takes config.json and the weights
from ai-sage/GigaAM-Multilingual (branch large_ctc, pinned commit) and
builds the model from the same package.

The config.json for Multilingual does not have mel parameters, so the converter takes
them from the loaded model, and refuses a config value that disagrees with it.

VARIANTS in scripts/lib/gigaam_hf.py is the one table of the repo and
commit of every GigaAM variant; the converter, the reference dumper, and
the WER runner read it, and a unit test compares it with the golden
manifests.

With $TRANSCRIBE_MODELS_DIR set, a revision that is a commit hash now
downloads into $TRANSCRIBE_MODELS_DIR/<slug>@<commit>/ instead of <slug>/,
for every converter that pins one: offline, huggingface_hub returns a
non-empty <slug>/ without checking its commit.

Part of handy-computer#87.

Assisted-by: Claude Opus 5.5
Assisted-by: GPT 6.1 sol
@vlsi
vlsi force-pushed the codex/gigaam-multilingual-convert branch from 13bb2c0 to d803dc4 Compare November 7, 2026 10:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant