wandb / examples

Example deep learning projects that use wandb's features.
http://wandb.ai
1.11k stars 291 forks source link

[Request]: How to access best model and best paramenters from sweep? #406

Closed slvcsl closed 1 year ago

slvcsl commented 1 year ago

Accessing best model and configuration

Hi! I am trying to use sweep starting from the quickstart and sweeps-python/sweep.py example.

How do I access the best model / best config in the code once the selection is finished? I can see the visualization, but what about the code?

Thanks for the incredible work!

scottire commented 1 year ago

Here's a programmatic way to get the best run from a sweep: https://docs.wandb.ai/guides/track/public-api-guide#get-the-best-run-from-a-sweep

import wandb
api = wandb.Api()

sweep = api.sweep("<entity>/<project>/<sweep_id>")
best_run = sweep.best_run()