Skip to content

feat: add threads and session_options to Stackvox - #66

Merged
StuBehan merged 2 commits into
mainfrom
feat/session-options
Oct 21, 2026
Merged

StuBehan merged 2 commits into
mainfrom
feat/session-options

Conversation

@StuBehan

Copy link
Copy Markdown
Collaborator

Refs #61, the other half of it. #65 is the streaming generator.

Stackvox.__init__ built Kokoro(model, voices) and left ONNX Runtime to size its thread pools from the host core count, which is wrong inside a container with a CPU quota - more threads fighting over less CPU than the default assumed. threads= caps both pools, session_options= hands over the whole SessionOptions for anything else. They're mutually exclusive and it errors if you pass both.

On this box (12 cores) default construction adds 5 OS threads and threads=2 adds 1. Audio out is identical either way.

The fiddly bit is providers. Kokoro.from_session takes the session exactly as handed to it, so building one ourselves means making the provider choice Kokoro.__init__ would have made, otherwise asking for a thread cap quietly changes which provider runs the model. Mirrored the ONNX_PROVIDER env var and the CPU default. Didn't mirror their GPU probe, it's find_spec("onnxruntime-gpu") on a distribution name that isn't an importable module, so that branch has never fired.

onnxruntime is a direct dependency now. It was already arriving via kokoro-onnx but it's in the public signature so it should be declared.

6 new tests.

@StuBehan
StuBehan merged commit b76dd7d into main Oct 21, 2026
10 checks passed
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