Anush008 / fastembed-rs

Library for generating vector embeddings, reranking in Rust
https://docs.rs/fastembed
Apache License 2.0
264 stars 36 forks source link

How to load a local embedding model. #42

Closed RWayne93 closed 6 months ago

RWayne93 commented 6 months ago

I don’t see in the documentation how I can instantiate an embedding model from my local file system give the file path to the downloaded embedding model.

I’m assuming this reaches out to hunggingface and stores the embedding model in local cache somewhere.

Anush008 commented 6 months ago

Currently, the specified model is downloaded and cached locally(You can specify the path in InitOptions). With #40, you should be able to use any local model files.

RWayne93 commented 6 months ago

Thanks for the fast reply. I see other sentence transformer models on the supported list so if I wanted to bring my own model like all-mpnet-base-v2 when it’s merged without issues?

Anush008 commented 6 months ago

You could also do a PR to add the model to the library, if it has an ONNX source on HuggingFace.

For example: https://github.com/Anush008/fastembed-rs/pull/36

Anush008 commented 6 months ago

Resolved with https://github.com/Anush008/fastembed-rs/releases/tag/v3.3.0.