Skip to content

Commit

Permalink
show progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanLee97 committed Jul 27, 2024
1 parent ed12cf8 commit 52fe919
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions angle_emb/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ def __init__(
self.labels = labels
self.batch_size = batch_size

def __call__(self, model: AngleBase, **kwargs) -> dict:
def __call__(self, model: AngleBase, show_progress: bool = True, **kwargs) -> dict:
""" Evaluate the model on the given dataset.
:param model: AnglE, the model to evaluate.
:param show_progress: bool, whether to show a progress bar during evaluation.
:param kwargs: Additional keyword arguments to pass to the `encode` method of the model.
:return: dict, The evaluation results.
"""
embeddings1 = []
embeddings2 = []
for chunk in tqdm(chunked_iter(range(len(self.text1)), self.batch_size)):
for chunk in tqdm(chunked_iter(range(len(self.text1)), self.batch_size),
total=len(self.text1)//self.batch_size,
disable=show_progress):
batch_text1 = [self.text1[i] for i in chunk]
batch_text2 = [self.text2[i] for i in chunk]

Expand Down

0 comments on commit 52fe919

Please sign in to comment.