Anush008/fastembed-rs

Is there a way to add a model with ONNX resources from HF to the program?

GrisaiaEvy opened this issue · 4 comments

I didn't find a way to add a model by myself. It seems that in the current version(3.5), you can only use the model defined in model.rs.
Should we allow the user to add a model (which have ONNX file) on HF by themselves?

To use local models, you can use https://docs.rs/fastembed/latest/fastembed/struct.TextEmbedding.html#method.try_new_from_user_defined.

If you want some model from HF to be supported, you can raise a PR similar to #54.

To use local models, you can use https://docs.rs/fastembed/latest/fastembed/struct.TextEmbedding.html#method.try_new_from_user_defined.

If you want some model from HF to be supported, you can raise a PR similar to #54.

I mean not through PR, just pass the EmbeddingModel parameter when creating an EmbeddingText, so that it's flexible to use any model on HF.
let model = TextEmbedding::try_new(InitOptions { model_name: EmbeddingModel::new("a model on HF with ONNX file"), show_download_progress: true, ..Default::default() }).unwrap();
I apologise if it's a stupid quetsion because i jsut started learning this project a few days ago :)

Currently, only models listed in models.rs are supported directly.
If you have the ONNX and tokenizer files locally, you can use the
https://docs.rs/fastembed/latest/fastembed/struct.TextEmbedding.html#method.try_new_from_user_defined method.

Currently, only models listed in models.rs are supported directly. If you have the ONNX and tokenizer files locally, you can use the https://docs.rs/fastembed/latest/fastembed/struct.TextEmbedding.html#method.try_new_from_user_defined method.

Ok, thank you for your answer.