[kokoro-js] Bump @huggingface/transformers to ^4.2.0#320
Open
shreyaskarnik wants to merge 1 commit into
Open
Conversation
Bumps the declared transformers.js range from ^3.5.1 to ^4.2.0.
Motivation: when an app depends on both kokoro-js and @huggingface/transformers
directly, having the kokoro-js range cap at 3.x forces npm to install two
copies of @huggingface/transformers when the app pins ^4.x. Each copy ships
its own onnxruntime-node, and loading two ORT native modules into the same
Node process causes segfaults (ORT is not designed to be initialized twice in
one process; the duplicate global state corrupts the runtime). We observed
this in production and it disappeared once the two were unified via an
"overrides" workaround in package.json. Bumping the declared range removes
the need for downstream consumers to write that override.
API surface: kokoro-js consumes { env, StyleTextToSpeech2Model, AutoTokenizer,
Tensor, RawAudio } plus the env.backends.onnx.wasm.wasmPaths internal path
used by the env shim. All of these still work in v4.2.0.
Verification: npm test passes (276 / 276) on v4.2.0.
Author
|
cc @xenova |
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
Bumps the declared
@huggingface/transformersrange inkokoro.js/package.jsonfrom^3.5.1to^4.2.0.Motivation
When a downstream app depends on both
kokoro-jsand@huggingface/transformersdirectly, capping kokoro-js's range at 3.x forces npm to install two copies of@huggingface/transformerswhenever the app pins^4.x. Each copy ships its ownonnxruntime-node, and loading two ORT native modules into the same Node process segfaults — ORT is not designed to be initialized twice in one process; the duplicate global state corrupts the runtime.We hit this in production. The current workaround consumers have to use:
Bumping the declared range removes the need for any consumer to write that override.
API surface verified
kokoro-js consumes
{ env, StyleTextToSpeech2Model, AutoTokenizer, Tensor, RawAudio }and writes through the internalenv.backends.onnx.wasm.wasmPathspath used by the env shim. All exports and the internal path are present in v4.2.0.Verification
npm test— 276/276 passing on v4.2.0 (Node v20.20.2, darwin-arm64).A separate fp32-CPU benchmark (cold-load, per-utterance latency / RTF, streaming TTFA, peak RSS, on
onnx-community/Kokoro-82M-v1.0-ONNX, 1 warmup + 3 measured runs each):Compute is flat (kokoro's hot path is one ONNX inference call dispatched by
onnxruntime-node, not by transformers.js itself; v4's headline 4x BERT-MHA win doesn't apply to StyleTextToSpeech2). RSS is ~6% higher, expected from v4's larger feature set (modular models, WebGPU-in-Node, ModelRegistry). Audio output length is byte-identical.Test plan
cd kokoro.js && npm install && npm test— expect 276/276audio.saveproduces a valid wav