Git Product home page Git Product logo

fastembed-js's Introduction

fastembed-js's People

Contributors

anush008 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

serialtexter

fastembed-js's Issues

Loader error in NextJS 13

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' } ] }, };

Error: Load model from 'path/to/model'

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

Array instead of object

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?

@anush008/tokenizers does not support Linux-ARM

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?

Question : embeddingModel.embed vs embeddingModel.passage

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

Model Type

Is it possible to use "multi-qa-MiniLM-L6-cos-v1" for fast embed or no?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.