Skip to content

Commit

Permalink
Merge pull request #14 from AstraBert/v1.0.1-branch
Browse files Browse the repository at this point in the history
v1.0.1 bugfixes
  • Loading branch information
AstraBert authored Jan 20, 2025
2 parents 423a0fc + 17210ee commit addd19f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "sentrev"
version = "1.0.0"
version = "1.0.1"
authors = [
{ name="Clelia (Astra) Bertelli", email="[email protected]" },
]
Expand Down
28 changes: 16 additions & 12 deletions src/sentrev/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,15 @@ def evaluate_dense_retrieval(
client.delete_collection(collection_name)
performances_df = pd.DataFrame.from_dict(performances)
performances_df.to_csv(csv_path, index=False)
csv_name = os.path.basename(csv_path)
csv_path_base = os.path.dirname(csv_path)
if plot:
path_time = csv_path.split(".")[0] + "_times.png"
path_sr = csv_path.split(".")[0] + "_success_rate.png"
path_mrr = csv_path.split(".")[0] + "_mrr.png"
path_co2 = csv_path.split(".")[0] + "_co2.png"
path_precision = csv_path.split(".")[0] + "_precision.png"
path_nonrelevant = csv_path.split(".")[0] + "_nonrelevant.png"
path_time = csv_path_base + "/" + csv_name.split(".")[0] + "_times.png"
path_sr = csv_path_base + "/" + csv_name.split(".")[0] + "_success_rate.png"
path_mrr = csv_path_base + "/" + csv_name.split(".")[0] + "_mrr.png"
path_co2 = csv_path_base + "/" + csv_name.split(".")[0] + "_co2.png"
path_precision = csv_path_base + "/" + csv_name.split(".")[0] + "_precision.png"
path_nonrelevant = csv_path_base + "/" + csv_name.split(".")[0] + "_nonrelevant.png"
X = performances["encoder"]
y_times = performances["average_time"]
yerr_times = performances["stdev_time"]
Expand Down Expand Up @@ -747,13 +749,15 @@ def evaluate_sparse_retrieval(
client.delete_collection(collection_name)
performances_df = pd.DataFrame.from_dict(performances)
performances_df.to_csv(csv_path, index=False)
csv_name = os.path.basename(csv_path)
csv_path_base = os.path.dirname(csv_path)
if plot:
path_time = csv_path.split(".")[0] + "_times.png"
path_sr = csv_path.split(".")[0] + "_success_rate.png"
path_mrr = csv_path.split(".")[0] + "_mrr.png"
path_co2 = csv_path.split(".")[0] + "_co2.png"
path_precision = csv_path.split(".")[0] + "_precision.png"
path_nonrelevant = csv_path.split(".")[0] + "_nonrelevant.png"
path_time = csv_path_base + "/" + csv_name.split(".")[0] + "_times.png"
path_sr = csv_path_base + "/" + csv_name.split(".")[0] + "_success_rate.png"
path_mrr = csv_path_base + "/" + csv_name.split(".")[0] + "_mrr.png"
path_co2 = csv_path_base + "/" + csv_name.split(".")[0] + "_co2.png"
path_precision = csv_path_base + "/" + csv_name.split(".")[0] + "_precision.png"
path_nonrelevant = csv_path_base + "/" + csv_name.split(".")[0] + "_nonrelevant.png"
X = performances["encoder"]
y_times = performances["average_time"]
yerr_times = performances["stdev_time"]
Expand Down
16 changes: 8 additions & 8 deletions src/sentrev/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ def collect_data(self):
for text in self.pages:
contents = text.page_content.split("\n")
contents = remove_items(contents, "")
for content in contents:
self.documents.append(
{
"text": content,
"source": text.metadata["source"],
"page": str(text.metadata["page"]),
}
)
content = "\n".join(contents)
self.documents.append(
{
"text": content,
"source": text.metadata["source"],
"page": str(text.metadata["page"]),
}
)
return self.documents

def qdrant_collection_and_upload(self):
Expand Down

0 comments on commit addd19f

Please sign in to comment.