Skip to content

Commit 96e885d

Browse files
authored
Nathan adds wanddb logging (#685)
1 parent c776694 commit 96e885d

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/lighteval/logging/evaluation_tracker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,11 @@ def save(self) -> None:
250250
)
251251

252252
def push_to_wandb(self, results_dict: dict, details_datasets: dict) -> None:
253+
# reformat the results key to replace ':' with '/'
254+
results_dict = {k.replace(":", "/"): v for k, v in results_dict["results"].items()}
255+
253256
self.wandb_run.log(
254-
{**results_dict["results"]},
257+
{**results_dict},
255258
)
256259
self.wandb_run.finish()
257260

src/lighteval/main_endpoint.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ def tgi(
200200
save_details: Annotated[
201201
bool, Option(help="Save detailed, sample per sample, results.", rich_help_panel=HELP_PANEL_NAME_2)
202202
] = False,
203+
wandb: Annotated[
204+
bool,
205+
Option(
206+
help="Push results to wandb. This will only work if you have wandb installed and logged in. We use env variable to configure wandb. see here: https://docs.wandb.ai/guides/track/environment-variables/",
207+
rich_help_panel=HELP_PANEL_NAME_2,
208+
),
209+
] = False,
203210
# === debug ===
204211
max_samples: Annotated[
205212
Optional[int], Option(help="Maximum number of samples to evaluate on.", rich_help_panel=HELP_PANEL_NAME_3)
@@ -225,6 +232,7 @@ def tgi(
225232
push_to_tensorboard=push_to_tensorboard,
226233
public=public_run,
227234
hub_results_org=results_org,
235+
wandb=wandb,
228236
)
229237

230238
parallelism_manager = ParallelismManager.TGI
@@ -312,6 +320,13 @@ def litellm(
312320
save_details: Annotated[
313321
bool, Option(help="Save detailed, sample per sample, results.", rich_help_panel=HELP_PANEL_NAME_2)
314322
] = False,
323+
wandb: Annotated[
324+
bool,
325+
Option(
326+
help="Push results to wandb. This will only work if you have wandb installed and logged in. We use env variable to configure wandb. see here: https://docs.wandb.ai/guides/track/environment-variables/",
327+
rich_help_panel=HELP_PANEL_NAME_2,
328+
),
329+
] = False,
315330
# === debug ===
316331
max_samples: Annotated[
317332
Optional[int], Option(help="Maximum number of samples to evaluate on.", rich_help_panel=HELP_PANEL_NAME_3)
@@ -337,6 +352,7 @@ def litellm(
337352
push_to_tensorboard=push_to_tensorboard,
338353
public=public_run,
339354
hub_results_org=results_org,
355+
wandb=wandb,
340356
)
341357

342358
parallelism_manager = ParallelismManager.NONE
@@ -422,6 +438,13 @@ def inference_providers(
422438
save_details: Annotated[
423439
bool, Option(help="Save detailed, sample per sample, results.", rich_help_panel=HELP_PANEL_NAME_2)
424440
] = False,
441+
wandb: Annotated[
442+
bool,
443+
Option(
444+
help="Push results to wandb. This will only work if you have wandb installed and logged in. We use env variable to configure wandb. see here: https://docs.wandb.ai/guides/track/environment-variables/",
445+
rich_help_panel=HELP_PANEL_NAME_2,
446+
),
447+
] = False,
425448
# === debug ===
426449
max_samples: Annotated[
427450
Optional[int], Option(help="Maximum number of samples to evaluate on.", rich_help_panel=HELP_PANEL_NAME_3)
@@ -447,6 +470,7 @@ def inference_providers(
447470
push_to_tensorboard=push_to_tensorboard,
448471
public=public_run,
449472
hub_results_org=results_org,
473+
wandb=wandb,
450474
)
451475

452476
# TODO (nathan): better handling of model_args

0 commit comments

Comments
 (0)