wandb 0.20.2rc20250616__py3-none-win_amd64.whl → 0.21.1__py3-none-win_amd64.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 +16 -14
- wandb/__init__.pyi +450 -472
- wandb/agents/pyagent.py +41 -12
- wandb/analytics/sentry.py +7 -2
- wandb/apis/importers/mlflow.py +1 -1
- wandb/apis/internal.py +3 -0
- wandb/apis/paginator.py +17 -4
- wandb/apis/public/__init__.py +1 -1
- wandb/apis/public/api.py +606 -359
- wandb/apis/public/artifacts.py +214 -16
- wandb/apis/public/automations.py +19 -3
- wandb/apis/public/files.py +177 -38
- wandb/apis/public/history.py +67 -15
- wandb/apis/public/integrations.py +25 -2
- wandb/apis/public/jobs.py +90 -2
- wandb/apis/public/projects.py +161 -69
- wandb/apis/public/query_generator.py +11 -1
- wandb/apis/public/registries/registries_search.py +7 -15
- wandb/apis/public/reports.py +147 -13
- wandb/apis/public/runs.py +315 -128
- wandb/apis/public/sweeps.py +222 -22
- wandb/apis/public/teams.py +41 -4
- wandb/apis/public/users.py +45 -4
- wandb/automations/__init__.py +10 -10
- wandb/automations/_filters/run_metrics.py +0 -2
- wandb/automations/_utils.py +0 -2
- wandb/automations/actions.py +0 -2
- wandb/automations/automations.py +0 -2
- wandb/automations/events.py +0 -2
- wandb/beta/workflows.py +66 -30
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +80 -1
- wandb/env.py +8 -0
- wandb/errors/errors.py +4 -1
- wandb/integration/catboost/catboost.py +6 -2
- wandb/integration/kfp/kfp_patch.py +3 -1
- wandb/integration/lightning/fabric/logger.py +3 -4
- wandb/integration/metaflow/__init__.py +6 -0
- wandb/integration/metaflow/data_pandas.py +74 -0
- wandb/integration/metaflow/errors.py +13 -0
- wandb/integration/metaflow/metaflow.py +205 -190
- wandb/integration/openai/fine_tuning.py +1 -2
- wandb/integration/sb3/sb3.py +3 -3
- wandb/integration/ultralytics/callback.py +6 -2
- wandb/jupyter.py +5 -5
- wandb/plot/__init__.py +2 -0
- wandb/plot/bar.py +30 -29
- wandb/plot/confusion_matrix.py +75 -71
- wandb/plot/custom_chart.py +30 -7
- wandb/plot/histogram.py +26 -25
- wandb/plot/line.py +33 -32
- wandb/plot/line_series.py +100 -103
- wandb/plot/pr_curve.py +33 -32
- wandb/plot/roc_curve.py +38 -38
- wandb/plot/scatter.py +27 -27
- wandb/proto/v3/wandb_internal_pb2.py +366 -385
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_internal_pb2.py +352 -356
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_internal_pb2.py +352 -356
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v6/wandb_internal_pb2.py +352 -356
- wandb/proto/v6/wandb_settings_pb2.py +2 -2
- wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +6 -0
- wandb/sdk/artifacts/_generated/__init__.py +12 -1
- wandb/sdk/artifacts/_generated/input_types.py +20 -2
- wandb/sdk/artifacts/_generated/link_artifact.py +21 -0
- wandb/sdk/artifacts/_generated/operations.py +9 -0
- wandb/sdk/artifacts/_internal_artifact.py +19 -8
- wandb/sdk/artifacts/_validators.py +48 -2
- wandb/sdk/artifacts/artifact.py +269 -96
- wandb/sdk/data_types/audio.py +38 -10
- wandb/sdk/data_types/base_types/media.py +15 -63
- wandb/sdk/data_types/base_types/wb_value.py +6 -6
- wandb/sdk/data_types/graph.py +48 -14
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
- wandb/sdk/data_types/helper_types/image_mask.py +1 -3
- wandb/sdk/data_types/histogram.py +34 -21
- wandb/sdk/data_types/html.py +35 -12
- wandb/sdk/data_types/image.py +104 -68
- wandb/sdk/data_types/molecule.py +32 -19
- wandb/sdk/data_types/object_3d.py +36 -17
- wandb/sdk/data_types/plotly.py +18 -5
- wandb/sdk/data_types/saved_model.py +7 -9
- wandb/sdk/data_types/table.py +99 -70
- wandb/sdk/data_types/trace_tree.py +12 -12
- wandb/sdk/data_types/video.py +53 -26
- wandb/sdk/integration_utils/auto_logging.py +2 -2
- wandb/sdk/interface/interface.py +8 -19
- wandb/sdk/interface/interface_shared.py +7 -16
- wandb/sdk/internal/datastore.py +18 -18
- wandb/sdk/internal/handler.py +3 -5
- wandb/sdk/internal/internal_api.py +60 -0
- wandb/sdk/internal/job_builder.py +6 -0
- wandb/sdk/internal/sender.py +23 -3
- wandb/sdk/internal/sender_config.py +9 -0
- wandb/sdk/launch/_project_spec.py +3 -3
- wandb/sdk/launch/agent/agent.py +11 -4
- wandb/sdk/launch/agent/job_status_tracker.py +3 -1
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
- wandb/sdk/launch/create_job.py +3 -1
- wandb/sdk/launch/inputs/internal.py +3 -4
- wandb/sdk/launch/inputs/schema.py +1 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
- wandb/sdk/launch/sweeps/scheduler.py +2 -3
- wandb/sdk/launch/utils.py +3 -3
- wandb/sdk/lib/asyncio_compat.py +3 -0
- wandb/sdk/lib/console_capture.py +66 -19
- wandb/sdk/lib/deprecate.py +1 -7
- wandb/sdk/lib/disabled.py +1 -1
- wandb/sdk/lib/hashutil.py +14 -1
- wandb/sdk/lib/module.py +7 -13
- wandb/sdk/lib/progress.py +0 -19
- wandb/sdk/lib/sock_client.py +0 -4
- wandb/sdk/wandb_init.py +67 -93
- wandb/sdk/wandb_login.py +18 -14
- wandb/sdk/wandb_metric.py +2 -0
- wandb/sdk/wandb_require.py +0 -1
- wandb/sdk/wandb_run.py +429 -527
- wandb/sdk/wandb_settings.py +364 -74
- wandb/sdk/wandb_setup.py +28 -28
- wandb/sdk/wandb_sweep.py +14 -13
- wandb/sdk/wandb_watch.py +4 -6
- wandb/sync/sync.py +10 -0
- wandb/util.py +57 -0
- wandb/wandb_run.py +1 -2
- {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
- {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/RECORD +137 -137
- wandb/sdk/wandb_metadata.py +0 -623
- wandb/vendor/pynvml/__init__.py +0 -0
- wandb/vendor/pynvml/pynvml.py +0 -4779
- {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
- {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
- {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_run.py
CHANGED
@@ -35,13 +35,13 @@ from wandb.integration.torch import wandb_torch
|
|
35
35
|
from wandb.plot import CustomChart, Visualize
|
36
36
|
from wandb.proto.wandb_deprecated import Deprecated
|
37
37
|
from wandb.proto.wandb_internal_pb2 import (
|
38
|
-
MetadataRequest,
|
39
38
|
MetricRecord,
|
40
39
|
PollExitResponse,
|
41
40
|
Result,
|
42
41
|
RunRecord,
|
43
42
|
)
|
44
43
|
from wandb.sdk.artifacts._internal_artifact import InternalArtifact
|
44
|
+
from wandb.sdk.artifacts._validators import is_artifact_registry_project
|
45
45
|
from wandb.sdk.artifacts.artifact import Artifact
|
46
46
|
from wandb.sdk.internal import job_builder
|
47
47
|
from wandb.sdk.lib import asyncio_compat, wb_logging
|
@@ -63,7 +63,7 @@ from wandb.util import (
|
|
63
63
|
from . import wandb_config, wandb_metric, wandb_summary
|
64
64
|
from .artifacts._validators import (
|
65
65
|
MAX_ARTIFACT_METADATA_KEYS,
|
66
|
-
|
66
|
+
ArtifactPath,
|
67
67
|
validate_aliases,
|
68
68
|
validate_tags,
|
69
69
|
)
|
@@ -92,7 +92,6 @@ from .mailbox import (
|
|
92
92
|
wait_with_progress,
|
93
93
|
)
|
94
94
|
from .wandb_alerts import AlertLevel
|
95
|
-
from .wandb_metadata import Metadata
|
96
95
|
from .wandb_settings import Settings
|
97
96
|
from .wandb_setup import _WandbSetup
|
98
97
|
|
@@ -132,6 +131,7 @@ if TYPE_CHECKING:
|
|
132
131
|
input_types: dict[str, Any]
|
133
132
|
output_types: dict[str, Any]
|
134
133
|
runtime: str | None
|
134
|
+
services: dict[str, str]
|
135
135
|
|
136
136
|
|
137
137
|
logger = logging.getLogger("wandb")
|
@@ -168,6 +168,7 @@ class RunStatusChecker:
|
|
168
168
|
self,
|
169
169
|
run_id: str,
|
170
170
|
interface: InterfaceBase,
|
171
|
+
settings: Settings,
|
171
172
|
stop_polling_interval: int = 15,
|
172
173
|
retry_polling_interval: int = 5,
|
173
174
|
internal_messages_polling_interval: int = 10,
|
@@ -177,6 +178,7 @@ class RunStatusChecker:
|
|
177
178
|
self._stop_polling_interval = stop_polling_interval
|
178
179
|
self._retry_polling_interval = retry_polling_interval
|
179
180
|
self._internal_messages_polling_interval = internal_messages_polling_interval
|
181
|
+
self._settings = settings
|
180
182
|
|
181
183
|
self._join_event = threading.Event()
|
182
184
|
|
@@ -318,9 +320,15 @@ class RunStatusChecker:
|
|
318
320
|
|
319
321
|
def check_internal_messages(self) -> None:
|
320
322
|
def _process_internal_messages(result: Result) -> None:
|
323
|
+
if (
|
324
|
+
not self._settings.show_warnings
|
325
|
+
or self._settings.quiet
|
326
|
+
or self._settings.silent
|
327
|
+
):
|
328
|
+
return
|
321
329
|
internal_messages = result.response.internal_messages_response
|
322
330
|
for msg in internal_messages.messages.warning:
|
323
|
-
wandb.termwarn(msg)
|
331
|
+
wandb.termwarn(msg, repeat=False)
|
324
332
|
|
325
333
|
with wb_logging.log_to_run(self._run_id):
|
326
334
|
try:
|
@@ -467,62 +475,47 @@ class RunStatus:
|
|
467
475
|
|
468
476
|
|
469
477
|
class Run:
|
470
|
-
"""A unit of computation logged by
|
478
|
+
"""A unit of computation logged by W&B. Typically, this is an ML experiment.
|
471
479
|
|
472
|
-
|
473
|
-
|
474
|
-
|
480
|
+
Call [`wandb.init()`](https://docs.wandb.ai/ref/python/init/) to create a
|
481
|
+
new run. `wandb.init()` starts a new run and returns a `wandb.Run` object.
|
482
|
+
Each run is associated with a unique ID (run ID). W&B recommends using
|
483
|
+
a context (`with` statement) manager to automatically finish the run.
|
475
484
|
|
476
|
-
|
477
|
-
|
485
|
+
For distributed training experiments, you can either track each process
|
486
|
+
separately using one run per process or track all processes to a single run.
|
487
|
+
See [Log distributed training experiments](https://docs.wandb.ai/guides/track/log/distributed-training)
|
488
|
+
for more information.
|
478
489
|
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
490
|
+
You can log data to a run with `wandb.Run.log()`. Anything you log using
|
491
|
+
`wandb.Run.log()` is sent to that run. See
|
492
|
+
[Create an experiment](https://docs.wandb.ai/guides/track/launch) or
|
493
|
+
[`wandb.init`](https://docs.wandb.ai/ref/python/init/) API reference page
|
494
|
+
or more information.
|
483
495
|
|
484
|
-
|
496
|
+
There is a another `Run` object in the
|
497
|
+
[`wandb.apis.public`](https://docs.wandb.ai/ref/python/public-api/api/)
|
498
|
+
namespace. Use this object is to interact with runs that have already been
|
499
|
+
created.
|
485
500
|
|
486
|
-
|
501
|
+
Attributes:
|
502
|
+
summary: (Summary) A summary of the run, which is a dictionary-like
|
503
|
+
object. For more information, see
|
504
|
+
[Log summary metrics](https://docs.wandb.ai/guides/track/log/log-summary/).
|
487
505
|
|
488
|
-
|
489
|
-
|
490
|
-
anything you log with `wandb.log` will be sent to that run.
|
506
|
+
Examples:
|
507
|
+
Create a run with `wandb.init()`:
|
491
508
|
|
492
|
-
If you want to start more runs in the same script or notebook, you'll need to
|
493
|
-
finish the run that is in-flight. Runs can be finished with `wandb.finish` or
|
494
|
-
by using them in a `with` block:
|
495
509
|
```python
|
496
510
|
import wandb
|
497
511
|
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
with wandb.init() as run:
|
504
|
-
pass # log data here
|
505
|
-
|
506
|
-
assert wandb.run is None
|
512
|
+
# Start a new run and log some data
|
513
|
+
# Use context manager (`with` statement) to automatically finish the run
|
514
|
+
with wandb.init(entity="entity", project="project") as run:
|
515
|
+
run.log({"accuracy": acc, "loss": loss})
|
507
516
|
```
|
508
517
|
|
509
|
-
|
510
|
-
[our guide to `wandb.init`](https://docs.wandb.ai/guides/track/launch).
|
511
|
-
|
512
|
-
In distributed training, you can either create a single run in the rank 0 process
|
513
|
-
and then log information only from that process, or you can create a run in each process,
|
514
|
-
logging from each separately, and group the results together with the `group` argument
|
515
|
-
to `wandb.init`. For more details on distributed training with W&B, check out
|
516
|
-
[our guide](https://docs.wandb.ai/guides/track/log/distributed-training).
|
517
|
-
|
518
|
-
Currently, there is a parallel `Run` object in the `wandb.Api`. Eventually these
|
519
|
-
two objects will be merged.
|
520
|
-
|
521
|
-
Attributes:
|
522
|
-
summary: (Summary) Single values set for each `wandb.log()` key. By
|
523
|
-
default, summary is set to the last value logged. You can manually
|
524
|
-
set summary to the best value, like max accuracy, instead of the
|
525
|
-
final value.
|
518
|
+
<!-- lazydoc-ignore-init: internal -->
|
526
519
|
"""
|
527
520
|
|
528
521
|
_telemetry_obj: telemetry.TelemetryRecord
|
@@ -620,8 +613,6 @@ class Run:
|
|
620
613
|
)
|
621
614
|
self.summary._set_update_callback(self._summary_update_callback)
|
622
615
|
|
623
|
-
self.__metadata: Metadata | None = None
|
624
|
-
|
625
616
|
self._step = 0
|
626
617
|
self._starting_step = 0
|
627
618
|
self._start_runtime = 0
|
@@ -845,6 +836,7 @@ class Run:
|
|
845
836
|
@_log_to_run
|
846
837
|
@_attach
|
847
838
|
def config_static(self) -> wandb_config.ConfigStatic:
|
839
|
+
"""Static config object associated with this run."""
|
848
840
|
return wandb_config.ConfigStatic(self._config)
|
849
841
|
|
850
842
|
@property
|
@@ -952,7 +944,10 @@ class Run:
|
|
952
944
|
@_log_to_run
|
953
945
|
@_attach
|
954
946
|
def starting_step(self) -> int:
|
955
|
-
"""The first step of the run.
|
947
|
+
"""The first step of the run.
|
948
|
+
|
949
|
+
<!-- lazydoc-ignore: internal -->
|
950
|
+
"""
|
956
951
|
return self._starting_step
|
957
952
|
|
958
953
|
@property
|
@@ -968,7 +963,9 @@ class Run:
|
|
968
963
|
def step(self) -> int:
|
969
964
|
"""Current value of the step.
|
970
965
|
|
971
|
-
This counter is incremented by `wandb.log`.
|
966
|
+
This counter is incremented by `wandb.Run.log()`.
|
967
|
+
|
968
|
+
<!-- lazydoc-ignore: internal -->
|
972
969
|
"""
|
973
970
|
return self._step
|
974
971
|
|
@@ -976,26 +973,30 @@ class Run:
|
|
976
973
|
@_log_to_run
|
977
974
|
@_attach
|
978
975
|
def offline(self) -> bool:
|
976
|
+
"""True if the run is offline, False otherwise."""
|
979
977
|
return self._settings._offline
|
980
978
|
|
981
979
|
@property
|
982
980
|
@_log_to_run
|
983
981
|
@_attach
|
984
982
|
def disabled(self) -> bool:
|
983
|
+
"""True if the run is disabled, False otherwise."""
|
985
984
|
return self._settings._noop
|
986
985
|
|
987
986
|
@property
|
988
987
|
@_log_to_run
|
989
988
|
@_attach
|
990
989
|
def group(self) -> str:
|
991
|
-
"""
|
990
|
+
"""Returns the name of the group associated with this run.
|
992
991
|
|
993
|
-
|
992
|
+
Grouping runs together allows related experiments to be organized and
|
993
|
+
visualized collectively in the W&B UI. This is especially useful for
|
994
|
+
scenarios such as distributed training or cross-validation, where
|
995
|
+
multiple runs should be viewed and managed as a unified experiment.
|
994
996
|
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
folds the same group.
|
997
|
+
In shared mode, where all processes share the same run object,
|
998
|
+
setting a group is usually unnecessary, since there is only one
|
999
|
+
run and no grouping is required.
|
999
1000
|
"""
|
1000
1001
|
return self._settings.run_group or ""
|
1001
1002
|
|
@@ -1003,13 +1004,24 @@ class Run:
|
|
1003
1004
|
@_log_to_run
|
1004
1005
|
@_attach
|
1005
1006
|
def job_type(self) -> str:
|
1007
|
+
"""Name of the job type associated with the run.
|
1008
|
+
|
1009
|
+
View a run's job type in the run's Overview page in the W&B App.
|
1010
|
+
|
1011
|
+
You can use this to categorize runs by their job type, such as
|
1012
|
+
"training", "evaluation", or "inference". This is useful for organizing
|
1013
|
+
and filtering runs in the W&B UI, especially when you have multiple
|
1014
|
+
runs with different job types in the same project. For more
|
1015
|
+
information, see [Organize runs](https://docs.wandb.ai/guides/runs/#organize-runs).
|
1016
|
+
"""
|
1006
1017
|
return self._settings.run_job_type or ""
|
1007
1018
|
|
1008
1019
|
def project_name(self) -> str:
|
1009
|
-
"""
|
1020
|
+
"""This method is deprecated and will be removed in a future release. Use `run.project` instead.
|
1021
|
+
|
1022
|
+
Name of the W&B project associated with the run.
|
1010
1023
|
|
1011
|
-
|
1012
|
-
Please use `run.project` instead.
|
1024
|
+
<!-- lazydoc-ignore: internal -->
|
1013
1025
|
"""
|
1014
1026
|
deprecate.deprecate(
|
1015
1027
|
field_name=Deprecated.run__project_name,
|
@@ -1030,12 +1042,12 @@ class Run:
|
|
1030
1042
|
|
1031
1043
|
@_log_to_run
|
1032
1044
|
def get_project_url(self) -> str | None:
|
1033
|
-
"""
|
1045
|
+
"""This method is deprecated and will be removed in a future release. Use `run.project_url` instead.
|
1034
1046
|
|
1047
|
+
URL of the W&B project associated with the run, if there is one.
|
1035
1048
|
Offline runs do not have a project URL.
|
1036
1049
|
|
1037
|
-
|
1038
|
-
Please use `run.project_url` instead.
|
1050
|
+
<!-- lazydoc-ignore: internal -->
|
1039
1051
|
"""
|
1040
1052
|
deprecate.deprecate(
|
1041
1053
|
field_name=Deprecated.run__get_project_url,
|
@@ -1082,28 +1094,36 @@ class Run:
|
|
1082
1094
|
many runs to share the same artifact. Specifying name allows you to achieve that.
|
1083
1095
|
include_fn: A callable that accepts a file path and (optionally) root path and
|
1084
1096
|
returns True when it should be included and False otherwise. This
|
1085
|
-
defaults to
|
1097
|
+
defaults to `lambda path, root: path.endswith(".py")`.
|
1086
1098
|
exclude_fn: A callable that accepts a file path and (optionally) root path and
|
1087
1099
|
returns `True` when it should be excluded and `False` otherwise. This
|
1088
1100
|
defaults to a function that excludes all files within `<root>/.wandb/`
|
1089
1101
|
and `<root>/wandb/` directories.
|
1090
1102
|
|
1091
1103
|
Examples:
|
1092
|
-
|
1093
|
-
|
1104
|
+
Basic usage
|
1105
|
+
|
1106
|
+
```python
|
1107
|
+
import wandb
|
1108
|
+
|
1109
|
+
with wandb.init() as run:
|
1094
1110
|
run.log_code()
|
1095
|
-
|
1111
|
+
```
|
1112
|
+
|
1113
|
+
Advanced usage
|
1096
1114
|
|
1097
|
-
|
1098
|
-
|
1115
|
+
```python
|
1116
|
+
import wandb
|
1117
|
+
|
1118
|
+
with wandb.init() as run:
|
1099
1119
|
run.log_code(
|
1100
|
-
"../",
|
1120
|
+
root="../",
|
1101
1121
|
include_fn=lambda path: path.endswith(".py") or path.endswith(".ipynb"),
|
1102
1122
|
exclude_fn=lambda path, root: os.path.relpath(path, root).startswith(
|
1103
1123
|
"cache/"
|
1104
1124
|
),
|
1105
1125
|
)
|
1106
|
-
|
1126
|
+
```
|
1107
1127
|
|
1108
1128
|
Returns:
|
1109
1129
|
An `Artifact` object if code was logged
|
@@ -1156,12 +1176,12 @@ class Run:
|
|
1156
1176
|
|
1157
1177
|
@_log_to_run
|
1158
1178
|
def get_sweep_url(self) -> str | None:
|
1159
|
-
"""
|
1179
|
+
"""This method is deprecated and will be removed in a future release. Use `run.sweep_url` instead.
|
1160
1180
|
|
1181
|
+
The URL of the sweep associated with the run, if there is one.
|
1161
1182
|
Offline runs do not have a sweep URL.
|
1162
1183
|
|
1163
|
-
|
1164
|
-
Please use `run.sweep_url` instead.
|
1184
|
+
<!-- lazydoc-ignore: internal -->
|
1165
1185
|
"""
|
1166
1186
|
deprecate.deprecate(
|
1167
1187
|
field_name=Deprecated.run__get_sweep_url,
|
@@ -1186,12 +1206,11 @@ class Run:
|
|
1186
1206
|
|
1187
1207
|
@_log_to_run
|
1188
1208
|
def get_url(self) -> str | None:
|
1189
|
-
"""
|
1209
|
+
"""This method is deprecated and will be removed in a future release. Use `run.url` instead.
|
1190
1210
|
|
1191
|
-
Offline runs do not have a URL.
|
1211
|
+
URL of the W&B run, if there is one. Offline runs do not have a URL.
|
1192
1212
|
|
1193
|
-
|
1194
|
-
Please use `run.url` instead.
|
1213
|
+
<!-- lazydoc-ignore: internal -->
|
1195
1214
|
"""
|
1196
1215
|
deprecate.deprecate(
|
1197
1216
|
field_name=Deprecated.run__get_url,
|
@@ -1314,7 +1333,7 @@ class Run:
|
|
1314
1333
|
@_log_to_run
|
1315
1334
|
@_attach
|
1316
1335
|
def display(self, height: int = 420, hidden: bool = False) -> bool:
|
1317
|
-
"""Display this run in
|
1336
|
+
"""Display this run in Jupyter."""
|
1318
1337
|
if self._settings.silent:
|
1319
1338
|
return False
|
1320
1339
|
|
@@ -1333,7 +1352,10 @@ class Run:
|
|
1333
1352
|
@_log_to_run
|
1334
1353
|
@_attach
|
1335
1354
|
def to_html(self, height: int = 420, hidden: bool = False) -> str:
|
1336
|
-
"""Generate HTML containing an iframe displaying the current run.
|
1355
|
+
"""Generate HTML containing an iframe displaying the current run.
|
1356
|
+
|
1357
|
+
<!-- lazydoc-ignore: internal -->
|
1358
|
+
"""
|
1337
1359
|
url = self._settings.run_url + "?jupyter=true"
|
1338
1360
|
style = f"border:none;width:100%;height:{height}px;"
|
1339
1361
|
prefix = ""
|
@@ -1484,7 +1506,7 @@ class Run:
|
|
1484
1506
|
) -> dict[str, Any]:
|
1485
1507
|
"""Process and replace chart objects with their underlying table values.
|
1486
1508
|
|
1487
|
-
This processes the chart objects passed to `
|
1509
|
+
This processes the chart objects passed to `wandb.Run.log()`, replacing their entries
|
1488
1510
|
in the given dictionary (which is saved to the run's history) and adding them
|
1489
1511
|
to the run's config.
|
1490
1512
|
|
@@ -1647,7 +1669,7 @@ class Run:
|
|
1647
1669
|
def _populate_git_info(self) -> None:
|
1648
1670
|
from .lib.gitlib import GitRepo
|
1649
1671
|
|
1650
|
-
# Use user
|
1672
|
+
# Use user-provided git info if available, otherwise resolve it from the environment
|
1651
1673
|
try:
|
1652
1674
|
repo = GitRepo(
|
1653
1675
|
root=self._settings.git_root,
|
@@ -1740,91 +1762,94 @@ class Run:
|
|
1740
1762
|
"""Upload run data.
|
1741
1763
|
|
1742
1764
|
Use `log` to log data from runs, such as scalars, images, video,
|
1743
|
-
histograms, plots, and tables.
|
1765
|
+
histograms, plots, and tables. See [Log objects and media](https://docs.wandb.ai/guides/track/log) for
|
1766
|
+
code snippets, best practices, and more.
|
1767
|
+
|
1768
|
+
Basic usage:
|
1744
1769
|
|
1745
|
-
|
1746
|
-
|
1770
|
+
```python
|
1771
|
+
import wandb
|
1772
|
+
|
1773
|
+
with wandb.init() as run:
|
1774
|
+
run.log({"train-loss": 0.5, "accuracy": 0.9})
|
1775
|
+
```
|
1747
1776
|
|
1748
|
-
The
|
1749
|
-
|
1750
|
-
the summary values for these metrics.
|
1777
|
+
The previous code snippet saves the loss and accuracy to the run's
|
1778
|
+
history and updates the summary values for these metrics.
|
1751
1779
|
|
1752
|
-
Visualize logged data in
|
1780
|
+
Visualize logged data in a workspace at [wandb.ai](https://wandb.ai),
|
1753
1781
|
or locally on a [self-hosted instance](https://docs.wandb.ai/guides/hosting)
|
1754
|
-
of the W&B app, or export data to visualize and explore locally,
|
1755
|
-
Jupyter
|
1756
|
-
|
1757
|
-
Logged values don't have to be scalars.
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
[guide to logging tables](https://docs.wandb.ai/guides/models/tables/tables-walkthrough)
|
1766
|
-
for details.
|
1767
|
-
|
1768
|
-
The W&B UI organizes metrics with a forward slash (`/`) in their name
|
1782
|
+
of the W&B app, or export data to visualize and explore locally, such as in a
|
1783
|
+
Jupyter notebook, with the [Public API](https://docs.wandb.ai/guides/track/public-api-guide).
|
1784
|
+
|
1785
|
+
Logged values don't have to be scalars. You can log any
|
1786
|
+
[W&B supported Data Type](https://docs.wandb.ai/ref/python/data-types/)
|
1787
|
+
such as images, audio, video, and more. For example, you can use
|
1788
|
+
`wandb.Table` to log structured data. See
|
1789
|
+
[Log tables, visualize and query data](https://docs.wandb.ai/guides/models/tables/tables-walkthrough)
|
1790
|
+
tutorial for more details.
|
1791
|
+
|
1792
|
+
W&B organizes metrics with a forward slash (`/`) in their name
|
1769
1793
|
into sections named using the text before the final slash. For example,
|
1770
1794
|
the following results in two sections named "train" and "validate":
|
1771
1795
|
|
1772
|
-
```
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1796
|
+
```python
|
1797
|
+
with wandb.init() as run:
|
1798
|
+
# Log metrics in the "train" section.
|
1799
|
+
run.log(
|
1800
|
+
{
|
1801
|
+
"train/accuracy": 0.9,
|
1802
|
+
"train/loss": 30,
|
1803
|
+
"validate/accuracy": 0.8,
|
1804
|
+
"validate/loss": 20,
|
1805
|
+
}
|
1806
|
+
)
|
1781
1807
|
```
|
1782
1808
|
|
1783
1809
|
Only one level of nesting is supported; `run.log({"a/b/c": 1})`
|
1784
1810
|
produces a section named "a/b".
|
1785
1811
|
|
1786
|
-
`run.log` is not intended to be called more than a few times per second.
|
1812
|
+
`run.log()` is not intended to be called more than a few times per second.
|
1787
1813
|
For optimal performance, limit your logging to once every N iterations,
|
1788
1814
|
or collect data over multiple iterations and log it in a single step.
|
1789
1815
|
|
1790
|
-
|
1791
|
-
|
1792
|
-
With basic usage, each call to `log` creates a new "step".
|
1816
|
+
By default, each call to `log` creates a new "step".
|
1793
1817
|
The step must always increase, and it is not possible to log
|
1794
|
-
to a previous step.
|
1818
|
+
to a previous step. You can use any metric as the X axis in charts.
|
1819
|
+
See [Custom log axes](https://docs.wandb.ai/guides/track/log/customize-logging-axes/)
|
1820
|
+
for more details.
|
1795
1821
|
|
1796
|
-
Note that you can use any metric as the X axis in charts.
|
1797
1822
|
In many cases, it is better to treat the W&B step like
|
1798
1823
|
you'd treat a timestamp rather than a training step.
|
1799
1824
|
|
1825
|
+
```python
|
1826
|
+
with wandb.init() as run:
|
1827
|
+
# Example: log an "epoch" metric for use as an X axis.
|
1828
|
+
run.log({"epoch": 40, "train-loss": 0.5})
|
1800
1829
|
```
|
1801
|
-
# Example: log an "epoch" metric for use as an X axis.
|
1802
|
-
run.log({"epoch": 40, "train-loss": 0.5})
|
1803
|
-
```
|
1804
|
-
|
1805
|
-
See also [define_metric](https://docs.wandb.ai/ref/python/run#define_metric).
|
1806
1830
|
|
1807
|
-
It is possible to use multiple `log` invocations to log to
|
1831
|
+
It is possible to use multiple `wandb.Run.log()` invocations to log to
|
1808
1832
|
the same step with the `step` and `commit` parameters.
|
1809
1833
|
The following are all equivalent:
|
1810
1834
|
|
1811
|
-
```
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1835
|
+
```python
|
1836
|
+
with wandb.init() as run:
|
1837
|
+
# Normal usage:
|
1838
|
+
run.log({"train-loss": 0.5, "accuracy": 0.8})
|
1839
|
+
run.log({"train-loss": 0.4, "accuracy": 0.9})
|
1840
|
+
|
1841
|
+
# Implicit step without auto-incrementing:
|
1842
|
+
run.log({"train-loss": 0.5}, commit=False)
|
1843
|
+
run.log({"accuracy": 0.8})
|
1844
|
+
run.log({"train-loss": 0.4}, commit=False)
|
1845
|
+
run.log({"accuracy": 0.9})
|
1846
|
+
|
1847
|
+
# Explicit step:
|
1848
|
+
run.log({"train-loss": 0.5}, step=current_step)
|
1849
|
+
run.log({"accuracy": 0.8}, step=current_step)
|
1850
|
+
current_step += 1
|
1851
|
+
run.log({"train-loss": 0.4}, step=current_step)
|
1852
|
+
run.log({"accuracy": 0.9}, step=current_step)
|
1828
1853
|
```
|
1829
1854
|
|
1830
1855
|
Args:
|
@@ -1842,59 +1867,64 @@ class Run:
|
|
1842
1867
|
otherwise, the default is `commit=False`.
|
1843
1868
|
|
1844
1869
|
Examples:
|
1845
|
-
|
1846
|
-
|
1870
|
+
For more and more detailed examples, see
|
1871
|
+
[our guides to logging](https://docs.wandb.com/guides/track/log).
|
1847
1872
|
|
1848
|
-
|
1849
|
-
```python
|
1850
|
-
import wandb
|
1873
|
+
Basic usage
|
1851
1874
|
|
1852
|
-
|
1853
|
-
|
1854
|
-
```
|
1875
|
+
```python
|
1876
|
+
import wandb
|
1855
1877
|
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1878
|
+
with wandb.init() as run:
|
1879
|
+
run.log({"train-loss": 0.5, "accuracy": 0.9
|
1880
|
+
```
|
1859
1881
|
|
1860
|
-
|
1882
|
+
Incremental logging
|
1883
|
+
|
1884
|
+
```python
|
1885
|
+
import wandb
|
1886
|
+
|
1887
|
+
with wandb.init() as run:
|
1861
1888
|
run.log({"loss": 0.2}, commit=False)
|
1862
1889
|
# Somewhere else when I'm ready to report this step:
|
1863
1890
|
run.log({"accuracy": 0.8})
|
1864
|
-
|
1891
|
+
```
|
1892
|
+
|
1893
|
+
Histogram
|
1865
1894
|
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
import wandb
|
1895
|
+
```python
|
1896
|
+
import numpy as np
|
1897
|
+
import wandb
|
1870
1898
|
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1899
|
+
# sample gradients at random from normal distribution
|
1900
|
+
gradients = np.random.randn(100, 100)
|
1901
|
+
with wandb.init() as run:
|
1874
1902
|
run.log({"gradients": wandb.Histogram(gradients)})
|
1875
|
-
|
1903
|
+
```
|
1904
|
+
|
1905
|
+
Image from NumPy
|
1876
1906
|
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
import wandb
|
1907
|
+
```python
|
1908
|
+
import numpy as np
|
1909
|
+
import wandb
|
1881
1910
|
|
1882
|
-
|
1911
|
+
with wandb.init() as run:
|
1883
1912
|
examples = []
|
1884
1913
|
for i in range(3):
|
1885
1914
|
pixels = np.random.randint(low=0, high=256, size=(100, 100, 3))
|
1886
1915
|
image = wandb.Image(pixels, caption=f"random field {i}")
|
1887
1916
|
examples.append(image)
|
1888
1917
|
run.log({"examples": examples})
|
1889
|
-
|
1918
|
+
```
|
1890
1919
|
|
1891
|
-
|
1892
|
-
```python
|
1893
|
-
import numpy as np
|
1894
|
-
from PIL import Image as PILImage
|
1895
|
-
import wandb
|
1920
|
+
Image from PIL
|
1896
1921
|
|
1897
|
-
|
1922
|
+
```python
|
1923
|
+
import numpy as np
|
1924
|
+
from PIL import Image as PILImage
|
1925
|
+
import wandb
|
1926
|
+
|
1927
|
+
with wandb.init() as run:
|
1898
1928
|
examples = []
|
1899
1929
|
for i in range(3):
|
1900
1930
|
pixels = np.random.randint(
|
@@ -1907,14 +1937,15 @@ class Run:
|
|
1907
1937
|
image = wandb.Image(pil_image, caption=f"random field {i}")
|
1908
1938
|
examples.append(image)
|
1909
1939
|
run.log({"examples": examples})
|
1910
|
-
|
1940
|
+
```
|
1911
1941
|
|
1912
|
-
|
1913
|
-
```python
|
1914
|
-
import numpy as np
|
1915
|
-
import wandb
|
1942
|
+
Video from NumPy
|
1916
1943
|
|
1917
|
-
|
1944
|
+
```python
|
1945
|
+
import numpy as np
|
1946
|
+
import wandb
|
1947
|
+
|
1948
|
+
with wandb.init() as run:
|
1918
1949
|
# axes are (time, channel, height, width)
|
1919
1950
|
frames = np.random.randint(
|
1920
1951
|
low=0,
|
@@ -1923,35 +1954,38 @@ class Run:
|
|
1923
1954
|
dtype=np.uint8,
|
1924
1955
|
)
|
1925
1956
|
run.log({"video": wandb.Video(frames, fps=4)})
|
1926
|
-
|
1957
|
+
```
|
1927
1958
|
|
1928
|
-
|
1929
|
-
```python
|
1930
|
-
from matplotlib import pyplot as plt
|
1931
|
-
import numpy as np
|
1932
|
-
import wandb
|
1959
|
+
Matplotlib plot
|
1933
1960
|
|
1934
|
-
|
1961
|
+
```python
|
1962
|
+
from matplotlib import pyplot as plt
|
1963
|
+
import numpy as np
|
1964
|
+
import wandb
|
1965
|
+
|
1966
|
+
with wandb.init() as run:
|
1935
1967
|
fig, ax = plt.subplots()
|
1936
1968
|
x = np.linspace(0, 10)
|
1937
1969
|
y = x * x
|
1938
1970
|
ax.plot(x, y) # plot y = x^2
|
1939
1971
|
run.log({"chart": fig})
|
1940
|
-
|
1972
|
+
```
|
1973
|
+
|
1974
|
+
PR Curve
|
1941
1975
|
|
1942
|
-
|
1943
|
-
|
1944
|
-
import wandb
|
1976
|
+
```python
|
1977
|
+
import wandb
|
1945
1978
|
|
1946
|
-
|
1979
|
+
with wandb.init() as run:
|
1947
1980
|
run.log({"pr": wandb.plot.pr_curve(y_test, y_probas, labels)})
|
1948
|
-
|
1981
|
+
```
|
1982
|
+
|
1983
|
+
3D Object
|
1949
1984
|
|
1950
|
-
|
1951
|
-
|
1952
|
-
import wandb
|
1985
|
+
```python
|
1986
|
+
import wandb
|
1953
1987
|
|
1954
|
-
|
1988
|
+
with wandb.init() as run:
|
1955
1989
|
run.log(
|
1956
1990
|
{
|
1957
1991
|
"generated_samples": [
|
@@ -1961,11 +1995,11 @@ class Run:
|
|
1961
1995
|
]
|
1962
1996
|
}
|
1963
1997
|
)
|
1964
|
-
|
1998
|
+
```
|
1965
1999
|
|
1966
2000
|
Raises:
|
1967
|
-
wandb.Error:
|
1968
|
-
ValueError:
|
2001
|
+
wandb.Error: If called before `wandb.init()`.
|
2002
|
+
ValueError: If invalid data is passed.
|
1969
2003
|
|
1970
2004
|
"""
|
1971
2005
|
if step is not None:
|
@@ -2000,42 +2034,48 @@ class Run:
|
|
2000
2034
|
|
2001
2035
|
A `base_path` may be provided to control the directory structure of
|
2002
2036
|
uploaded files. It should be a prefix of `glob_str`, and the directory
|
2003
|
-
structure beneath it is preserved.
|
2004
|
-
examples:
|
2005
|
-
|
2006
|
-
```
|
2007
|
-
wandb.save("these/are/myfiles/*")
|
2008
|
-
# => Saves files in a "these/are/myfiles/" folder in the run.
|
2009
|
-
|
2010
|
-
wandb.save("these/are/myfiles/*", base_path="these")
|
2011
|
-
# => Saves files in an "are/myfiles/" folder in the run.
|
2012
|
-
|
2013
|
-
wandb.save("/User/username/Documents/run123/*.txt")
|
2014
|
-
# => Saves files in a "run123/" folder in the run. See note below.
|
2015
|
-
|
2016
|
-
wandb.save("/User/username/Documents/run123/*.txt", base_path="/User")
|
2017
|
-
# => Saves files in a "username/Documents/run123/" folder in the run.
|
2018
|
-
|
2019
|
-
wandb.save("files/*/saveme.txt")
|
2020
|
-
# => Saves each "saveme.txt" file in an appropriate subdirectory
|
2021
|
-
# of "files/".
|
2022
|
-
```
|
2037
|
+
structure beneath it is preserved.
|
2023
2038
|
|
2024
|
-
|
2039
|
+
When given an absolute path or glob and no `base_path`, one
|
2025
2040
|
directory level is preserved as in the example above.
|
2026
2041
|
|
2027
2042
|
Args:
|
2028
2043
|
glob_str: A relative or absolute path or Unix glob.
|
2029
2044
|
base_path: A path to use to infer a directory structure; see examples.
|
2030
2045
|
policy: One of `live`, `now`, or `end`.
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2046
|
+
- live: upload the file as it changes, overwriting the previous version
|
2047
|
+
- now: upload the file once now
|
2048
|
+
- end: upload file when the run ends
|
2034
2049
|
|
2035
2050
|
Returns:
|
2036
2051
|
Paths to the symlinks created for the matched files.
|
2037
2052
|
|
2038
2053
|
For historical reasons, this may return a boolean in legacy code.
|
2054
|
+
|
2055
|
+
```python
|
2056
|
+
import wandb
|
2057
|
+
|
2058
|
+
run = wandb.init()
|
2059
|
+
|
2060
|
+
run.save("these/are/myfiles/*")
|
2061
|
+
# => Saves files in a "these/are/myfiles/" folder in the run.
|
2062
|
+
|
2063
|
+
run.save("these/are/myfiles/*", base_path="these")
|
2064
|
+
# => Saves files in an "are/myfiles/" folder in the run.
|
2065
|
+
|
2066
|
+
run.save("/User/username/Documents/run123/*.txt")
|
2067
|
+
# => Saves files in a "run123/" folder in the run. See note below.
|
2068
|
+
|
2069
|
+
run.save("/User/username/Documents/run123/*.txt", base_path="/User")
|
2070
|
+
# => Saves files in a "username/Documents/run123/" folder in the run.
|
2071
|
+
|
2072
|
+
run.save("files/*/saveme.txt")
|
2073
|
+
# => Saves each "saveme.txt" file in an appropriate subdirectory
|
2074
|
+
# of "files/".
|
2075
|
+
|
2076
|
+
# Explicitly finish the run since a context manager is not used.
|
2077
|
+
run.finish()
|
2078
|
+
```
|
2039
2079
|
"""
|
2040
2080
|
if isinstance(glob_str, bytes):
|
2041
2081
|
# Preserved for backward compatibility: allow bytes inputs.
|
@@ -2189,6 +2229,7 @@ class Run:
|
|
2189
2229
|
- Crashed: Run that stopped sending heartbeats unexpectedly.
|
2190
2230
|
- Finished: Run completed successfully (`exit_code=0`) with all data synced.
|
2191
2231
|
- Failed: Run completed with errors (`exit_code!=0`).
|
2232
|
+
- Killed: Run was forcibly stopped before it could finish.
|
2192
2233
|
|
2193
2234
|
Args:
|
2194
2235
|
exit_code: Integer indicating the run's exit status. Use 0 for success,
|
@@ -2481,6 +2522,7 @@ class Run:
|
|
2481
2522
|
self._run_status_checker = RunStatusChecker(
|
2482
2523
|
self._settings.run_id,
|
2483
2524
|
interface=self._backend.interface,
|
2525
|
+
settings=self._settings,
|
2484
2526
|
)
|
2485
2527
|
self._run_status_checker.start()
|
2486
2528
|
|
@@ -2688,15 +2730,10 @@ class Run:
|
|
2688
2730
|
),
|
2689
2731
|
)
|
2690
2732
|
|
2691
|
-
# Print some final statistics.
|
2692
2733
|
poll_exit_handle = self._backend.interface.deliver_poll_exit()
|
2693
2734
|
result = poll_exit_handle.wait_or(timeout=None)
|
2694
|
-
progress.print_sync_dedupe_stats(
|
2695
|
-
self._printer,
|
2696
|
-
result.response.poll_exit_response,
|
2697
|
-
)
|
2698
|
-
|
2699
2735
|
self._poll_exit_response = result.response.poll_exit_response
|
2736
|
+
|
2700
2737
|
internal_messages_handle = self._backend.interface.deliver_internal_messages()
|
2701
2738
|
result = internal_messages_handle.wait_or(timeout=None)
|
2702
2739
|
self._internal_messages_response = result.response.internal_messages_response
|
@@ -2742,23 +2779,26 @@ class Run:
|
|
2742
2779
|
goal: str | None = None,
|
2743
2780
|
overwrite: bool | None = None,
|
2744
2781
|
) -> wandb_metric.Metric:
|
2745
|
-
"""Customize metrics logged with `wandb.log()`.
|
2782
|
+
"""Customize metrics logged with `wandb.Run.log()`.
|
2746
2783
|
|
2747
2784
|
Args:
|
2748
2785
|
name: The name of the metric to customize.
|
2749
2786
|
step_metric: The name of another metric to serve as the X-axis
|
2750
2787
|
for this metric in automatically generated charts.
|
2751
2788
|
step_sync: Automatically insert the last value of step_metric into
|
2752
|
-
`
|
2789
|
+
`wandb.Run.log()` if it is not provided explicitly. Defaults to True
|
2753
2790
|
if step_metric is specified.
|
2754
2791
|
hidden: Hide this metric from automatic plots.
|
2755
2792
|
summary: Specify aggregate metrics added to summary.
|
2756
2793
|
Supported aggregations include "min", "max", "mean", "last",
|
2757
|
-
"best", "copy" and "none". "
|
2758
|
-
|
2759
|
-
"
|
2794
|
+
"first", "best", "copy" and "none". "none" prevents a summary
|
2795
|
+
from being generated. "best" is used together with the goal
|
2796
|
+
parameter, "best" is deprecated and should not be used, use
|
2797
|
+
"min" or "max" instead. "copy" is deprecated and should not be
|
2798
|
+
used.
|
2760
2799
|
goal: Specify how to interpret the "best" summary type.
|
2761
|
-
Supported options are "minimize" and "maximize".
|
2800
|
+
Supported options are "minimize" and "maximize". "goal" is
|
2801
|
+
deprecated and should not be used, use "min" or "max" instead.
|
2762
2802
|
overwrite: If false, then this call is merged with previous
|
2763
2803
|
`define_metric` calls for the same metric by using their
|
2764
2804
|
values for any unspecified parameters. If true, then
|
@@ -2831,7 +2871,7 @@ class Run:
|
|
2831
2871
|
if summary:
|
2832
2872
|
summary_items = [s.lower() for s in summary.split(",")]
|
2833
2873
|
summary_ops = []
|
2834
|
-
valid = {"min", "max", "mean", "best", "last", "copy", "none"}
|
2874
|
+
valid = {"min", "max", "mean", "best", "last", "copy", "none", "first"}
|
2835
2875
|
# TODO: deprecate copy and best
|
2836
2876
|
for i in summary_items:
|
2837
2877
|
if i not in valid:
|
@@ -2882,29 +2922,22 @@ class Run:
|
|
2882
2922
|
idx: int | None = None,
|
2883
2923
|
log_graph: bool = False,
|
2884
2924
|
) -> None:
|
2885
|
-
"""
|
2925
|
+
"""Hook into given PyTorch model to monitor gradients and the model's computational graph.
|
2886
2926
|
|
2887
|
-
This function can track parameters, gradients, or both during training.
|
2888
|
-
extended to support arbitrary machine learning models in the future.
|
2927
|
+
This function can track parameters, gradients, or both during training.
|
2889
2928
|
|
2890
2929
|
Args:
|
2891
|
-
models
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
log
|
2896
|
-
|
2897
|
-
|
2898
|
-
log_freq (int):
|
2899
|
-
Frequency (in batches) to log gradients and parameters. (default=1000)
|
2900
|
-
idx (Optional[int]):
|
2901
|
-
Index used when tracking multiple models with `wandb.watch`. (default=None)
|
2902
|
-
log_graph (bool):
|
2903
|
-
Whether to log the model's computational graph. (default=False)
|
2930
|
+
models: A single model or a sequence of models to be monitored.
|
2931
|
+
criterion: The loss function being optimized (optional).
|
2932
|
+
log: Specifies whether to log "gradients", "parameters", or "all".
|
2933
|
+
Set to None to disable logging. (default="gradients").
|
2934
|
+
log_freq: Frequency (in batches) to log gradients and parameters. (default=1000)
|
2935
|
+
idx: Index used when tracking multiple models with `wandb.watch`. (default=None)
|
2936
|
+
log_graph: Whether to log the model's computational graph. (default=False)
|
2904
2937
|
|
2905
2938
|
Raises:
|
2906
2939
|
ValueError:
|
2907
|
-
If `wandb.init` has not been called or if any of the models are not instances
|
2940
|
+
If `wandb.init()` has not been called or if any of the models are not instances
|
2908
2941
|
of `torch.nn.Module`.
|
2909
2942
|
"""
|
2910
2943
|
wandb.sdk._watch(self, models, criterion, log, log_freq, idx, log_graph)
|
@@ -2917,8 +2950,7 @@ class Run:
|
|
2917
2950
|
"""Remove pytorch model topology, gradient and parameter hooks.
|
2918
2951
|
|
2919
2952
|
Args:
|
2920
|
-
models
|
2921
|
-
Optional list of pytorch models that have had watch called on them
|
2953
|
+
models: Optional list of pytorch models that have had watch called on them.
|
2922
2954
|
"""
|
2923
2955
|
wandb.sdk._unwatch(self, models=models)
|
2924
2956
|
|
@@ -2933,7 +2965,7 @@ class Run:
|
|
2933
2965
|
) -> Artifact | None:
|
2934
2966
|
"""Link the given artifact to a portfolio (a promoted collection of artifacts).
|
2935
2967
|
|
2936
|
-
|
2968
|
+
Linked artifacts are visible in the UI for the specified portfolio.
|
2937
2969
|
|
2938
2970
|
Args:
|
2939
2971
|
artifact: the (public or local) artifact which will be linked
|
@@ -2947,13 +2979,6 @@ class Run:
|
|
2947
2979
|
The linked artifact if linking was successful, otherwise None.
|
2948
2980
|
|
2949
2981
|
"""
|
2950
|
-
portfolio, project, entity = wandb.util._parse_entity_project_item(target_path)
|
2951
|
-
if aliases is None:
|
2952
|
-
aliases = []
|
2953
|
-
|
2954
|
-
if not self._backend or not self._backend.interface:
|
2955
|
-
return None
|
2956
|
-
|
2957
2982
|
if artifact.is_draft() and not artifact._is_draft_save_started():
|
2958
2983
|
artifact = self._log_artifact(artifact)
|
2959
2984
|
|
@@ -2961,52 +2986,17 @@ class Run:
|
|
2961
2986
|
# TODO: implement offline mode + sync
|
2962
2987
|
raise NotImplementedError
|
2963
2988
|
|
2964
|
-
#
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
project = project or self.project
|
2974
|
-
entity = entity or self.entity
|
2975
|
-
handle = self._backend.interface.deliver_link_artifact(
|
2976
|
-
artifact,
|
2977
|
-
portfolio,
|
2978
|
-
aliases,
|
2979
|
-
entity,
|
2980
|
-
project,
|
2981
|
-
organization,
|
2982
|
-
)
|
2983
|
-
if artifact._ttl_duration_seconds is not None:
|
2984
|
-
wandb.termwarn(
|
2985
|
-
"Artifact TTL will be disabled for source artifacts that are linked to portfolios."
|
2986
|
-
)
|
2987
|
-
result = handle.wait_or(timeout=None)
|
2988
|
-
response = result.response.link_artifact_response
|
2989
|
-
if response.error_message:
|
2990
|
-
wandb.termerror(response.error_message)
|
2991
|
-
return None
|
2992
|
-
if response.version_index is None:
|
2993
|
-
wandb.termerror(
|
2994
|
-
"Error fetching the linked artifact's version index after linking"
|
2995
|
-
)
|
2996
|
-
return None
|
2989
|
+
# Normalize the target "entity/project/collection" with defaults
|
2990
|
+
# inferred from this run's entity and project, if needed.
|
2991
|
+
#
|
2992
|
+
# HOWEVER, if the target path is a registry collection, avoid setting
|
2993
|
+
# the target entity to the run's entity. Instead, delegate to
|
2994
|
+
# Artifact.link() to resolve the required org entity.
|
2995
|
+
target = ArtifactPath.from_str(target_path)
|
2996
|
+
if not (target.project and is_artifact_registry_project(target.project)):
|
2997
|
+
target = target.with_defaults(prefix=self.entity, project=self.project)
|
2997
2998
|
|
2998
|
-
|
2999
|
-
artifact_name = f"{entity}/{project}/{portfolio}:v{response.version_index}"
|
3000
|
-
if is_artifact_registry_project(project):
|
3001
|
-
if organization:
|
3002
|
-
artifact_name = f"{organization}/{project}/{portfolio}:v{response.version_index}"
|
3003
|
-
else:
|
3004
|
-
artifact_name = f"{project}/{portfolio}:v{response.version_index}"
|
3005
|
-
linked_artifact = self._public_api()._artifact(artifact_name)
|
3006
|
-
except Exception as e:
|
3007
|
-
wandb.termerror(f"Error fetching link artifact after linking: {e}")
|
3008
|
-
return None
|
3009
|
-
return linked_artifact
|
2999
|
+
return artifact.link(target.to_str(), aliases)
|
3010
3000
|
|
3011
3001
|
@_log_to_run
|
3012
3002
|
@_raise_if_finished
|
@@ -3023,19 +3013,46 @@ class Run:
|
|
3023
3013
|
Call `download` or `file` on the returned object to get the contents locally.
|
3024
3014
|
|
3025
3015
|
Args:
|
3026
|
-
artifact_or_name:
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3033
|
-
type:
|
3034
|
-
aliases:
|
3016
|
+
artifact_or_name: The name of the artifact to use. May be prefixed
|
3017
|
+
with the name of the project the artifact was logged to
|
3018
|
+
("<entity>" or "<entity>/<project>"). If no
|
3019
|
+
entity is specified in the name, the Run or API setting's entity is used.
|
3020
|
+
Valid names can be in the following forms
|
3021
|
+
- name:version
|
3022
|
+
- name:alias
|
3023
|
+
type: The type of artifact to use.
|
3024
|
+
aliases: Aliases to apply to this artifact
|
3035
3025
|
use_as: This argument is deprecated and does nothing.
|
3036
3026
|
|
3037
3027
|
Returns:
|
3038
3028
|
An `Artifact` object.
|
3029
|
+
|
3030
|
+
Examples:
|
3031
|
+
```python
|
3032
|
+
import wandb
|
3033
|
+
|
3034
|
+
run = wandb.init(project="<example>")
|
3035
|
+
|
3036
|
+
# Use an artifact by name and alias
|
3037
|
+
artifact_a = run.use_artifact(artifact_or_name="<name>:<alias>")
|
3038
|
+
|
3039
|
+
# Use an artifact by name and version
|
3040
|
+
artifact_b = run.use_artifact(artifact_or_name="<name>:v<version>")
|
3041
|
+
|
3042
|
+
# Use an artifact by entity/project/name:alias
|
3043
|
+
artifact_c = run.use_artifact(
|
3044
|
+
artifact_or_name="<entity>/<project>/<name>:<alias>"
|
3045
|
+
)
|
3046
|
+
|
3047
|
+
# Use an artifact by entity/project/name:version
|
3048
|
+
artifact_d = run.use_artifact(
|
3049
|
+
artifact_or_name="<entity>/<project>/<name>:v<version>"
|
3050
|
+
)
|
3051
|
+
|
3052
|
+
# Explicitly finish the run since a context manager is not used.
|
3053
|
+
run.finish()
|
3054
|
+
```
|
3055
|
+
|
3039
3056
|
"""
|
3040
3057
|
if self._settings._offline:
|
3041
3058
|
raise TypeError("Cannot use artifact when in offline mode.")
|
@@ -3164,24 +3181,20 @@ class Run:
|
|
3164
3181
|
This is useful when distributed jobs need to all contribute to the same artifact.
|
3165
3182
|
|
3166
3183
|
Args:
|
3167
|
-
artifact_or_path:
|
3184
|
+
artifact_or_path: A path to the contents of this artifact,
|
3168
3185
|
can be in the following forms:
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
type: (str) The type of artifact to log, examples include `dataset`, `model`
|
3182
|
-
aliases: (list, optional) Aliases to apply to this artifact,
|
3183
|
-
defaults to `["latest"]`
|
3184
|
-
distributed_id: (string, optional) Unique string that all distributed jobs share. If None,
|
3186
|
+
- `/local/directory`
|
3187
|
+
- `/local/directory/file.txt`
|
3188
|
+
- `s3://bucket/path`
|
3189
|
+
name: An artifact name. May be prefixed with "entity/project". Defaults
|
3190
|
+
to the basename of the path prepended with the current run ID
|
3191
|
+
if not specified. Valid names can be in the following forms:
|
3192
|
+
- name:version
|
3193
|
+
- name:alias
|
3194
|
+
- digest
|
3195
|
+
type: The type of artifact to log. Common examples include `dataset`, `model`.
|
3196
|
+
aliases: Aliases to apply to this artifact, defaults to `["latest"]`.
|
3197
|
+
distributed_id: Unique string that all distributed jobs share. If None,
|
3185
3198
|
defaults to the run's group name.
|
3186
3199
|
|
3187
3200
|
Returns:
|
@@ -3218,24 +3231,24 @@ class Run:
|
|
3218
3231
|
Subsequent "upserts" with the same distributed ID will result in a new version.
|
3219
3232
|
|
3220
3233
|
Args:
|
3221
|
-
artifact_or_path:
|
3234
|
+
artifact_or_path: A path to the contents of this artifact,
|
3222
3235
|
can be in the following forms:
|
3223
3236
|
- `/local/directory`
|
3224
3237
|
- `/local/directory/file.txt`
|
3225
3238
|
- `s3://bucket/path`
|
3226
3239
|
You can also pass an Artifact object created by calling
|
3227
3240
|
`wandb.Artifact`.
|
3228
|
-
name:
|
3241
|
+
name: An artifact name. May be prefixed with entity/project.
|
3229
3242
|
Valid names can be in the following forms:
|
3230
3243
|
- name:version
|
3231
3244
|
- name:alias
|
3232
3245
|
- digest
|
3233
3246
|
This will default to the basename of the path prepended with the current
|
3234
3247
|
run id if not specified.
|
3235
|
-
type:
|
3236
|
-
aliases:
|
3248
|
+
type: The type of artifact to log, examples include `dataset`, `model`
|
3249
|
+
aliases: Aliases to apply to this artifact,
|
3237
3250
|
defaults to `["latest"]`
|
3238
|
-
distributed_id:
|
3251
|
+
distributed_id: Unique string that all distributed jobs share. If None,
|
3239
3252
|
defaults to the run's group name.
|
3240
3253
|
|
3241
3254
|
Returns:
|
@@ -3415,39 +3428,24 @@ class Run:
|
|
3415
3428
|
) -> None:
|
3416
3429
|
"""Logs a model artifact containing the contents inside the 'path' to a run and marks it as an output to this run.
|
3417
3430
|
|
3431
|
+
The name of model artifact can only contain alphanumeric characters,
|
3432
|
+
underscores, and hyphens.
|
3433
|
+
|
3418
3434
|
Args:
|
3419
3435
|
path: (str) A path to the contents of this model,
|
3420
3436
|
can be in the following forms:
|
3421
3437
|
- `/local/directory`
|
3422
3438
|
- `/local/directory/file.txt`
|
3423
3439
|
- `s3://bucket/path`
|
3424
|
-
name:
|
3425
|
-
|
3426
|
-
|
3427
|
-
|
3428
|
-
aliases:
|
3440
|
+
name: A name to assign to the model artifact that
|
3441
|
+
the file contents will be added to. This will default to the
|
3442
|
+
basename of the path prepended with the current run id if
|
3443
|
+
not specified.
|
3444
|
+
aliases: Aliases to apply to the created model artifact,
|
3429
3445
|
defaults to `["latest"]`
|
3430
3446
|
|
3431
|
-
Examples:
|
3432
|
-
```python
|
3433
|
-
run.log_model(
|
3434
|
-
path="/local/directory",
|
3435
|
-
name="my_model_artifact",
|
3436
|
-
aliases=["production"],
|
3437
|
-
)
|
3438
|
-
```
|
3439
|
-
|
3440
|
-
Invalid usage
|
3441
|
-
```python
|
3442
|
-
run.log_model(
|
3443
|
-
path="/local/directory",
|
3444
|
-
name="my_entity/my_project/my_model_artifact",
|
3445
|
-
aliases=["production"],
|
3446
|
-
)
|
3447
|
-
```
|
3448
|
-
|
3449
3447
|
Raises:
|
3450
|
-
ValueError:
|
3448
|
+
ValueError: If name has invalid special characters.
|
3451
3449
|
|
3452
3450
|
Returns:
|
3453
3451
|
None
|
@@ -3463,40 +3461,18 @@ class Run:
|
|
3463
3461
|
"""Download the files logged in a model artifact 'name'.
|
3464
3462
|
|
3465
3463
|
Args:
|
3466
|
-
name:
|
3467
|
-
model artifact.
|
3468
|
-
|
3469
|
-
|
3470
|
-
|
3471
|
-
- model_artifact_name:alias
|
3472
|
-
|
3473
|
-
Examples:
|
3474
|
-
```python
|
3475
|
-
run.use_model(
|
3476
|
-
name="my_model_artifact:latest",
|
3477
|
-
)
|
3478
|
-
|
3479
|
-
run.use_model(
|
3480
|
-
name="my_project/my_model_artifact:v0",
|
3481
|
-
)
|
3464
|
+
name: A model artifact name. 'name' must match the name of an existing logged
|
3465
|
+
model artifact. May be prefixed with `entity/project/`. Valid names
|
3466
|
+
can be in the following forms
|
3467
|
+
- model_artifact_name:version
|
3468
|
+
- model_artifact_name:alias
|
3482
3469
|
|
3483
|
-
|
3484
|
-
|
3485
|
-
)
|
3486
|
-
```
|
3487
|
-
|
3488
|
-
Invalid usage
|
3489
|
-
```python
|
3490
|
-
run.use_model(
|
3491
|
-
name="my_entity/my_project/my_model_artifact",
|
3492
|
-
)
|
3493
|
-
```
|
3470
|
+
Returns:
|
3471
|
+
path (str): Path to downloaded model artifact file(s).
|
3494
3472
|
|
3495
3473
|
Raises:
|
3496
|
-
AssertionError:
|
3497
|
-
|
3498
|
-
Returns:
|
3499
|
-
path: (str) path to downloaded model artifact file(s).
|
3474
|
+
AssertionError: If model artifact 'name' is of a type that does
|
3475
|
+
not contain the substring 'model'.
|
3500
3476
|
"""
|
3501
3477
|
if self._settings._offline:
|
3502
3478
|
# Downloading artifacts is not supported when offline.
|
@@ -3530,66 +3506,43 @@ class Run:
|
|
3530
3506
|
) -> Artifact | None:
|
3531
3507
|
"""Log a model artifact version and link it to a registered model in the model registry.
|
3532
3508
|
|
3533
|
-
|
3509
|
+
Linked model versions are visible in the UI for the specified registered model.
|
3534
3510
|
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3511
|
+
This method will:
|
3512
|
+
- Check if 'name' model artifact has been logged. If so, use the artifact version that matches the files
|
3513
|
+
located at 'path' or log a new version. Otherwise log files under 'path' as a new model artifact, 'name'
|
3514
|
+
of type 'model'.
|
3515
|
+
- Check if registered model with name 'registered_model_name' exists in the 'model-registry' project.
|
3516
|
+
If not, create a new registered model with name 'registered_model_name'.
|
3517
|
+
- Link version of model artifact 'name' to registered model, 'registered_model_name'.
|
3518
|
+
- Attach aliases from 'aliases' list to the newly linked model artifact version.
|
3543
3519
|
|
3544
3520
|
Args:
|
3545
|
-
path: (str) A path to the contents of this model,
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
registered_model_name:
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3560
|
-
|
3561
|
-
run.link_model(
|
3562
|
-
path="/local/directory",
|
3563
|
-
registered_model_name="my_reg_model",
|
3564
|
-
name="my_model_artifact",
|
3565
|
-
aliases=["production"],
|
3566
|
-
)
|
3567
|
-
```
|
3568
|
-
|
3569
|
-
Invalid usage
|
3570
|
-
```python
|
3571
|
-
run.link_model(
|
3572
|
-
path="/local/directory",
|
3573
|
-
registered_model_name="my_entity/my_project/my_reg_model",
|
3574
|
-
name="my_model_artifact",
|
3575
|
-
aliases=["production"],
|
3576
|
-
)
|
3577
|
-
|
3578
|
-
run.link_model(
|
3579
|
-
path="/local/directory",
|
3580
|
-
registered_model_name="my_reg_model",
|
3581
|
-
name="my_entity/my_project/my_model_artifact",
|
3582
|
-
aliases=["production"],
|
3583
|
-
)
|
3584
|
-
```
|
3521
|
+
path: (str) A path to the contents of this model, can be in the
|
3522
|
+
following forms:
|
3523
|
+
- `/local/directory`
|
3524
|
+
- `/local/directory/file.txt`
|
3525
|
+
- `s3://bucket/path`
|
3526
|
+
registered_model_name: The name of the registered model that the
|
3527
|
+
model is to be linked to. A registered model is a collection of
|
3528
|
+
model versions linked to the model registry, typically
|
3529
|
+
representing a team's specific ML Task. The entity that this
|
3530
|
+
registered model belongs to will be derived from the run.
|
3531
|
+
name: The name of the model artifact that files in 'path' will be
|
3532
|
+
logged to. This will default to the basename of the path
|
3533
|
+
prepended with the current run id if not specified.
|
3534
|
+
aliases: Aliases that will only be applied on this linked artifact
|
3535
|
+
inside the registered model. The alias "latest" will always be
|
3536
|
+
applied to the latest version of an artifact that is linked.
|
3585
3537
|
|
3586
3538
|
Raises:
|
3587
|
-
AssertionError:
|
3588
|
-
if model artifact 'name' is of a type that does not contain
|
3589
|
-
|
3539
|
+
AssertionError: If registered_model_name is a path or
|
3540
|
+
if model artifact 'name' is of a type that does not contain
|
3541
|
+
the substring 'model'.
|
3542
|
+
ValueError: If name has invalid special characters.
|
3590
3543
|
|
3591
3544
|
Returns:
|
3592
|
-
The linked artifact if linking was successful, otherwise None
|
3545
|
+
The linked artifact if linking was successful, otherwise `None`.
|
3593
3546
|
"""
|
3594
3547
|
name_parts = registered_model_name.split("/")
|
3595
3548
|
if len(name_parts) != 1:
|
@@ -3632,13 +3585,13 @@ class Run:
|
|
3632
3585
|
level: str | AlertLevel | None = None,
|
3633
3586
|
wait_duration: int | float | timedelta | None = None,
|
3634
3587
|
) -> None:
|
3635
|
-
"""
|
3588
|
+
"""Create an alert with the given title and text.
|
3636
3589
|
|
3637
3590
|
Args:
|
3638
|
-
title:
|
3639
|
-
text:
|
3640
|
-
level:
|
3641
|
-
wait_duration:
|
3591
|
+
title: The title of the alert, must be less than 64 characters long.
|
3592
|
+
text: The text body of the alert.
|
3593
|
+
level: The alert level to use, either: `INFO`, `WARN`, or `ERROR`.
|
3594
|
+
wait_duration: The time to wait (in seconds) before sending another
|
3642
3595
|
alert with this title.
|
3643
3596
|
"""
|
3644
3597
|
level = level or AlertLevel.INFO
|
@@ -3734,60 +3687,6 @@ class Run:
|
|
3734
3687
|
logger.exception("Error getting system metrics.")
|
3735
3688
|
return {}
|
3736
3689
|
|
3737
|
-
@property
|
3738
|
-
@_log_to_run
|
3739
|
-
@_attach
|
3740
|
-
@_raise_if_finished
|
3741
|
-
def _metadata(self) -> Metadata | None:
|
3742
|
-
"""The metadata associated with this run.
|
3743
|
-
|
3744
|
-
NOTE: Automatically collected metadata can be overridden by the user.
|
3745
|
-
"""
|
3746
|
-
if not self._backend or not self._backend.interface:
|
3747
|
-
return self.__metadata
|
3748
|
-
|
3749
|
-
# Initialize the metadata object if it doesn't exist.
|
3750
|
-
if self.__metadata is None:
|
3751
|
-
self.__metadata = Metadata()
|
3752
|
-
self.__metadata._set_callback(self._metadata_callback)
|
3753
|
-
|
3754
|
-
handle = self._backend.interface.deliver_get_system_metadata()
|
3755
|
-
|
3756
|
-
try:
|
3757
|
-
result = handle.wait_or(timeout=1)
|
3758
|
-
except TimeoutError:
|
3759
|
-
logger.exception("Timeout getting run metadata.")
|
3760
|
-
return None
|
3761
|
-
|
3762
|
-
response = result.response.get_system_metadata_response
|
3763
|
-
|
3764
|
-
# Temporarily disable the callback to prevent triggering
|
3765
|
-
# an update call to wandb-core with the callback.
|
3766
|
-
with self.__metadata.disable_callback():
|
3767
|
-
# Values stored in the metadata object take precedence.
|
3768
|
-
self.__metadata.update_from_proto(response.metadata, skip_existing=True)
|
3769
|
-
|
3770
|
-
return self.__metadata
|
3771
|
-
|
3772
|
-
@_log_to_run
|
3773
|
-
@_raise_if_finished
|
3774
|
-
@_attach
|
3775
|
-
def _metadata_callback(
|
3776
|
-
self,
|
3777
|
-
metadata: MetadataRequest,
|
3778
|
-
) -> None:
|
3779
|
-
"""Callback to publish Metadata to wandb-core upon user updates."""
|
3780
|
-
# ignore updates if the attached to another run
|
3781
|
-
if self._is_attached:
|
3782
|
-
wandb.termwarn(
|
3783
|
-
"Metadata updates are ignored when attached to another run.",
|
3784
|
-
repeat=False,
|
3785
|
-
)
|
3786
|
-
return
|
3787
|
-
|
3788
|
-
if self._backend and self._backend.interface:
|
3789
|
-
self._backend.interface.publish_metadata(metadata)
|
3790
|
-
|
3791
3690
|
# ------------------------------------------------------------------------------
|
3792
3691
|
# HEADER
|
3793
3692
|
# ------------------------------------------------------------------------------
|
@@ -3804,24 +3703,27 @@ class Run:
|
|
3804
3703
|
self._printer.display(f"Tracking run with wandb version {wandb.__version__}")
|
3805
3704
|
|
3806
3705
|
def _header_sync_info(self) -> None:
|
3706
|
+
sync_location_msg = f"Run data is saved locally in {self._printer.files(self._settings.sync_dir)}"
|
3707
|
+
|
3807
3708
|
if self._settings._offline:
|
3808
|
-
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
" to enable cloud syncing.",
|
3814
|
-
]
|
3709
|
+
offline_warning = (
|
3710
|
+
f"W&B syncing is set to {self._printer.code('`offline`')} "
|
3711
|
+
f"in this directory. Run {self._printer.code('`wandb online`')} "
|
3712
|
+
f"or set {self._printer.code('WANDB_MODE=online')} "
|
3713
|
+
"to enable cloud syncing."
|
3815
3714
|
)
|
3715
|
+
self._printer.display([offline_warning, sync_location_msg])
|
3816
3716
|
else:
|
3817
|
-
|
3818
|
-
|
3717
|
+
messages = [sync_location_msg]
|
3718
|
+
|
3819
3719
|
if not self._printer.supports_html:
|
3820
|
-
|
3720
|
+
disable_sync_msg = (
|
3821
3721
|
f"Run {self._printer.code('`wandb offline`')} to turn off syncing."
|
3822
3722
|
)
|
3723
|
+
messages.append(disable_sync_msg)
|
3724
|
+
|
3823
3725
|
if not self._settings.quiet and not self._settings.silent:
|
3824
|
-
self._printer.display(
|
3726
|
+
self._printer.display(messages)
|
3825
3727
|
|
3826
3728
|
def _header_run_info(self) -> None:
|
3827
3729
|
settings, printer = self._settings, self._printer
|
@@ -4075,19 +3977,19 @@ def restore(
|
|
4075
3977
|
By default, will only download the file if it doesn't already exist.
|
4076
3978
|
|
4077
3979
|
Args:
|
4078
|
-
name:
|
4079
|
-
run_path:
|
3980
|
+
name: The name of the file.
|
3981
|
+
run_path: Optional path to a run to pull files from, i.e. `username/project_name/run_id`
|
4080
3982
|
if wandb.init has not been called, this is required.
|
4081
|
-
replace:
|
4082
|
-
root:
|
3983
|
+
replace: Whether to download the file even if it already exists locally
|
3984
|
+
root: The directory to download the file to. Defaults to the current
|
4083
3985
|
directory or the run directory if wandb.init was called.
|
4084
3986
|
|
4085
3987
|
Returns:
|
4086
|
-
None if it can't find the file, otherwise a file object open for reading
|
3988
|
+
None if it can't find the file, otherwise a file object open for reading.
|
4087
3989
|
|
4088
3990
|
Raises:
|
4089
|
-
|
4090
|
-
ValueError:
|
3991
|
+
CommError: If W&B can't connect to the W&B backend.
|
3992
|
+
ValueError: If the file is not found or can't find run_path.
|
4091
3993
|
"""
|
4092
3994
|
is_disabled = wandb.run is not None and wandb.run.disabled
|
4093
3995
|
run = None if is_disabled else wandb.run
|