Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Parallel Executor #2031

Open
wants to merge 8 commits into
base: fix-streaming
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix pbar
  • Loading branch information
CyrusNuevoDia committed Jan 9, 2025
commit 3001098b53a841e36b21e61c0eeeb2e6ab78c22e
8 changes: 6 additions & 2 deletions dspy/utils/parallelizer.py
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ def _update_pbar(self, pbar: tqdm, nresults, ntotal):
pbar.set_description(description, refresh=True)

def _execute_single_thread(self, function, data):
pbar = self._create_pbar(data)
total_score = 0
total_processed = 0

@@ -93,8 +94,11 @@ def function_with_progress(item):

return result

with self._create_pbar(data) as pbar, logging_redirect_tqdm():
return list(map(function_with_progress, data))
with logging_redirect_tqdm():
try:
return list(map(function_with_progress, data))
finally:
pbar.close()

def _execute_multi_thread(self, function, data):
pbar = self._create_pbar(data)
Loading