Skip to content

Conversation

shahules786
Copy link
Member

@shahules786 shahules786 commented Dec 3, 2024

metric =AspectCritic(name="answer_correctness",definition="Given the user_input, reference and response. Is the response correct compared with the reference",llm=llm_4o)
metric.train("alignment_sample.json")

dummy data

@shahules786 shahules786 marked this pull request as ready for review December 3, 2024 17:35
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Dec 3, 2024
@shahules786 shahules786 requested a review from jjmachan December 3, 2024 18:29
@shahules786
Copy link
Member Author

The progress bar for this now is not neat. I would like to have it as one single bar with a subprocess shown with progress. I'm not sure what the best way to do it is.

@jjmachan
Copy link
Member

jjmachan commented Dec 5, 2024

@shahules786 check out this

ragas/src/ragas/executor.py

Lines 146 to 181 in 99d1a47

# With batching, show nested progress bars
batches = batched(self.jobs, self.batch_size) # generator of job tuples
n_batches = (len(self.jobs) + self.batch_size - 1) // self.batch_size
with (
tqdm(
total=len(self.jobs),
desc=self.desc,
disable=not self.show_progress,
position=1,
leave=True,
) as overall_pbar,
tqdm(
total=min(self.batch_size, len(self.jobs)),
desc=f"Batch 1/{n_batches}",
disable=not self.show_progress,
position=0,
leave=False,
) as batch_pbar,
):
for i, batch in enumerate(batches, 1):
batch_pbar.reset(total=len(batch))
batch_pbar.set_description(f"Batch {i}/{n_batches}")
# Create coroutines per batch
coroutines = [
afunc(*args, **kwargs) for afunc, args, kwargs, _ in batch
]
for future in await as_completed(coroutines, max_workers):
result = await future
results.append(result)
overall_pbar.update(1)
batch_pbar.update(1)
return results

which does something similar for batching

@shahules786
Copy link
Member Author

@jjmachan thanks, just fixed it. Please review

Copy link
Member

@jjmachan jjmachan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall this works really well but I'm not sure about if we are using the executor correctly - will love to discuss this over a call before merging this in

also comments - the code is very hard to read since there are some new alogs here - proper variable names and comments will go a long way to improve the readability of the code

@shahules786 shahules786 requested a review from jjmachan December 7, 2024 10:56
@jjmachan jjmachan merged commit 8307f66 into explodinggradients:main Dec 8, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants