Skip to content

Commit

Permalink
fix: fix bug where retry_timeout does not work with evaluation with e…
Browse files Browse the repository at this point in the history
…xperiments

PiperOrigin-RevId: 645486957
  • Loading branch information
jsondai authored and copybara-github committed Jun 21, 2024
1 parent 5a6ce78 commit a31ac4d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions vertexai/preview/evaluation/_eval_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def _evaluate_with_experiment(
prompt_template: Optional[str] = None,
experiment_run_name: Optional[str] = None,
response_column_name: Optional[str] = None,
retry_timeout: float = 600.0,
) -> EvalResult:
"""Runs an evaluation for the EvalTask with an experiment.
Expand All @@ -270,6 +271,8 @@ def _evaluate_with_experiment(
unique experiment run name is used.
response_column_name: The column name of model response in the dataset. If
provided, this will override the `response_column_name` of the `EvalTask`.
retry_timeout: How long to keep retrying the evaluation requests for
the whole evaluation dataset, in seconds.
Returns:
The evaluation result.
Expand All @@ -285,6 +288,7 @@ def _evaluate_with_experiment(
content_column_name=self.content_column_name,
reference_column_name=self.reference_column_name,
response_column_name=response_column_name,
retry_timeout=retry_timeout,
)

eval_result.summary_metrics = {
Expand Down Expand Up @@ -342,7 +346,11 @@ def evaluate(
experiment=self.experiment, backing_tensorboard=False
)
eval_result = self._evaluate_with_experiment(
model, prompt_template, experiment_run_name, response_column_name
model,
prompt_template,
experiment_run_name,
response_column_name,
retry_timeout,
)
metadata._experiment_tracker.set_experiment(
experiment=global_experiment_name, backing_tensorboard=False
Expand All @@ -352,12 +360,20 @@ def evaluate(
experiment=self.experiment, backing_tensorboard=False
)
eval_result = self._evaluate_with_experiment(
model, prompt_template, experiment_run_name, response_column_name
model,
prompt_template,
experiment_run_name,
response_column_name,
retry_timeout,
)
metadata._experiment_tracker.reset()
elif not self.experiment and global_experiment_name:
eval_result = self._evaluate_with_experiment(
model, prompt_template, experiment_run_name, response_column_name
model,
prompt_template,
experiment_run_name,
response_column_name,
retry_timeout,
)
else:
eval_result = _evaluation.evaluate(
Expand Down

0 comments on commit a31ac4d

Please sign in to comment.