jparkerweb / semantic-chunking

🍱 semantic-chunking ⇢ semantically create chunks from large document for passing to LLM workflows
https://www.npmjs.com/package/semantic-chunking
MIT License
39 stars 2 forks source link

wasm fallback error #3

Closed dcsan closed 4 months ago

dcsan commented 4 months ago

when running I always get the following error. it seems that it runs fine after as wasm but wondering if this is expected?

bun runner.js data/docs/aapl-2024-q2.txt
config {
  key: "v1",
  config: {
    logging: true,
    maxTokenSize: 1000,
    similarityThreshold: 0.1,
    dynamicThresholdLowerBound: 0.1,
    dynamicThresholdUpperBound: 1,
    numSimilaritySentencesLookahead: 5,
    combineChunks: true,
    combineChunksSimilarityThreshold: 0.1,
    onnxEmbeddingModel: "Xenova/all-MiniLM-L6-v2",
    onnxEmbeddingModelQuantized: true,
  },
}
22 |         __classPrivateFieldSet(this, _OnnxruntimeSessionHandler_inferenceSession, new binding_1.binding.InferenceSession(), "f");
23 |         if (typeof pathOrBuffer === 'string') {
24 |             __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
25 |         }
26 |         else {
27 |             __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer.buffer, pathOrBuffer.byteOffset, pathOrBuffer.byteLength, options);
                                                                                                ^
error: Error
      at new OnnxruntimeSessionHandler (/Users/dc/dev/rnd/semantic-chunking/node_modules/onnxruntime-node/dist/backend.js:27:92)
      at /Users/dc/dev/rnd/semantic-chunking/node_modules/onnxruntime-node/dist/backend.js:64:29

Something went wrong during model construction (most likely a missing operation). 
Using `wasm` as a fallback.
jparkerweb commented 4 months ago

This would be a feature request as this project wasn't developed to work with bun out of the box; will need to look into supporting it. You shouldn't have this issue with node.js