Skip to content

Enhance SIMBA class by adding max_errors parameter to Parallel runner… #8126

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions dspy/teleprompt/simba.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dspy
import random
import logging
import sys

import numpy as np
from typing import Callable
@@ -22,6 +23,7 @@ def __init__(
max_demos=4,
demo_input_field_maxlen=100_000,
num_threads=None,
max_errors=sys.maxsize,
temperature_for_sampling=0.2,
temperature_for_candidates=0.2,
):
@@ -43,7 +45,8 @@ def __init__(
self.max_demos = max_demos
self.demo_input_field_maxlen = demo_input_field_maxlen
self.num_threads = num_threads

self.max_errors = max_errors

self.temperature_for_sampling = temperature_for_sampling
self.temperature_for_candidates = temperature_for_candidates

@@ -118,7 +121,7 @@ def register_new_program(prog: dspy.Module, score_list: list[float]):
instance_idx = 0

# Parallel runner
run_parallel = dspy.Parallel(access_examples=False, num_threads=self.num_threads)
run_parallel = dspy.Parallel(access_examples=False, num_threads=self.num_threads, max_errors=self.max_errors)

trial_logs = {}
for batch_idx in range(self.max_steps):