Skip to content

fix(tiny_voca): keep graphs in a bounded session cache and refuse languages other than English - #1324

Merged
0xShug0 merged 2 commits into
0xShug0:mainfrom
n4ze3m:tiny-voca-followup
Nov 17, 2026
Merged

0xShug0 merged 2 commits into
0xShug0:mainfrom
n4ze3m:tiny-voca-followup

Conversation

@n4ze3m

@n4ze3m n4ze3m commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1311 for the two points from the review

A request option language=ja was ignored and the text was read as English
(HTTP 200 from the server). A language given with the text was refused, but
as a server error (HTTP 500).

Both places are now checked. English (en, en-us, English) and no language
are accepted; anything else is an InvalidRequestError, so the command-line
tool fails with a clear message and the server answers HTTP 400.

The rule is covered in tiny_voca_unit_test without model files, and
language_test.py checks the real command-line tool and server.
The three transformer graphs were built again for every sentence. The
session's runtime now keeps the graphs it used last in a cache built on
runtime::CacheSlots and runs a kept graph again when the same stack meets
the same length.

The cache holds 6 graphs and 4 MB of buffers at most, least recently used
first out. The size limit is there because a graph grows with its length,
from about 0.3 MB to about 25 MB at the model's limit; a graph over the
limit is freed after its sentence as before.

With logging on, tiny_voca.<stack>_graph.cache_hit shows each reuse. The
audio does not change: the 700 comparison utterances are byte-identical.
@0xShug0
0xShug0 merged commit 92b9260 into 0xShug0:main Nov 17, 2026
7 checks passed
@0xShug0

0xShug0 commented Nov 17, 2026

Copy link
Copy Markdown
Owner

@n4ze3m PR merged. Thanks!

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.

2 participants