Post · 1 min read· p. 214

MaxMetricCallsStopper

gepa.utils.stop_condition.MaxMetricCallsStopper(max_metric_calls: int)

Bases: StopperProtocol

Stop callback that stops after a maximum number of metric calls.

Source code in gepa/utils/stop_condition.py

text
def __init__(self, max_metric_calls: int):
    self.max_metric_calls = max_metric_calls

Attributes

max_metric_calls = max_metric_calls instance-attribute

Methods:

__call__(gepa_state: GEPAState) -> bool

Source code in gepa/utils/stop_condition.py

text
def __call__(self, gepa_state: GEPAState) -> bool:
    # return true if max metric calls reached
    return gepa_state.total_num_evals >= self.max_metric_calls