wandb 0.19.0__py3-none-win32.whl → 0.19.1__py3-none-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wandb/__init__.py +1 -7
- wandb/__init__.pyi +211 -209
- wandb/apis/attrs.py +15 -4
- wandb/apis/public/api.py +8 -4
- wandb/apis/public/files.py +65 -12
- wandb/apis/public/runs.py +52 -7
- wandb/apis/public/sweeps.py +1 -1
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +2 -1
- wandb/env.py +1 -1
- wandb/errors/term.py +60 -1
- wandb/integration/keras/callbacks/tables_builder.py +3 -1
- wandb/integration/kfp/kfp_patch.py +25 -15
- wandb/integration/lightning/fabric/logger.py +3 -1
- wandb/integration/tensorboard/monkeypatch.py +3 -2
- wandb/jupyter.py +4 -5
- wandb/plot/bar.py +5 -6
- wandb/plot/histogram.py +1 -1
- wandb/plot/line_series.py +3 -3
- wandb/plot/pr_curve.py +7 -3
- wandb/plot/scatter.py +2 -1
- wandb/proto/v3/wandb_settings_pb2.py +25 -15
- wandb/proto/v4/wandb_settings_pb2.py +17 -15
- wandb/proto/v5/wandb_settings_pb2.py +17 -15
- wandb/sdk/artifacts/_validators.py +1 -3
- wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +12 -2
- wandb/sdk/data_types/helper_types/image_mask.py +8 -2
- wandb/sdk/data_types/histogram.py +3 -3
- wandb/sdk/data_types/image.py +3 -1
- wandb/sdk/interface/interface.py +34 -5
- wandb/sdk/interface/interface_sock.py +2 -2
- wandb/sdk/internal/file_stream.py +4 -1
- wandb/sdk/internal/sender.py +4 -1
- wandb/sdk/internal/settings_static.py +17 -4
- wandb/sdk/launch/utils.py +1 -0
- wandb/sdk/lib/ipython.py +5 -27
- wandb/sdk/lib/printer.py +33 -20
- wandb/sdk/lib/progress.py +7 -1
- wandb/sdk/lib/sparkline.py +1 -2
- wandb/sdk/wandb_config.py +2 -2
- wandb/sdk/wandb_init.py +236 -243
- wandb/sdk/wandb_run.py +172 -231
- wandb/sdk/wandb_settings.py +104 -15
- {wandb-0.19.0.dist-info → wandb-0.19.1.dist-info}/METADATA +1 -1
- {wandb-0.19.0.dist-info → wandb-0.19.1.dist-info}/RECORD +50 -50
- {wandb-0.19.0.dist-info → wandb-0.19.1.dist-info}/WHEEL +0 -0
- {wandb-0.19.0.dist-info → wandb-0.19.1.dist-info}/entry_points.txt +0 -0
- {wandb-0.19.0.dist-info → wandb-0.19.1.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_init.py
CHANGED
@@ -18,7 +18,7 @@ import platform
|
|
18
18
|
import sys
|
19
19
|
import tempfile
|
20
20
|
import time
|
21
|
-
from typing import TYPE_CHECKING, Any, Sequence
|
21
|
+
from typing import TYPE_CHECKING, Any, Literal, Sequence
|
22
22
|
|
23
23
|
if sys.version_info >= (3, 11):
|
24
24
|
from typing import Self
|
@@ -38,7 +38,7 @@ from wandb.util import _is_artifact_representation
|
|
38
38
|
|
39
39
|
from . import wandb_login, wandb_setup
|
40
40
|
from .backend.backend import Backend
|
41
|
-
from .lib import SummaryDisabled, filesystem,
|
41
|
+
from .lib import SummaryDisabled, filesystem, module, printer, telemetry
|
42
42
|
from .lib.deprecate import Deprecated, deprecate
|
43
43
|
from .lib.mailbox import Mailbox, MailboxProgress
|
44
44
|
from .wandb_helper import parse_config
|
@@ -538,8 +538,19 @@ class _WandbInit:
|
|
538
538
|
The returned Run object has all expected attributes and methods, but they are
|
539
539
|
no-op versions that don't perform any actual logging or communication.
|
540
540
|
"""
|
541
|
+
run_id = runid.generate_id()
|
541
542
|
drun = Run(
|
542
|
-
settings=Settings(
|
543
|
+
settings=Settings(
|
544
|
+
mode="disabled",
|
545
|
+
x_files_dir=tempfile.gettempdir(),
|
546
|
+
run_id=run_id,
|
547
|
+
run_tags=tuple(),
|
548
|
+
run_notes=None,
|
549
|
+
run_group=None,
|
550
|
+
run_name=f"dummy-{run_id}",
|
551
|
+
project="dummy",
|
552
|
+
entity="dummy",
|
553
|
+
)
|
543
554
|
)
|
544
555
|
# config and summary objects
|
545
556
|
drun._config = wandb.sdk.wandb_config.Config()
|
@@ -600,19 +611,13 @@ class _WandbInit:
|
|
600
611
|
|
601
612
|
drun.log_artifact = _ChainableNoOpField()
|
602
613
|
# attributes
|
603
|
-
drun._backend = None
|
604
|
-
drun._step = 0
|
605
|
-
drun._attach_id = None
|
606
|
-
drun._run_obj = None
|
607
|
-
drun._run_id = runid.generate_id()
|
608
|
-
drun._name = "dummy-" + drun.id
|
609
|
-
drun._project = "dummy"
|
610
|
-
drun._entity = "dummy"
|
611
|
-
drun._tags = tuple()
|
612
|
-
drun._notes = None
|
613
|
-
drun._group = None
|
614
614
|
drun._start_time = time.time()
|
615
615
|
drun._starting_step = 0
|
616
|
+
drun._step = 0
|
617
|
+
drun._attach_id = None
|
618
|
+
drun._backend = None
|
619
|
+
|
620
|
+
# set the disabled run as the global run
|
616
621
|
module.set_global(
|
617
622
|
run=drun,
|
618
623
|
config=drun.config,
|
@@ -648,34 +653,21 @@ class _WandbInit:
|
|
648
653
|
|
649
654
|
if self.settings._noop:
|
650
655
|
return self._make_run_disabled()
|
651
|
-
if
|
652
|
-
self.settings.
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
latest_run = self._wl._global_run_stack[-1]
|
662
|
-
|
663
|
-
logger.info(
|
664
|
-
f"re-initializing run, found existing run on stack: {latest_run._run_id}"
|
656
|
+
if (
|
657
|
+
self.settings.reinit
|
658
|
+
or (self.settings._jupyter and self.settings.reinit is not False)
|
659
|
+
) and len(self._wl._global_run_stack) > 0:
|
660
|
+
if len(self._wl._global_run_stack) > 1:
|
661
|
+
wandb.termwarn(
|
662
|
+
"Launching multiple wandb runs using Python's threading"
|
663
|
+
" module is not well-supported."
|
664
|
+
" Please use multiprocessing instead."
|
665
|
+
" Finishing previous run before initializing another."
|
665
666
|
)
|
666
667
|
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
f"Finishing last run (ID:{latest_run._run_id}) before initializing another..."
|
671
|
-
)
|
672
|
-
|
673
|
-
latest_run.finish()
|
674
|
-
|
675
|
-
if jupyter and not self.settings.silent:
|
676
|
-
ipython.display_html(
|
677
|
-
f"Successfully finished last run (ID:{latest_run._run_id}). Initializing new run:<br/>"
|
678
|
-
)
|
668
|
+
latest_run = self._wl._global_run_stack[-1]
|
669
|
+
logger.info(f"found existing run on stack: {latest_run._run_id}")
|
670
|
+
latest_run.finish()
|
679
671
|
elif isinstance(wandb.run, Run):
|
680
672
|
service = self._wl.service
|
681
673
|
# We shouldn't return a stale global run if we are in a new pid
|
@@ -890,9 +882,8 @@ class _WandbInit:
|
|
890
882
|
)
|
891
883
|
|
892
884
|
assert backend.interface
|
893
|
-
assert run._run_obj
|
894
885
|
|
895
|
-
run_start_handle = backend.interface.deliver_run_start(run
|
886
|
+
run_start_handle = backend.interface.deliver_run_start(run)
|
896
887
|
# TODO: add progress to let user know we are doing something
|
897
888
|
run_start_result = run_start_handle.wait(timeout=30)
|
898
889
|
if run_start_result is None:
|
@@ -1011,237 +1002,239 @@ def _attach(
|
|
1011
1002
|
|
1012
1003
|
|
1013
1004
|
def init( # noqa: C901
|
1014
|
-
job_type: str | None = None,
|
1015
|
-
dir: StrPath | None = None,
|
1016
|
-
config: dict | str | None = None,
|
1017
|
-
project: str | None = None,
|
1018
1005
|
entity: str | None = None,
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1006
|
+
project: str | None = None,
|
1007
|
+
dir: StrPath | None = None,
|
1008
|
+
id: str | None = None,
|
1022
1009
|
name: str | None = None,
|
1023
1010
|
notes: str | None = None,
|
1011
|
+
tags: Sequence[str] | None = None,
|
1012
|
+
config: dict[str, Any] | str | None = None,
|
1024
1013
|
config_exclude_keys: list[str] | None = None,
|
1025
1014
|
config_include_keys: list[str] | None = None,
|
1026
|
-
anonymous: str | None = None,
|
1027
|
-
mode: str | None = None,
|
1028
1015
|
allow_val_change: bool | None = None,
|
1029
|
-
|
1016
|
+
group: str | None = None,
|
1017
|
+
job_type: str | None = None,
|
1018
|
+
mode: Literal["online", "offline", "disabled"] | None = None,
|
1030
1019
|
force: bool | None = None,
|
1031
|
-
|
1020
|
+
anonymous: Literal["never", "allow", "must"] | None = None,
|
1021
|
+
reinit: bool | None = None,
|
1022
|
+
resume: bool | Literal["allow", "never", "must", "auto"] | None = None,
|
1023
|
+
resume_from: str | None = None,
|
1024
|
+
fork_from: str | None = None,
|
1025
|
+
save_code: bool | None = None,
|
1026
|
+
tensorboard: bool | None = None,
|
1032
1027
|
sync_tensorboard: bool | None = None,
|
1033
1028
|
monitor_gym: bool | None = None,
|
1034
|
-
save_code: bool | None = None,
|
1035
|
-
id: str | None = None,
|
1036
|
-
fork_from: str | None = None,
|
1037
|
-
resume_from: str | None = None,
|
1038
1029
|
settings: Settings | dict[str, Any] | None = None,
|
1039
1030
|
) -> Run:
|
1040
1031
|
r"""Start a new run to track and log to W&B.
|
1041
1032
|
|
1042
|
-
In an ML training pipeline, you could add `wandb.init()`
|
1043
|
-
|
1044
|
-
|
1033
|
+
In an ML training pipeline, you could add `wandb.init()` to the beginning of
|
1034
|
+
your training script as well as your evaluation script, and each piece would
|
1035
|
+
be tracked as a run in W&B.
|
1045
1036
|
|
1046
1037
|
`wandb.init()` spawns a new background process to log data to a run, and it
|
1047
|
-
also syncs data to wandb.ai by default, so you can see
|
1048
|
-
|
1049
|
-
Call `wandb.init()` to start a run before logging data with `wandb.log()`:
|
1050
|
-
<!--yeadoc-test:init-method-log-->
|
1051
|
-
```python
|
1052
|
-
import wandb
|
1038
|
+
also syncs data to https://wandb.ai by default, so you can see your results
|
1039
|
+
in real-time.
|
1053
1040
|
|
1054
|
-
wandb.init()
|
1055
|
-
|
1056
|
-
wandb.
|
1057
|
-
```
|
1041
|
+
Call `wandb.init()` to start a run before logging data with `wandb.log()`.
|
1042
|
+
When you're done logging data, call `wandb.finish()` to end the run. If you
|
1043
|
+
don't call `wandb.finish()`, the run will end when your script exits.
|
1058
1044
|
|
1059
|
-
`wandb.init()
|
1060
|
-
|
1061
|
-
<!--yeadoc-test:init-and-assert-global-->
|
1062
|
-
```python
|
1063
|
-
import wandb
|
1045
|
+
For more on using `wandb.init()`, including detailed examples, check out our
|
1046
|
+
[guide and FAQs](https://docs.wandb.ai/guides/track/launch).
|
1064
1047
|
|
1065
|
-
|
1048
|
+
Examples:
|
1049
|
+
### Explicitly set the entity and project and choose a name for the run:
|
1066
1050
|
|
1067
|
-
|
1068
|
-
|
1051
|
+
```python
|
1052
|
+
import wandb
|
1069
1053
|
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1054
|
+
run = wandb.init(
|
1055
|
+
entity="geoff",
|
1056
|
+
project="capsules",
|
1057
|
+
name="experiment-2021-10-31",
|
1058
|
+
)
|
1074
1059
|
|
1075
|
-
|
1076
|
-
[guide and FAQs](https://docs.wandb.ai/guides/track/launch).
|
1060
|
+
# ... your training code here ...
|
1077
1061
|
|
1078
|
-
|
1079
|
-
|
1080
|
-
the new run. If the project is not specified, we will try to infer
|
1081
|
-
the project name from git root or the current program file. If we
|
1082
|
-
can't infer the project name, we will default to `"uncategorized"`.
|
1083
|
-
entity: (str, optional) An entity is a username or team name where
|
1084
|
-
you're sending runs. This entity must exist before you can send runs
|
1085
|
-
there, so make sure to create your account or team in the UI before
|
1086
|
-
starting to log runs.
|
1087
|
-
If you don't specify an entity, the run will be sent to your default
|
1088
|
-
entity. Change your default entity
|
1089
|
-
in [your settings](https://wandb.ai/settings) under "default location
|
1090
|
-
to create new projects".
|
1091
|
-
config: (dict, argparse, absl.flags, str, optional)
|
1092
|
-
This sets `wandb.config`, a dictionary-like object for saving inputs
|
1093
|
-
to your job, like hyperparameters for a model or settings for a data
|
1094
|
-
preprocessing job. The config will show up in a table in the UI that
|
1095
|
-
you can use to group, filter, and sort runs. Keys should not contain
|
1096
|
-
`.` in their names, and values should be under 10 MB.
|
1097
|
-
If dict, argparse or absl.flags: will load the key value pairs into
|
1098
|
-
the `wandb.config` object.
|
1099
|
-
If str: will look for a yaml file by that name, and load config from
|
1100
|
-
that file into the `wandb.config` object.
|
1101
|
-
save_code: (bool, optional) Turn this on to save the main script or
|
1102
|
-
notebook to W&B. This is valuable for improving experiment
|
1103
|
-
reproducibility and to diff code across experiments in the UI. By
|
1104
|
-
default this is off, but you can flip the default behavior to on
|
1105
|
-
in [your settings page](https://wandb.ai/settings).
|
1106
|
-
group: (str, optional) Specify a group to organize individual runs into
|
1107
|
-
a larger experiment. For example, you might be doing cross
|
1108
|
-
validation, or you might have multiple jobs that train and evaluate
|
1109
|
-
a model against different test sets. Group gives you a way to
|
1110
|
-
organize runs together into a larger whole, and you can toggle this
|
1111
|
-
on and off in the UI. For more details, see our
|
1112
|
-
[guide to grouping runs](https://docs.wandb.com/guides/runs/grouping).
|
1113
|
-
job_type: (str, optional) Specify the type of run, which is useful when
|
1114
|
-
you're grouping runs together into larger experiments using group.
|
1115
|
-
For example, you might have multiple jobs in a group, with job types
|
1116
|
-
like train and eval. Setting this makes it easy to filter and group
|
1117
|
-
similar runs together in the UI so you can compare apples to apples.
|
1118
|
-
tags: (list, optional) A list of strings, which will populate the list
|
1119
|
-
of tags on this run in the UI. Tags are useful for organizing runs
|
1120
|
-
together, or applying temporary labels like "baseline" or
|
1121
|
-
"production". It's easy to add and remove tags in the UI, or filter
|
1122
|
-
down to just runs with a specific tag.
|
1123
|
-
If you are resuming a run, its tags will be overwritten by the tags
|
1124
|
-
you pass to `wandb.init()`. If you want to add tags to a resumed run
|
1125
|
-
without overwriting its existing tags, use `run.tags += ["new_tag"]`
|
1126
|
-
after `wandb.init()`.
|
1127
|
-
name: (str, optional) A short display name for this run, which is how
|
1128
|
-
you'll identify this run in the UI. By default, we generate a random
|
1129
|
-
two-word name that lets you easily cross-reference runs from the
|
1130
|
-
table to charts. Keeping these run names short makes the chart
|
1131
|
-
legends and tables easier to read. If you're looking for a place to
|
1132
|
-
save your hyperparameters, we recommend saving those in config.
|
1133
|
-
notes: (str, optional) A longer description of the run, like a `-m` commit
|
1134
|
-
message in git. This helps you remember what you were doing when you
|
1135
|
-
ran this run.
|
1136
|
-
dir: (str or pathlib.Path, optional) An absolute path to a directory where
|
1137
|
-
metadata will be stored. When you call `download()` on an artifact,
|
1138
|
-
this is the directory where downloaded files will be saved. By default,
|
1139
|
-
this is the `./wandb` directory.
|
1140
|
-
resume: (bool, str, optional) Sets the resuming behavior. Options:
|
1141
|
-
`"allow"`, `"must"`, `"never"`, `"auto"` or `None`. Defaults to `None`.
|
1142
|
-
Cases:
|
1143
|
-
- `None` (default): If the new run has the same ID as a previous run,
|
1144
|
-
this run overwrites that data.
|
1145
|
-
- `"auto"` (or `True`): if the previous run on this machine crashed,
|
1146
|
-
automatically resume it. Otherwise, start a new run.
|
1147
|
-
- `"allow"`: if id is set with `init(id="UNIQUE_ID")` or
|
1148
|
-
`WANDB_RUN_ID="UNIQUE_ID"` and it is identical to a previous run,
|
1149
|
-
wandb will automatically resume the run with that id. Otherwise,
|
1150
|
-
wandb will start a new run.
|
1151
|
-
- `"never"`: if id is set with `init(id="UNIQUE_ID")` or
|
1152
|
-
`WANDB_RUN_ID="UNIQUE_ID"` and it is identical to a previous run,
|
1153
|
-
wandb will crash.
|
1154
|
-
- `"must"`: if id is set with `init(id="UNIQUE_ID")` or
|
1155
|
-
`WANDB_RUN_ID="UNIQUE_ID"` and it is identical to a previous run,
|
1156
|
-
wandb will automatically resume the run with the id. Otherwise,
|
1157
|
-
wandb will crash.
|
1158
|
-
See [our guide to resuming runs](https://docs.wandb.com/guides/runs/resuming)
|
1159
|
-
for more.
|
1160
|
-
reinit: (bool, optional) Allow multiple `wandb.init()` calls in the same
|
1161
|
-
process. (default: `False`)
|
1162
|
-
config_exclude_keys: (list, optional) string keys to exclude from
|
1163
|
-
`wandb.config`.
|
1164
|
-
config_include_keys: (list, optional) string keys to include in
|
1165
|
-
`wandb.config`.
|
1166
|
-
anonymous: (str, optional) Controls anonymous data logging. Options:
|
1167
|
-
- `"never"` (default): requires you to link your W&B account before
|
1168
|
-
tracking the run, so you don't accidentally create an anonymous
|
1169
|
-
run.
|
1170
|
-
- `"allow"`: lets a logged-in user track runs with their account, but
|
1171
|
-
lets someone who is running the script without a W&B account see
|
1172
|
-
the charts in the UI.
|
1173
|
-
- `"must"`: sends the run to an anonymous account instead of to a
|
1174
|
-
signed-up user account.
|
1175
|
-
mode: (str, optional) Can be `"online"`, `"offline"` or `"disabled"`. Defaults to
|
1176
|
-
online.
|
1177
|
-
allow_val_change: (bool, optional) Whether to allow config values to
|
1178
|
-
change after setting the keys once. By default, we throw an exception
|
1179
|
-
if a config value is overwritten. If you want to track something
|
1180
|
-
like a varying learning rate at multiple times during training, use
|
1181
|
-
`wandb.log()` instead. (default: `False` in scripts, `True` in Jupyter)
|
1182
|
-
force: (bool, optional) If `True`, this crashes the script if a user isn't
|
1183
|
-
logged in to W&B. If `False`, this will let the script run in offline
|
1184
|
-
mode if a user isn't logged in to W&B. (default: `False`)
|
1185
|
-
sync_tensorboard: (bool, optional) Synchronize wandb logs from tensorboard or
|
1186
|
-
tensorboardX and save the relevant events file. (default: `False`)
|
1187
|
-
tensorboard: (bool, optional) Alias for `sync_tensorboard`, deprecated.
|
1188
|
-
monitor_gym: (bool, optional) Automatically log videos of environment when
|
1189
|
-
using OpenAI Gym. (default: `False`)
|
1190
|
-
See [our guide to this integration](https://docs.wandb.com/guides/integrations/openai-gym).
|
1191
|
-
id: (str, optional) A unique ID for this run, used for resuming. It must
|
1192
|
-
be unique in the project, and if you delete a run you can't reuse
|
1193
|
-
the ID. Use the `name` field for a short descriptive name, or `config`
|
1194
|
-
for saving hyperparameters to compare across runs. The ID cannot
|
1195
|
-
contain the following special characters: `/\#?%:`.
|
1196
|
-
See [our guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
|
1197
|
-
fork_from: (str, optional) A string with the format `{run_id}?_step={step}` describing
|
1198
|
-
a moment in a previous run to fork a new run from. Creates a new run that picks up
|
1199
|
-
logging history from the specified run at the specified moment. The target run must
|
1200
|
-
be in the current project. Example: `fork_from="my-run-id?_step=1234"`.
|
1201
|
-
resume_from: (str, optional) A string with the format `{run_id}?_step={step}` describing
|
1202
|
-
a moment in a previous run to resume a run from. This allows users to truncate
|
1203
|
-
the history logged to a run at an intermediate step and resume logging from that step.
|
1204
|
-
It uses run forking under the hood. The target run must be in the
|
1205
|
-
current project. Example: `resume_from="my-run-id?_step=1234"`.
|
1206
|
-
settings: (dict, wandb.Settings, optional) Settings to use for this run. (default: None)
|
1062
|
+
run.finish()
|
1063
|
+
```
|
1207
1064
|
|
1208
|
-
|
1209
|
-
### Set where the run is logged
|
1065
|
+
### Add metadata about the run using the `config` argument:
|
1210
1066
|
|
1211
|
-
|
1212
|
-
|
1213
|
-
```python
|
1214
|
-
import wandb
|
1067
|
+
```python
|
1068
|
+
import wandb
|
1215
1069
|
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1070
|
+
config = {"lr": 0.01, "batch_size": 32}
|
1071
|
+
with wandb.init(config=config) as run:
|
1072
|
+
run.config.update({"architecture": "resnet", "depth": 34})
|
1219
1073
|
|
1220
|
-
|
1221
|
-
|
1074
|
+
# ... your training code here ...
|
1075
|
+
```
|
1222
1076
|
|
1223
|
-
|
1077
|
+
Note that you can use `wandb.init()` as a context manager to automatically
|
1078
|
+
call `wandb.finish()` at the end of the block.
|
1224
1079
|
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1080
|
+
Args:
|
1081
|
+
entity: The username or team name under which the runs will be logged.
|
1082
|
+
The entity must already exist, so ensure you’ve created your account
|
1083
|
+
or team in the UI before starting to log runs. If not specified, the
|
1084
|
+
run will default your defualt entity. To change the default entity,
|
1085
|
+
go to [your settings](https://wandb.ai/settings) and update the
|
1086
|
+
"Default location to create new projects" under "Default team".
|
1087
|
+
project: The name of the project under which this run will be logged.
|
1088
|
+
If not specified, we use a heuristic to infer the project name based
|
1089
|
+
on the system, such as checking the git root or the current program
|
1090
|
+
file. If we can't infer the project name, the project will default to
|
1091
|
+
`"uncategorized"`.
|
1092
|
+
dir: An absolute path to the directory where metadata and downloaded
|
1093
|
+
files will be stored. When calling `download()` on an artifact, files
|
1094
|
+
will be saved to this directory. If not specified, this defaults to
|
1095
|
+
the `./wandb` directory.
|
1096
|
+
id: A unique identifier for this run, used for resuming. It must be unique
|
1097
|
+
within the project and cannot be reused once a run is deleted. The
|
1098
|
+
identifier must not contain any of the following special characters:
|
1099
|
+
`/ \ # ? % :`. For a short descriptive name, use the `name` field,
|
1100
|
+
or for saving hyperparameters to compare across runs, use `config`.
|
1101
|
+
name: A short display name for this run, which appears in the UI to help
|
1102
|
+
you identify it. By default, we generate a random two-word name
|
1103
|
+
allowing easy cross-reference runs from table to charts. Keeping these
|
1104
|
+
run names brief enhances readability in chart legends and tables. For
|
1105
|
+
saving hyperparameters, we recommend using the `config` field.
|
1106
|
+
notes: A detailed description of the run, similar to a commit message in
|
1107
|
+
Git. Use this argument to capture any context or details that may
|
1108
|
+
help you recall the purpose or setup of this run in the future.
|
1109
|
+
tags: A list of tags to label this run in the UI. Tags are helpful for
|
1110
|
+
organizing runs or adding temporary identifiers like "baseline" or
|
1111
|
+
"production." You can easily add, remove tags, or filter by tags in
|
1112
|
+
the UI.
|
1113
|
+
If resuming a run, the tags provided here will replace any existing
|
1114
|
+
tags. To add tags to a resumed run without overwriting the current
|
1115
|
+
tags, use `run.tags += ["new_tag"]` after calling `run = wandb.init()`.
|
1116
|
+
config: Sets `wandb.config`, a dictionary-like object for storing input
|
1117
|
+
parameters to your run, such as model hyperparameters or data
|
1118
|
+
preprocessing settings.
|
1119
|
+
The config appears in the UI in an overview page, allowing you to
|
1120
|
+
group, filter, and sort runs based on these parameters.
|
1121
|
+
Keys should not contain periods (`.`), and values should be
|
1122
|
+
smaller than 10 MB.
|
1123
|
+
If a dictionary, `argparse.Namespace`, or `absl.flags.FLAGS` is
|
1124
|
+
provided, the key-value pairs will be loaded directly into
|
1125
|
+
`wandb.config`.
|
1126
|
+
If a string is provided, it is interpreted as a path to a YAML file,
|
1127
|
+
from which configuration values will be loaded into `wandb.config`.
|
1128
|
+
config_exclude_keys: A list of specific keys to exclude from `wandb.config`.
|
1129
|
+
config_include_keys: A list of specific keys to include in `wandb.config`.
|
1130
|
+
allow_val_change: Controls whether config values can be modified after their
|
1131
|
+
initial set. By default, an exception is raised if a config value is
|
1132
|
+
overwritten. For tracking variables that change during training, such as
|
1133
|
+
a learning rate, consider using `wandb.log()` instead. By default, this
|
1134
|
+
is `False` in scripts and `True` in Notebook environments.
|
1135
|
+
group: Specify a group name to organize individual runs as part of a larger
|
1136
|
+
experiment. This is useful for cases like cross-validation or running
|
1137
|
+
multiple jobs that train and evaluate a model on different test sets.
|
1138
|
+
Grouping allows you to manage related runs collectively in the UI,
|
1139
|
+
making it easy to toggle and review results as a unified experiment.
|
1140
|
+
For more information, refer to our
|
1141
|
+
[guide to grouping runs](https://docs.wandb.com/guides/runs/grouping).
|
1142
|
+
job_type: Specify the type of run, especially helpful when organizing runs
|
1143
|
+
within a group as part of a larger experiment. For example, in a group,
|
1144
|
+
you might label runs with job types such as "train" and "eval".
|
1145
|
+
Defining job types enables you to easily filter and group similar runs
|
1146
|
+
in the UI, facilitating direct comparisons.
|
1147
|
+
mode: Specifies how run data is managed, with the following options:
|
1148
|
+
- `"online"` (default): Enables live syncing with W&B when a network
|
1149
|
+
connection is available, with real-time updates to visualizations.
|
1150
|
+
- `"offline"`: Suitable for air-gapped or offline environments; data
|
1151
|
+
is saved locally and can be synced later. Ensure the run folder
|
1152
|
+
is preserved to enable future syncing.
|
1153
|
+
- `"disabled"`: Disables all W&B functionality, making the run’s methods
|
1154
|
+
no-ops. Typically used in testing to bypass W&B operations.
|
1155
|
+
force: Determines if a W&B login is required to run the script. If `True`,
|
1156
|
+
the user must be logged in to W&B; otherwise, the script will not
|
1157
|
+
proceed. If `False` (default), the script can proceed without a login,
|
1158
|
+
switching to offline mode if the user is not logged in.
|
1159
|
+
anonymous: Specifies the level of control over anonymous data logging.
|
1160
|
+
Available options are:
|
1161
|
+
- `"never"` (default): Requires you to link your W&B account before
|
1162
|
+
tracking the run. This prevents unintentional creation of anonymous
|
1163
|
+
runs by ensuring each run is associated with an account.
|
1164
|
+
- `"allow"`: Enables a logged-in user to track runs with their account,
|
1165
|
+
but also allows someone running the script without a W&B account
|
1166
|
+
to view the charts and data in the UI.
|
1167
|
+
- `"must"`: Forces the run to be logged to an anonymous account, even
|
1168
|
+
if the user is logged in.
|
1169
|
+
reinit: Determines if multiple `wandb.init()` calls can start new runs
|
1170
|
+
within the same process. By default (`False`), if an active run
|
1171
|
+
exists, calling `wandb.init()` returns the existing run instead of
|
1172
|
+
creating a new one. When `reinit=True`, the active run is finished
|
1173
|
+
before a new run is initialized. In notebook environments, runs are
|
1174
|
+
reinitialized by default unless `reinit` is explicitly set to `False`.
|
1175
|
+
resume: Controls the behavior when resuming a run with the specified `id`.
|
1176
|
+
Available options are:
|
1177
|
+
- `"allow"`: If a run with the specified `id` exists, it will resume
|
1178
|
+
from the last step; otherwise, a new run will be created.
|
1179
|
+
- `"never"`: If a run with the specified `id` exists, an error will
|
1180
|
+
be raised. If no such run is found, a new run will be created.
|
1181
|
+
- `"must"`: If a run with the specified `id` exists, it will resume
|
1182
|
+
from the last step. If no run is found, an error will be raised.
|
1183
|
+
- `"auto"`: Automatically resumes the previous run if it crashed on
|
1184
|
+
this machine; otherwise, starts a new run.
|
1185
|
+
- `True`: Deprecated. Use `"auto"` instead.
|
1186
|
+
- `False`: Deprecated. Use the default behavior (leaving `resume`
|
1187
|
+
unset) to always start a new run.
|
1188
|
+
Note: If `resume` is set, `fork_from` and `resume_from` cannot be
|
1189
|
+
used. When `resume` is unset, the system will always start a new run.
|
1190
|
+
For more details, see our
|
1191
|
+
[guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
|
1192
|
+
resume_from: Specifies a moment in a previous run to resume a run from,
|
1193
|
+
using the format `{run_id}?_step={step}`. This allows users to truncate
|
1194
|
+
the history logged to a run at an intermediate step and resume logging
|
1195
|
+
from that step. The target run must be in the same project.
|
1196
|
+
If an `id` argument is also provided, the `resume_from` argument will
|
1197
|
+
take precedence.
|
1198
|
+
`resume`, `resume_from` and `fork_from` cannot be used together, only
|
1199
|
+
one of them can be used at a time.
|
1200
|
+
Note: This feature is in beta and may change in the future.
|
1201
|
+
fork_from: Specifies a point in a previous run from which to fork a new
|
1202
|
+
run, using the format `{id}?_step={step}`. This creates a new run that
|
1203
|
+
resumes logging from the specified step in the target run’s history.
|
1204
|
+
The target run must be part of the current project.
|
1205
|
+
If an `id` argument is also provided, it must be different from the
|
1206
|
+
`fork_from` argument, an error will be raised if they are the same.
|
1207
|
+
`resume`, `resume_from` and `fork_from` cannot be used together, only
|
1208
|
+
one of them can be used at a time.
|
1209
|
+
Note: This feature is in beta and may change in the future.
|
1210
|
+
save_code: Enables saving the main script or notebook to W&B, aiding in
|
1211
|
+
experiment reproducibility and allowing code comparisons across runs in
|
1212
|
+
the UI. By default, this is disabled, but you can change the default to
|
1213
|
+
enable on your [settings page](https://wandb.ai/settings).
|
1214
|
+
tensorboard: Deprecated. Use `sync_tensorboard` instead.
|
1215
|
+
sync_tensorboard: Enables automatic syncing of W&B logs from TensorBoard
|
1216
|
+
or TensorBoardX, saving relevant event files for viewing in the W&B UI.
|
1217
|
+
saving relevant event files for viewing in the W&B UI. (Default: `False`)
|
1218
|
+
monitor_gym: Enables automatic logging of videos of the environment when
|
1219
|
+
using OpenAI Gym. For additional details, see our
|
1220
|
+
[guide for gym integration](https://docs.wandb.com/guides/integrations/openai-gym).
|
1221
|
+
settings: Specifies a dictionary or `wandb.Settings` object with advanced
|
1222
|
+
settings for the run.
|
1230
1223
|
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1224
|
+
Returns:
|
1225
|
+
A `Run` object, which is a handle to the current run. Use this object
|
1226
|
+
to perform operations like logging data, saving files, and finishing
|
1227
|
+
the run. See the [Run API](https://docs.wandb.ai/ref/python/run) for
|
1228
|
+
more details.
|
1235
1229
|
|
1236
1230
|
Raises:
|
1237
|
-
Error:
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
A `Run` object.
|
1231
|
+
Error: If some unknown or internal error happened during the run
|
1232
|
+
initialization.
|
1233
|
+
AuthenticationError: If the user failed to provide valid credentials.
|
1234
|
+
CommError: If there was a problem communicating with the W&B server.
|
1235
|
+
UsageError: If the user provided invalid arguments to the function.
|
1236
|
+
KeyboardInterrupt: If the user interrupts the run initialization process.
|
1237
|
+
If the user interrupts the run initialization process.
|
1245
1238
|
"""
|
1246
1239
|
wandb._assert_is_user_process() # type: ignore
|
1247
1240
|
|
@@ -1317,4 +1310,4 @@ def init( # noqa: C901
|
|
1317
1310
|
# Need to build delay into this sentry capture because our exit hooks
|
1318
1311
|
# mess with sentry's ability to send out errors before the program ends.
|
1319
1312
|
wandb._sentry.reraise(e)
|
1320
|
-
raise AssertionError() #
|
1313
|
+
raise AssertionError() # should never get here
|