Call wandb.init each time you start a new run, before the training loop where you log model metrics.


Calling wandb.init() returns a run object. You can also access the run by calling wandb.run.

You should generally call wandb.init() once at the start of your training script.

In a Jupyter Notebook, calling wandb.init() will create a new run.

wandb.init() accepts a few keyword arguments:

  • name — A display name for this run

  • notes — A multiline string description associated with the run

  • config — a dictionary-like object to set as initial config

  • project — the name of the project to which this run will belong

  • tags — a list of strings to associate with this run as tags

  • dir — the path to a directory where artifacts will be written (default: ./wandb)

  • entity — the team posting this run (default: your username or your default team)

  • job_type — the type of job you are logging, e.g. eval, worker, ps (default: training)

  • group — a string by which to group other runs; see Grouping

  • reinit — whether to allow multiple calls to wandb.init in the same process (default: False)

  • id — A unique id for this run primarily used for resuming; see Resuming, must be globally unique within a project

  • resume — if set to True, the run auto resumes; can also be a unique string for manual resuming; see Resuming (default: False)

  • anonymous — can be "allow", "never", or "must". This enables or explicitly disables anonymous logging. (default: None)

  • force — whether to force a user to be logged into wandb when running a script (default: False)

  • magic — (bool, dict, or str, optional): magic configuration as bool, dict, json string, yaml filename. If set to True will attempt to auto-instrument your script. (default: None)

  • sync_tensorboard — A boolean indicating whether or not copy all tensorboard logs wandb; see Tensorboard (default: False)

  • monitor_gym — A boolean indicating whether or not to log videos generated by OpenAI Gym; see Ray Tune (default: False)

  • allow_val_change — whether to allow wandb.config values to change, by default we throw an exception if config values are overwritten. (default: False)

Most of these settings can also be controlled via Environment Variables. This is often useful when you're running jobs on a cluster.