Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
SilasMarvin merged 3 commits intomasterfromsilas-add-rank
Jun 5, 2024
Merged

Silas add ranking#1498

SilasMarvin merged 3 commits intomasterfromsilas-add-rank
Jun 5, 2024

Conversation

SilasMarvin
Copy link
Contributor

@SilasMarvinSilasMarvin commentedJun 3, 2024
edited
Loading

This integration brings reranking into postgresml.

pgml=# SELECT pgml.rank('mixedbread-ai/mxbai-rerank-large-v1', 'test', array_agg(md5(random()::text)), '{"return_documents": false, "top_k": 10}') FROM generate_series(1, 100);           rank            --------------------------- (58,0.20096051692962646,) (91,0.2007983922958374,) (84,0.1950932741165161,) (83,0.1925133764743805,) (7,0.1918289214372635,) (15,0.1851881593465805,) (67,0.18225009739398956,) (94,0.1795625537633896,) (40,0.17863182723522186,) (97,0.177006796002388,)(10 rows)

levkk, kczimm, and aplchian reacted with hooray emojilevkk and aplchian reacted with rocket emoji

if transformer not in __cache_sentence_transformer_by_name:
__cache_sentence_transformer_by_name[transformer] = create_cross_encoder(
transformer
Copy link
Contributor

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.

Copy link
ContributorAuthor

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.

Copy link
Contributor

@kczimmkczimm left a 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';

@SilasMarvin
Copy link
ContributorAuthor

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

kczimm reacted with hooray emoji

@SilasMarvinSilasMarvin merged commitfb2426f intomasterJun 5, 2024
@SilasMarvinSilasMarvin deleted the silas-add-rank branchJune 5, 2024 16:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kczimmkczimmkczimm approved these changes

@montanalowmontanalowAwaiting requested review from montanalow

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@SilasMarvin@kczimm

[8]ページ先頭

©2009-2025 Movatter.jp