Unable to download models on Android
harshakhmk opened this issue · 8 comments
Hi, I built the fastembed crate for Android by building onnxruntime from source and correspondingly setting the environment variable for libonnxruntime.so library, but while running, it is giving following error
hf_hub: Token file not found "token"
ureq:::stream connecting to huggingface.co
This behaviour is not observed in linux, it built fine and is also working
Can you try runing https://github.com/huggingface/hf-hub?tab=readme-ov-file#how-to-use after an Android build?
I tried running it, it didn't work, app is crashing because of the code
use hf_hub::api::sync::Api;
let api = Api::new().unwrap();
let repo = api.model("bert-base-uncased".to_string());
let _filename = repo.get("config.json").unwrap();
// filename is now the local location within hf cache of the config.json file
So the hf-hub
lib that FastEmbed-rs
uses in incompatible with your build.
I recommend raising an issue there to see if they could help.
Sure, will raise an issue there too, but do you have any idea why its unable to run
It is failing at Api object creation, there they are loading the token from cache, in linux it is able to load, but in Android, it is unable to load from cache
I am not aware of the hf-hub
internals.
Maybe hf-hub
's cache directory retrieval isn't compatible with Android.
Ok , thanks for the update
Any other crate do you suggest to get vector embeddings for text input which works for Android
I am not aware. I think you should set up an embedding service as an API and use it from your Android application instead.
It would be much better.