Why this needs to happen
The current dependency is @huggingface/transformers@^3.8.1, which pins onnxruntime-node@1.21.0. That version has a well-documented C++ mutex destruction bug on macOS (tracked in microsoft/onnxruntime#24579) that causes a hard crash during the embedding phase:
libc++abi: terminating due to uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
This is the root cause of #68. The fix landed in onnxruntime-node@1.24.x.
Current state of v4
@huggingface/transformers v4 is already in pre-release on npm under the next tag:
| Version |
onnxruntime-node |
| 3.8.1 (current stable) |
1.21.0 ❌ |
| 4.0.0-next.3 |
1.24.1 ✅ |
| 4.0.0-next.7 (latest next) |
1.24.3 ✅ |
So the fix is already there — we just need to track when v4 hits stable and do the upgrade.
What to watch out for
v4 is a major version bump so there will likely be breaking changes in the API. Before upgrading, we'll need to:
- Review the v4 migration guide / changelog for anything that affects
TransformersEmbeddingProvider
- Check whether the
pipeline / model loading API changed
- Run the embedding tests against a v4 install to catch any breakage early
Interim workaround
Until v4 is stable, users hitting #68 can use EMBEDDING_PROVIDER=openai with a local Ollama instance via OPENAI_BASE_URL (see #70) to bypass Transformers.js entirely.
Related
Why this needs to happen
The current dependency is
@huggingface/transformers@^3.8.1, which pinsonnxruntime-node@1.21.0. That version has a well-documented C++ mutex destruction bug on macOS (tracked in microsoft/onnxruntime#24579) that causes a hard crash during the embedding phase:This is the root cause of #68. The fix landed in
onnxruntime-node@1.24.x.Current state of v4
@huggingface/transformersv4 is already in pre-release on npm under thenexttag:So the fix is already there — we just need to track when v4 hits stable and do the upgrade.
What to watch out for
v4 is a major version bump so there will likely be breaking changes in the API. Before upgrading, we'll need to:
TransformersEmbeddingProviderpipeline/ model loading API changedInterim workaround
Until v4 is stable, users hitting #68 can use
EMBEDDING_PROVIDER=openaiwith a local Ollama instance viaOPENAI_BASE_URL(see #70) to bypass Transformers.js entirely.Related