- Notifications
You must be signed in to change notification settings - Fork328
Silas add ranking#1498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Silas add ranking#1498
Uh oh!
There was an error while loading.Please reload this page.
Conversation
if transformer not in __cache_sentence_transformer_by_name: | ||
__cache_sentence_transformer_by_name[transformer] = create_cross_encoder( | ||
transformer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If you pass kwargs through tocreate_cross_encoder
we can specify the device,https://www.sbert.net/docs/package_reference/cross_encoder/cross_encoder.html?highlight=crossencoder#sentence_transformers.cross_encoder.CrossEncoder
We should do this for theSentenceTransformer
constructor, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We will have to create a separate argument for this, or pop specific arguments from kwargs. If just pass kwargs straight through we will get an unexpected keyword argument error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should bump the version (probably to 2.9.0 since it's an API addition) and add the following migration filesql/pgml--2.8.5--2.9.0.sql
:
-- src/api.rs:613-- pgml::api::rankCREATEFUNCTIONpgml."rank"("transformer"TEXT,/* &str*/"query"TEXT,/* &str*/"documents"TEXT[],/* alloc::vec::Vec<&str>*/"kwargs" jsonb DEFAULT'{}'/* pgrx::datum::json::JsonB*/) RETURNS TABLE ("corpus_id"bigint,/* i64*/"score"double precision,/* f64*/"text"TEXT/* core::option::Option<alloc::string::String>*/)IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c/* Rust*/AS'MODULE_PATHNAME','rank_wrapper';
Done!745b190 |
Uh oh!
There was an error while loading.Please reload this page.
This integration brings reranking into postgresml.