Skip to content

Conversation

@ahgraber
Copy link
Contributor

Provides batched execution support for ragas.executor.Executor and ragas.async_utils.run_async_tasks.

This is useful, for example, for folks who are self-hosting their own models and therefore don't have the throughput that a model service has. In this circumstance, sending a long list of task to the Executor would previously result in timeouts as all n tasks were activated at the same time, but the LLM responses were queued.
The batched approach only "activates" batch_size of the coroutines, and then waits until that batch has been completed before moving on.

Batching may result in slower/longer execution times with LLM APIs, but is disabled by default with batch_size=None.


Note: tqdm support is a bit weird, and I haven't been able to resolve after spending about a day and a half on it, so I'm giving up / forcing leave=True.

  • my current hypothesis is that there's a bug in tqdm's position kwarg, so the inner progress bar gets overwritten by the other loop's when leave=False
  • as a result, it seems that inner bar doesn't refresh until it is complete; it shows up due to leave=True once the cursor drops to the next line for the next batch

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Oct 27, 2024
@ahgraber ahgraber marked this pull request as draft October 30, 2024 11:44
@jjmachan
Copy link
Member

thanks a lot for this 🔥 - this was something that I was hoping to get to at some point in time and I see that the implementation is very clean as well

do give me 2 days to test and review this and we'll get it out before the next release 🙂

@ahgraber ahgraber marked this pull request as ready for review October 31, 2024 11:47
@ahgraber
Copy link
Contributor Author

The most recent PR makes it cleaner, and I think resolves the progress bar ordering issue. Part of the issue seems to be that it requires ipywidgets for improved rendering in when using jupyter notebooks or when running .py files with interactive cells; I don't know if that'd be worth a call out somewhere?

@jjmachan jjmachan merged commit bd1d75e into explodinggradients:main Nov 4, 2024
15 checks passed
@jjmachan
Copy link
Member

jjmachan commented Nov 4, 2024

thanks a lot as always @ahgraber ❤️ 🙂

@ahgraber ahgraber deleted the feature/chunked-execution branch May 7, 2025 23:10
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