wandb.init()
:wandb.Run
in any process, and it is accessible as wandb.run
:wandb.log
will be sent to that run.wandb.finish
or by using them in a with
block:wandb.init
for more on creating runs, or check out our guide to wandb.init
.group
argument to wandb.init
. For more details on distributed training with W&B, check out our guide.Run
object in the wandb.Api
. Eventually these two objects will be merged.history
wandb.log()
. History can contain scalar values, rich media, or even custom plots across multiple steps.summary
wandb.log()
key. By default, summary is set to the last value logged. You can manually set summary to the best value, like max accuracy, instead of the final value.config
dir
entity
group
id
mode
0.9.x
and earlier, deprecate eventually.name
notes
$
, like $x + 3$
.path
entity/project/run_id
.project
resumed
settings
start_time
starting_step
step
wandb.log
.sweep_id
tags
url
alert
title
text
level
INFO
, WARN
, or ERROR
.wait_duration
define_metric
wandb.log()
.name
step_metric
step_sync
step_metric
to history if needed. Defaults to True if step_metric is specified.hidden
summary
copy
Aggregation best
defaults to goal
==minimize
goal
display
finish
exit_code
quiet
finish_artifact
artifact_or_path
/local/directory
- /local/directory/file.txt
- s3://bucket/path
You can also pass an Artifact object created by calling wandb.Artifact
.name
type
dataset
, model
aliases
["latest"]
distributed_id
Artifact
object.get_project_url
get_sweep_url
get_url
join
finish()
- please use finish.log
wandb.log
to log data from runs, such as scalars, images, video, histograms, plots, and tables.wandb.log({"train-loss": 0.5, "accuracy": 0.9})
. This will save the loss and accuracy to the run's history and update the summary values for these metrics.wandb.run.summary["key"] = value
.wandb.log({"example": wandb.Image("myimage.jpg")})
will log an example image which will be displayed nicely in the W&B UI. See the reference documentation for all of the different supported types or check out our guides to logging for examples, from 3D molecular structures and segmentation masks to PR curves and histograms. wandb.Table
s can be used to logged structured data. See our guide to logging tables for details.wandb.log({"train": {"acc": 0.9}, "val": {"acc": 0.8}})
, the metrics will be organized into train
and val
sections in the W&B UI.wandb.log
, so logging related metrics together is encouraged. If it's inconvenient to log related metrics together calling wandb.log({"train-loss": 0.5, commit=False})
and then wandb.log({"accuracy": 0.9})
is equivalent to calling wandb.log({"train-loss": 0.5, "accuracy": 0.9})
.wandb.log
is not intended to be called more than a few times per second. If you want to log more frequently than that it's better to aggregate the data on the client side or you may get degraded performance.row
str
, ints
, floats
, Tensors
, dicts
, or any of the wandb.data_types
.commit
wandb.log
just updates the current metrics dict with the row argument and metrics won't be saved until wandb.log
is called with commit=True
.step
sync
wandb.log
.wandb.Error
wandb.init
ValueError
log_artifact
artifact_or_path
/local/directory
- /local/directory/file.txt
- s3://bucket/path
You can also pass an Artifact object created by calling wandb.Artifact
.name
type
dataset
, model
aliases
["latest"]
Artifact
object.log_code
.py
.root
os.getcwd()
) or absolute path to recursively find code from.name
source-$RUN_ID
. There may be scenarios where you want many runs to share the same artifact. Specifying name allows you to achieve that.include_fn
lambda path: path.endswith(".py")
exclude_fn
True
when it should be excluded and False
otherwise. Thisdefaults to: lambda path: False
Artifact
object if code was loggedmark_preempting
plot_table
vega_spec_name
table_key
data_table
fields
string_fields
project_name
restore
name
run_path
username/project_name/run_id
if wandb.init has not been called, this is required.replace
root
wandb.CommError
ValueError
save
glob_str
are synced to wandb with the policy specified.glob_str
base_path
policy
live
, now
, or end
- live: upload the file as it changes, overwriting the previous version - now: upload the file once now - end: only upload file when the run endsto_html
unwatch
upsert_artifact
artifact_or_path
/local/directory
- /local/directory/file.txt
- s3://bucket/path
You can also pass an Artifact object created by calling wandb.Artifact
.name
type
dataset
, model
aliases
["latest"]
distributed_id
Artifact
object.use_artifact
download
or file
on the returned object to get the contents locally.artifact_or_name
wandb.Artifact
type
aliases
use_as
Artifact
object.watch
__enter__
__exit__