Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LAE
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
文靖昊
LAE
Commits
d5d48338
Commit
d5d48338
authored
Jun 28, 2024
by
tinywell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add CrossEncoder model to BgeRerank class
parent
b538b447
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
rerank.py
src/server/rerank.py
+2
-3
No files found.
src/server/rerank.py
View file @
d5d48338
...
...
@@ -13,13 +13,12 @@ class BgeRerank(BaseDocumentCompressor):
"""Model name to use for reranking."""
top_n
:
int
=
10
"""Number of documents to return."""
model
:
CrossEncoder
model
:
CrossEncoder
=
None
"""CrossEncoder instance to use for reranking."""
def
__init__
(
self
,
model_name
:
str
,
top_n
:
int
=
10
):
s
elf
.
model_name
=
model_name
s
uper
()
.
__init__
(
model_name
=
model_name
,
top_n
=
top_n
)
self
.
model
=
CrossEncoder
(
model_name
)
self
.
top_n
=
top_n
def
bge_rerank
(
self
,
query
,
docs
):
model_inputs
=
[[
query
,
doc
]
for
doc
in
docs
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment