Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions mteb/abstasks/Image/AbsTaskImageClassification.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def _calculate_metrics_from_split(
imgs = self.dataset[hf_subset][split][self.image_column_name]
labels = self.dataset[hf_subset][split][self.label_column_name]
elif compute_overall:
imgs = []
labels = []
imgs, labels = [], []
for hf_subset in self.metadata.eval_langs:
imgs.extend(self.dataset[hf_subset][split][self.image_column_name])
labels.extend(self.dataset[hf_subset][split][self.label_column_name])
Expand All @@ -126,7 +125,7 @@ def _calculate_metrics_from_split(

img_widths, img_heights = [], []
for img in imgs:
width, height = img.size
width, height = img.size # type: ignore
img_heights.append(height)
img_widths.append(width)

Expand Down
5 changes: 2 additions & 3 deletions mteb/abstasks/Image/AbsTaskImageClustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ def _calculate_metrics_from_split(
imgs = self.dataset[hf_subset][split][self.image_column_name]
labels = self.dataset[hf_subset][split][self.label_column_name]
elif compute_overall:
imgs = []
labels = []
imgs, labels = [], []
for hf_subset in self.metadata.eval_langs:
imgs.extend(self.dataset[hf_subset][split][self.image_column_name])
labels.extend(self.dataset[hf_subset][split][self.label_column_name])
Expand All @@ -88,7 +87,7 @@ def _calculate_metrics_from_split(

img_widths, img_heights = [], []
for img in imgs:
width, height = img.size
width, height = img.size # type: ignore
img_heights.append(height)
img_widths.append(width)

Expand Down
3 changes: 1 addition & 2 deletions mteb/abstasks/Image/AbsTaskImageMultilabelClassification.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ def _calculate_metrics_from_split(
imgs = self.dataset[hf_subset][split][self.image_column_name]
labels = self.dataset[hf_subset][split][self.label_column_name]
elif compute_overall:
imgs = []
labels = []
imgs, labels = [], []
for hf_subset in self.metadata.eval_langs:
imgs.extend(self.dataset[hf_subset][split][self.image_column_name])
labels.extend(self.dataset[hf_subset][split][self.label_column_name])
Expand Down
9 changes: 3 additions & 6 deletions mteb/abstasks/Image/AbsTaskZeroShotClassification.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def _calculate_metrics_from_split(
imgs = self.dataset[hf_subset][split][self.image_column_name]
labels = self.dataset[hf_subset][split][self.label_column_name]
elif compute_overall:
imgs = []
labels = []
imgs, labels = [], []
for hf_subset in self.metadata.eval_langs:
imgs.extend(self.dataset[hf_subset][split][self.image_column_name])
labels.extend(self.dataset[hf_subset][split][self.label_column_name])
Expand All @@ -94,12 +93,11 @@ def _calculate_metrics_from_split(

img_widths, img_heights = [], []
for img in imgs:
width, height = img.size
width, height = img.size # type: ignore
img_heights.append(height)
img_widths.append(width)

candidate_labels = self.get_candidate_labels()
candidate_labels_len = [len(c) for c in candidate_labels]
candidate_labels_len = [len(c) for c in self.get_candidate_labels()]

return ZeroShotClassificationDescriptiveStatistics(
num_samples=num_samples,
Expand Down Expand Up @@ -131,7 +129,6 @@ def _evaluate_subset(
evaluator = ZeroShotClassificationEvaluator(
dataset,
self.image_column_name,
# dataset[self.image_column_name],#broken into dataset and self.image_column_name
dataset[self.label_column_name],
candidate_labels,
task_name=self.metadata.name,
Expand Down