anush008 / fastembed-js Goto Github PK
View Code? Open in Web Editor NEWLibrary to generate vector embeddings in NodeJS
Home Page: https://www.npmjs.com/package/fastembed/
License: MIT License
Library to generate vector embeddings in NodeJS
Home Page: https://www.npmjs.com/package/fastembed/
License: MIT License
Can't seem to figure out why the config.json and the tokenizer_config.json don't seem to be downloaded.
OS: Windows 11
Runtime: Bun 1.1.6
import { EmbeddingModel, FlagEmbedding } from "fastembed";
const embeddingModel = await FlagEmbedding.init({
model: EmbeddingModel.BGESmallEN
});
// ....
Without ARM support, fastembed-js won't run on newer AWS t4g EC2 instances. Runs fine on x86 instances.
Error: Cannot find module '@anush008/tokenizers-linux-arm64-gnu'
Any thoughts on a way around this?
would this work in the browser ?
Module not found: Can't resolve '@anush008/tokenizers-linux-arm-gnueabihf' in '\node_modules@anush008\tokenizers'
I am using Nextjs 14, and loading model in the routes api
I'm getting this error with NextJS 13, running Node 20.8:
./node_modules/@anush008/tokenizers-darwin-universal/tokenizers.darwin-universal.node
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
Tried configuring a loader with
module.exports = { externals: { '@anush008/tokenizers-darwin-universal': 'commonjs @anush008/tokenizers-darwin-universal' }, };
and
module.exports = { module: { rules: [ { test: /\.node$/, use: 'node-loader' } ] }, };
Hi whats the difference and what's the relation with python version since the python version I believe only have 1 kind ?
from fastembed.embedding import FlagEmbedding as Embedding
from typing import List
import numpy as np
documents: List[str] = [
"passage: Hello, World!",
"query: Hello, World!", # these are two different embedding
"passage: This is an example passage.",
"fastembed is supported by and maintained by Qdrant." # You can leave out the prefix but it's recommended
]
embedding_model = Embedding(model_name="BAAI/bge-base-en", max_length=512)
embeddings: List[np.ndarray] = list(embedding_model.embed(documents)) # Note the list() call - this is a generator
Thanks
Hi,
I am using node version 18.14.2 and i tried to load the model then i am getting this error
/home/user/poc/node_modules/fastembed/node_modules/onnxruntime-node/dist/backend.js:24
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
Error: Load model from local_cache/fast-bge-small-en-v1.5/model_optimized.onnx failed:Protobuf parsing failed.
at new OnnxruntimeSessionHandler (/home/user/poc/node_modules/fastembed/node_modules/onnxruntime-node/dist/backend.js:24:92)
at /home/user/poc/node_modules/fastembed/node_modules/onnxruntime-node/dist/backend.js:64:29
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Here is my code snippet
let embeddingModel;
(async () => {
//default model i am trying to load here
embeddingModel = await FlagEmbedding.init();
}
})();
NodeJS : 18.14.2
OS: ubuntu 22.04
Kindly guide me in this
Is it possible to use "multi-qa-MiniLM-L6-cos-v1" for fast embed or no?
Is there a way you can return a vector as an array instead of an object.
ie: instead of {"0":0.9823,"1":0.234....}
I'd like [0.9823,0.234...]
Perhaps an argument or utility function? Is that at all possible currently?
Hello,
Is an update will be pushed to be as powerful as the Python version ?
Thanks for considering ! :)
Hello,
I want to use fast-multilingual-e5-large, but when the lib is trying to download it I get:
An error occurred: Error: TAR_BAD_ARCHIVE: Unrecognized archive format
at Unpack.warn (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/warn-mixin.js:21:40)
at Unpack.warn (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/unpack.js:236:18)
at Unpack.<anonymous> (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/parse.js:83:14)
at Unpack.emit (node:events:526:35)
at [emit] (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/parse.js:313:12)
at [maybeEnd] (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/parse.js:468:17)
at [consumeChunk] (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/parse.js:500:21)
at Unpack.write (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/parse.js:427:25)
at Unpack.end (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/tar/lib/parse.js:548:14)
at Pipe.end (/Users/vladislavsorokin/Projects/tax-chatbot/node_modules/minipass/index.js:75:17) {
recoverable: false,
file: 'local_cache/fast-multilingual-e5-large.tar.gz',
code: 'TAR_BAD_ARCHIVE',
tarCode: 'TAR_BAD_ARCHIVE'
}
then when I click on fast-multilingual-e5-large.tar.gz I see the file with content:
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message><Details>Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object. Permission 'storage.objects.get' denied on resource (or it may not exist).</Details></Error>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.