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

Offline models #30

Closed jcorrie closed 7 months ago

jcorrie commented 7 months ago

Following the version 3 changes, I can no longer run the program while my machine is offliine (even though the model is cached, the crate still looks to perform a check against the hosted model). Could this be changed so that, if the machine is offline, it will default to the cached model?

thread 'main' panicked at src\embedding\mod.rs:127:6: Can't load model: request error: https://huggingface.co/api/models/Qdrant/all-MiniLM-L6-v2-onnx/revision/main: Dns Failed: resolve dns name 'huggingface.co:443': No such host is known. (os error 11001)

Caused by: 0: https://huggingface.co/api/models/Qdrant/all-MiniLM-L6-v2-onnx/revision/main: Dns Failed: resolve dns name 'huggingface.co:443': No such host is known. (os error 11001) 1: No such host is known. (os error 11001) note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Anush008 commented 7 months ago

Hello @jcorrie. I'll try to take a look.

Anush008 commented 7 months ago

It's because of checking https://github.com/Anush008/fastembed-rs/blob/main/src%2Flib.rs#L169-L176, which requires a network call.

jcorrie commented 7 months ago

Thanks for looking into this. I've never contributed before, but OK for me to have a stab at a PR to make this fallback to local if no connection?

Anush008 commented 7 months ago

Absolutely. Contributions are always 🤗.

Anush008 commented 7 months ago

https://github.com/Anush008/fastembed-rs/blob/main/src%2Flib.rs#L178

Checks locally first then does a network call.

github-actions[bot] commented 7 months ago

:tada: This issue has been resolved in version 3.1.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jcorrie commented 6 months ago

I need to check whether this issue is still fixed given the different folder structure of the NomicEmbedTextV1 and BGESmallZHV15 models.