guillaume-be / rust-bert

Rust native ready-to-use NLP pipelines and transformer-based models (BERT, DistilBERT, GPT2,...)
https://docs.rs/crate/rust-bert
Apache License 2.0
2.67k stars 216 forks source link

how to use Cross-Encoder for MS Marco by rust-bert? #424

Open spursy opened 1 year ago

spursy commented 1 year ago

The Cross-Encoder for MS Marco hugging face address is here

I want to use predict func like the followed python code:

from sentence_transformers import CrossEncoder
model = CrossEncoder('model_name', max_length=512)

scores = model.predict([('Query', 'Paragraph1'), ('Query', 'Paragraph2') , ('Query', 'Paragraph3')])