Comments (8)
@wonderwhy-er thanks so much for reporting. Could you attach your embeddings or show me how did you generate them so I can reproduce the error? Thanks!
from voy.
Ouh its my bad, it seems to work.
I was using TensorFlow JS universal sentence encoder
https://github.com/tensorflow/tfjs-models/blob/master/universal-sentence-encoder/README.md
And for whatever reasons in some cases it returns [number[]] instead of number[] for encoding
I did Array.flat() on it and then it all worked!
from voy.
Amazing! Have fun:)
from voy.
Hey @GarciaLnk, thanks for your suggestion! I'll explore the options. At the meantime, you can directly import the .wasm
file to start using it without a bundler. For example:
// cjs
const voy = require("voy-search/voy_search_bg.wasm");
// or esm
const voy = await import("voy-search/voy_search_bg.wasm");
from voy.
AFAIK to import a WASM module as a native ES module you need a bundler that has proper support for it, which is the root of the issue (see: https://rustwasm.github.io/docs/wasm-bindgen/reference/deployment.html#bundlers).
from voy.
Wanted to test it quickly by loading from CDN trough unpkg
https://www.unpkg.com/browse/[email protected]/
So I could add script tag to a html page like this:
<script src="https://www.unpkg.com/[email protected]/voy_search.js" type="module"></script>
That results in an error:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/wasm". Strict MIME type checking is enforced for module scripts per HTML spec.
As far as I understand direct importing of wasm modules is not supported yet
I did manage to make it work with this code
import * as voy from 'https://www.unpkg.com/[email protected]/voy_search_bg.js';
WebAssembly.instantiateStreaming(fetch("https://www.unpkg.com/[email protected]/voy_search_bg.wasm"), {
"./voy_search_bg.js": voy,
},
}).then((module) => {
voy.__wbg_set_wasm(module.instance.exports);
});
Sadly later trying to load my embeddings got an err:
from voy.
Hey @wonderwhy-er I'm also looking to get voy work in the browser, potentially with up to 1GB or records. Would you be able to share your wasm solution?
from voy.
@MentalGear sorry missed your question, I since then switched to using other things
My code was kinda like this https://jsfiddle.net/wonderwhy_er/k4bwLf2e/31/
But it does not work in jsfiddle and I do not have original code I had working anymore
from voy.
Related Issues (20)
- Why use kd-tree rather than HNSW? HOT 10
- Dockerize HOT 4
- Latest API in Next.js example HOT 2
- Fixture testing
- Expose voy.hydrate() API
- Benchmark Performance
- NodeJS Support HOT 3
- Add "clear()" API
- Voy Class
- feat: Database Size for mobile HOT 6
- Improve error handling
- Explore Index Partitioning HOT 1
- Add lifecycle hooks and expose serde API
- Feature request: remove resource by id HOT 1
- Is heavy usage possible? HOT 3
- Add a field in Resource that allows serialized and unstructured data
- "Too many items with the same position on one axis" error HOT 1
- Error: recursive use of an object detected which would lead to unsafe aliasing in rust HOT 7
- support for OpenAI embeddings? HOT 1
- No Transformers found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voy.