Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve error at FlagEmbedding Rerankers #546

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions autorag/nodes/passagereranker/flag_embedding.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Tuple
from typing import List, Tuple, Iterable

import pandas as pd
import torch
Expand Down Expand Up @@ -58,7 +58,7 @@ def flag_embedding_run_model(input_texts, model, batch_size: int):
for batch_texts in tqdm(batch_input_texts):
with torch.no_grad():
pred_scores = model.compute_score(sentence_pairs=batch_texts)
if batch_size == 1:
if batch_size == 1 or not isinstance(pred_scores, Iterable):
results.append(pred_scores)
else:
results.extend(pred_scores)
Expand Down