wandb 0.19.12rc1__py3-none-win32.whl → 0.20.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 -2
- wandb/__init__.pyi +3 -6
- wandb/_iterutils.py +26 -7
- wandb/_pydantic/__init__.py +2 -1
- wandb/_pydantic/utils.py +7 -0
- wandb/agents/pyagent.py +9 -15
- wandb/analytics/sentry.py +1 -2
- wandb/apis/attrs.py +3 -4
- wandb/apis/importers/internals/util.py +1 -1
- wandb/apis/importers/validation.py +2 -2
- wandb/apis/importers/wandb.py +30 -25
- wandb/apis/normalize.py +2 -2
- wandb/apis/public/__init__.py +1 -0
- wandb/apis/public/api.py +37 -33
- wandb/apis/public/artifacts.py +103 -72
- wandb/apis/public/jobs.py +3 -2
- wandb/apis/public/registries/registries_search.py +4 -2
- wandb/apis/public/registries/registry.py +1 -1
- wandb/apis/public/registries/utils.py +9 -9
- wandb/apis/public/runs.py +18 -6
- wandb/automations/_filters/expressions.py +1 -1
- wandb/automations/_filters/operators.py +1 -1
- wandb/automations/_filters/run_metrics.py +1 -1
- wandb/beta/workflows.py +6 -5
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +54 -73
- wandb/docker/__init__.py +21 -74
- wandb/docker/names.py +40 -0
- wandb/env.py +0 -1
- wandb/errors/util.py +1 -1
- wandb/filesync/step_checksum.py +1 -1
- wandb/filesync/step_upload.py +1 -1
- wandb/integration/diffusers/resolvers/multimodal.py +1 -2
- wandb/integration/gym/__init__.py +5 -6
- wandb/integration/keras/callbacks/model_checkpoint.py +2 -2
- wandb/integration/keras/keras.py +13 -19
- wandb/integration/kfp/kfp_patch.py +2 -3
- wandb/integration/langchain/wandb_tracer.py +1 -1
- wandb/integration/metaflow/metaflow.py +13 -13
- wandb/integration/openai/fine_tuning.py +3 -2
- wandb/integration/sagemaker/auth.py +2 -1
- wandb/integration/sklearn/utils.py +2 -1
- wandb/integration/tensorboard/__init__.py +1 -1
- wandb/integration/tensorboard/log.py +2 -5
- wandb/integration/tensorflow/__init__.py +2 -2
- wandb/jupyter.py +20 -17
- wandb/plot/confusion_matrix.py +1 -1
- wandb/plot/utils.py +8 -7
- wandb/proto/v3/wandb_internal_pb2.py +355 -335
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +12 -12
- wandb/proto/v4/wandb_internal_pb2.py +339 -335
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +12 -12
- wandb/proto/v5/wandb_internal_pb2.py +339 -335
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +12 -12
- wandb/proto/v6/wandb_internal_pb2.py +339 -335
- wandb/proto/v6/wandb_settings_pb2.py +2 -2
- wandb/proto/v6/wandb_telemetry_pb2.py +12 -12
- wandb/proto/wandb_deprecated.py +6 -8
- wandb/sdk/artifacts/_internal_artifact.py +43 -0
- wandb/sdk/artifacts/_validators.py +55 -35
- wandb/sdk/artifacts/artifact.py +117 -115
- wandb/sdk/artifacts/artifact_download_logger.py +2 -0
- wandb/sdk/artifacts/artifact_saver.py +1 -3
- wandb/sdk/artifacts/artifact_state.py +2 -0
- wandb/sdk/artifacts/artifact_ttl.py +2 -0
- wandb/sdk/artifacts/exceptions.py +14 -0
- wandb/sdk/artifacts/staging.py +2 -0
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +2 -6
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +2 -6
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +1 -5
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
- wandb/sdk/artifacts/storage_layout.py +2 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +3 -3
- wandb/sdk/backend/backend.py +11 -182
- wandb/sdk/data_types/_dtypes.py +2 -6
- wandb/sdk/data_types/audio.py +20 -3
- wandb/sdk/data_types/base_types/media.py +12 -7
- wandb/sdk/data_types/base_types/wb_value.py +8 -18
- wandb/sdk/data_types/bokeh.py +19 -2
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +17 -1
- wandb/sdk/data_types/helper_types/image_mask.py +7 -1
- wandb/sdk/data_types/html.py +4 -4
- wandb/sdk/data_types/image.py +178 -103
- wandb/sdk/data_types/molecule.py +6 -6
- wandb/sdk/data_types/object_3d.py +10 -5
- wandb/sdk/data_types/saved_model.py +11 -6
- wandb/sdk/data_types/table.py +313 -83
- wandb/sdk/data_types/table_decorators.py +108 -0
- wandb/sdk/data_types/utils.py +43 -7
- wandb/sdk/data_types/video.py +21 -3
- wandb/sdk/interface/interface.py +10 -0
- wandb/sdk/internal/datastore.py +2 -6
- wandb/sdk/internal/file_pusher.py +1 -5
- wandb/sdk/internal/file_stream.py +8 -17
- wandb/sdk/internal/handler.py +2 -2
- wandb/sdk/internal/incremental_table_util.py +53 -0
- wandb/sdk/internal/internal.py +3 -5
- wandb/sdk/internal/internal_api.py +66 -89
- wandb/sdk/internal/job_builder.py +2 -7
- wandb/sdk/internal/profiler.py +2 -2
- wandb/sdk/internal/progress.py +1 -3
- wandb/sdk/internal/run.py +1 -6
- wandb/sdk/internal/sender.py +24 -36
- wandb/sdk/internal/system/assets/aggregators.py +1 -7
- wandb/sdk/internal/system/assets/disk.py +3 -3
- wandb/sdk/internal/system/assets/gpu.py +4 -4
- wandb/sdk/internal/system/assets/gpu_amd.py +4 -4
- wandb/sdk/internal/system/assets/interfaces.py +6 -6
- wandb/sdk/internal/system/assets/tpu.py +1 -1
- wandb/sdk/internal/system/assets/trainium.py +6 -6
- wandb/sdk/internal/system/system_info.py +5 -7
- wandb/sdk/internal/system/system_monitor.py +4 -4
- wandb/sdk/internal/tb_watcher.py +5 -7
- wandb/sdk/launch/_launch.py +1 -1
- wandb/sdk/launch/_project_spec.py +19 -20
- wandb/sdk/launch/agent/agent.py +3 -3
- wandb/sdk/launch/agent/config.py +1 -1
- wandb/sdk/launch/agent/job_status_tracker.py +2 -2
- wandb/sdk/launch/builder/build.py +2 -3
- wandb/sdk/launch/builder/kaniko_builder.py +5 -4
- wandb/sdk/launch/environment/gcp_environment.py +1 -2
- wandb/sdk/launch/registry/azure_container_registry.py +2 -2
- wandb/sdk/launch/registry/elastic_container_registry.py +2 -2
- wandb/sdk/launch/registry/google_artifact_registry.py +3 -3
- wandb/sdk/launch/runner/abstract.py +5 -5
- wandb/sdk/launch/runner/kubernetes_monitor.py +2 -2
- wandb/sdk/launch/runner/kubernetes_runner.py +1 -1
- wandb/sdk/launch/runner/sagemaker_runner.py +2 -4
- wandb/sdk/launch/runner/vertex_runner.py +2 -7
- wandb/sdk/launch/sweeps/__init__.py +1 -1
- wandb/sdk/launch/sweeps/scheduler.py +2 -2
- wandb/sdk/launch/sweeps/utils.py +3 -3
- wandb/sdk/launch/utils.py +3 -4
- wandb/sdk/lib/apikey.py +5 -8
- wandb/sdk/lib/config_util.py +3 -3
- wandb/sdk/lib/fsm.py +3 -18
- wandb/sdk/lib/gitlib.py +6 -5
- wandb/sdk/lib/ipython.py +2 -2
- wandb/sdk/lib/json_util.py +9 -14
- wandb/sdk/lib/printer.py +3 -8
- wandb/sdk/lib/redirect.py +1 -1
- wandb/sdk/lib/retry.py +3 -7
- wandb/sdk/lib/run_moment.py +2 -2
- wandb/sdk/lib/service_connection.py +3 -1
- wandb/sdk/lib/service_token.py +1 -2
- wandb/sdk/mailbox/mailbox_handle.py +3 -7
- wandb/sdk/mailbox/response_handle.py +2 -6
- wandb/sdk/service/streams.py +3 -7
- wandb/sdk/verify/verify.py +5 -6
- wandb/sdk/wandb_config.py +1 -1
- wandb/sdk/wandb_init.py +38 -106
- wandb/sdk/wandb_login.py +7 -6
- wandb/sdk/wandb_run.py +52 -240
- wandb/sdk/wandb_settings.py +71 -60
- wandb/sdk/wandb_setup.py +40 -14
- wandb/sdk/wandb_watch.py +5 -7
- wandb/sync/__init__.py +1 -1
- wandb/sync/sync.py +13 -13
- wandb/util.py +17 -35
- wandb/wandb_agent.py +8 -11
- {wandb-0.19.12rc1.dist-info → wandb-0.20.1.dist-info}/METADATA +5 -5
- {wandb-0.19.12rc1.dist-info → wandb-0.20.1.dist-info}/RECORD +170 -168
- wandb/docker/auth.py +0 -435
- wandb/docker/www_authenticate.py +0 -94
- {wandb-0.19.12rc1.dist-info → wandb-0.20.1.dist-info}/WHEEL +0 -0
- {wandb-0.19.12rc1.dist-info → wandb-0.20.1.dist-info}/entry_points.txt +0 -0
- {wandb-0.19.12rc1.dist-info → wandb-0.20.1.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_run.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import asyncio
|
4
|
-
import atexit
|
5
4
|
import functools
|
6
5
|
import glob
|
7
6
|
import json
|
@@ -19,23 +18,10 @@ from dataclasses import dataclass, field
|
|
19
18
|
from datetime import datetime, timedelta, timezone
|
20
19
|
from enum import IntEnum
|
21
20
|
from types import TracebackType
|
22
|
-
from typing import
|
23
|
-
TYPE_CHECKING,
|
24
|
-
Any,
|
25
|
-
Callable,
|
26
|
-
Literal,
|
27
|
-
NamedTuple,
|
28
|
-
Sequence,
|
29
|
-
TextIO,
|
30
|
-
TypeVar,
|
31
|
-
)
|
32
|
-
|
33
|
-
if sys.version_info < (3, 10):
|
34
|
-
from typing_extensions import Concatenate, ParamSpec
|
35
|
-
else:
|
36
|
-
from typing import Concatenate, ParamSpec
|
21
|
+
from typing import TYPE_CHECKING, Callable, Sequence, TextIO, TypeVar
|
37
22
|
|
38
23
|
import requests
|
24
|
+
from typing_extensions import Any, Concatenate, Literal, NamedTuple, ParamSpec
|
39
25
|
|
40
26
|
import wandb
|
41
27
|
import wandb.env
|
@@ -43,7 +29,7 @@ import wandb.util
|
|
43
29
|
from wandb import trigger
|
44
30
|
from wandb.apis import internal, public
|
45
31
|
from wandb.apis.public import Api as PublicApi
|
46
|
-
from wandb.errors import CommError,
|
32
|
+
from wandb.errors import CommError, UsageError
|
47
33
|
from wandb.errors.links import url_registry
|
48
34
|
from wandb.integration.torch import wandb_torch
|
49
35
|
from wandb.plot import CustomChart, Visualize
|
@@ -55,6 +41,7 @@ from wandb.proto.wandb_internal_pb2 import (
|
|
55
41
|
Result,
|
56
42
|
RunRecord,
|
57
43
|
)
|
44
|
+
from wandb.sdk.artifacts._internal_artifact import InternalArtifact
|
58
45
|
from wandb.sdk.artifacts.artifact import Artifact
|
59
46
|
from wandb.sdk.internal import job_builder
|
60
47
|
from wandb.sdk.lib import asyncio_compat, wb_logging
|
@@ -286,9 +273,7 @@ class RunStatusChecker:
|
|
286
273
|
wandb.termlog(f"{hr.http_response_text}")
|
287
274
|
else:
|
288
275
|
wandb.termlog(
|
289
|
-
"{} encountered ({}), retrying request"
|
290
|
-
hr.http_status_code, hr.http_response_text.rstrip()
|
291
|
-
)
|
276
|
+
f"{hr.http_status_code} encountered ({hr.http_response_text.rstrip()}), retrying request"
|
292
277
|
)
|
293
278
|
|
294
279
|
with wb_logging.log_to_run(self._run_id):
|
@@ -474,54 +459,6 @@ def _raise_if_finished(
|
|
474
459
|
return wrapper_fn
|
475
460
|
|
476
461
|
|
477
|
-
def _noop_if_forked_with_no_service(
|
478
|
-
func: Callable[Concatenate[Run, _P], None],
|
479
|
-
) -> Callable[Concatenate[Run, _P], None]:
|
480
|
-
"""Do nothing if called in a forked process and service is disabled.
|
481
|
-
|
482
|
-
Disabling the service is a very old and barely supported setting.
|
483
|
-
"""
|
484
|
-
|
485
|
-
@functools.wraps(func)
|
486
|
-
def wrapper(self: Run, *args, **kwargs) -> None:
|
487
|
-
# The _attach_id attribute is only None when running in the "disable
|
488
|
-
# service" mode.
|
489
|
-
#
|
490
|
-
# Since it is set early in `__init__` and included in the run's pickled
|
491
|
-
# state, the attribute always exists.
|
492
|
-
is_using_service = self._attach_id is not None
|
493
|
-
|
494
|
-
# This is the PID in which the Run object was constructed. The attribute
|
495
|
-
# always exists because it is set early in `__init__` and is included
|
496
|
-
# in the pickled state in `__getstate__` and `__setstate__`.
|
497
|
-
#
|
498
|
-
# It is not equal to the current PID if the process was forked or if
|
499
|
-
# the Run object was pickled and sent to another process.
|
500
|
-
init_pid = self._init_pid
|
501
|
-
|
502
|
-
if is_using_service or init_pid == os.getpid():
|
503
|
-
return func(self, *args, **kwargs)
|
504
|
-
|
505
|
-
message = (
|
506
|
-
f"`{func.__name__}` ignored (called from pid={os.getpid()},"
|
507
|
-
f" `init` called from pid={init_pid})."
|
508
|
-
f" See: {url_registry.url('multiprocess')}"
|
509
|
-
)
|
510
|
-
|
511
|
-
# This attribute may not exist because it is not included in the run's
|
512
|
-
# pickled state.
|
513
|
-
settings = getattr(self, "_settings", None)
|
514
|
-
if settings and settings.strict:
|
515
|
-
wandb.termerror(message, repeat=False)
|
516
|
-
raise UnsupportedError(
|
517
|
-
f"`{func.__name__}` does not support multiprocessing"
|
518
|
-
)
|
519
|
-
wandb.termwarn(message, repeat=False)
|
520
|
-
return None
|
521
|
-
|
522
|
-
return wrapper
|
523
|
-
|
524
|
-
|
525
462
|
@dataclass
|
526
463
|
class RunStatus:
|
527
464
|
sync_items_total: int = field(default=0)
|
@@ -634,6 +571,8 @@ class Run:
|
|
634
571
|
_launch_artifacts: dict[str, Any] | None
|
635
572
|
_printer: printer.Printer
|
636
573
|
|
574
|
+
summary: wandb_summary.Summary
|
575
|
+
|
637
576
|
def __init__(
|
638
577
|
self,
|
639
578
|
settings: Settings,
|
@@ -774,8 +713,7 @@ class Run:
|
|
774
713
|
self._attach_pid = os.getpid()
|
775
714
|
self._forked = False
|
776
715
|
# for now, use runid as attach id, this could/should be versioned in the future
|
777
|
-
|
778
|
-
self._attach_id = self._settings.run_id
|
716
|
+
self._attach_id = self._settings.run_id
|
779
717
|
|
780
718
|
def _handle_launch_artifact_overrides(self) -> None:
|
781
719
|
if self._settings.launch and (os.environ.get("WANDB_ARTIFACTS") is not None):
|
@@ -849,7 +787,7 @@ class Run:
|
|
849
787
|
def __getstate__(self) -> Any:
|
850
788
|
"""Return run state as a custom pickle."""
|
851
789
|
# We only pickle in service mode
|
852
|
-
if not self._settings
|
790
|
+
if not self._settings:
|
853
791
|
return
|
854
792
|
|
855
793
|
_attach_id = self._attach_id
|
@@ -1034,21 +972,6 @@ class Run:
|
|
1034
972
|
"""
|
1035
973
|
return self._step
|
1036
974
|
|
1037
|
-
@property
|
1038
|
-
@_log_to_run
|
1039
|
-
@_attach
|
1040
|
-
def mode(self) -> str:
|
1041
|
-
"""For compatibility with `0.9.x` and earlier, deprecate eventually."""
|
1042
|
-
deprecate.deprecate(
|
1043
|
-
field_name=Deprecated.run__mode,
|
1044
|
-
warning_message=(
|
1045
|
-
"The mode property of wandb.run is deprecated "
|
1046
|
-
"and will be removed in a future release."
|
1047
|
-
),
|
1048
|
-
run=self,
|
1049
|
-
)
|
1050
|
-
return "dryrun" if self._settings._offline else "run"
|
1051
|
-
|
1052
975
|
@property
|
1053
976
|
@_log_to_run
|
1054
977
|
@_attach
|
@@ -1201,7 +1124,7 @@ class Run:
|
|
1201
1124
|
f"{self._settings.project}-{self._settings.program_relpath}"
|
1202
1125
|
)
|
1203
1126
|
name = wandb.util.make_artifact_name_safe(f"source-{name_string}")
|
1204
|
-
art =
|
1127
|
+
art = InternalArtifact(name, "code")
|
1205
1128
|
files_added = False
|
1206
1129
|
if root is not None:
|
1207
1130
|
root = os.path.abspath(root)
|
@@ -1400,14 +1323,13 @@ class Run:
|
|
1400
1323
|
|
1401
1324
|
try:
|
1402
1325
|
from IPython import display
|
1403
|
-
|
1404
|
-
display.display(display.HTML(self.to_html(height, hidden)))
|
1405
|
-
return True
|
1406
|
-
|
1407
1326
|
except ImportError:
|
1408
1327
|
wandb.termwarn(".display() only works in jupyter environments")
|
1409
1328
|
return False
|
1410
1329
|
|
1330
|
+
display.display(display.HTML(self.to_html(height, hidden)))
|
1331
|
+
return True
|
1332
|
+
|
1411
1333
|
@_log_to_run
|
1412
1334
|
@_attach
|
1413
1335
|
def to_html(self, height: int = 420, hidden: bool = False) -> str:
|
@@ -1450,7 +1372,7 @@ class Run:
|
|
1450
1372
|
artifact = Artifact._from_id(val["id"], public_api.client)
|
1451
1373
|
|
1452
1374
|
assert artifact
|
1453
|
-
return self.use_artifact(artifact
|
1375
|
+
return self.use_artifact(artifact)
|
1454
1376
|
elif _is_artifact_string(val):
|
1455
1377
|
# this will never fail, but is required to make mypy happy
|
1456
1378
|
assert isinstance(val, str)
|
@@ -1469,9 +1391,9 @@ class Run:
|
|
1469
1391
|
# different instances of wandb.
|
1470
1392
|
|
1471
1393
|
assert artifact
|
1472
|
-
return self.use_artifact(artifact
|
1394
|
+
return self.use_artifact(artifact)
|
1473
1395
|
elif _is_artifact_object(val):
|
1474
|
-
return self.use_artifact(val
|
1396
|
+
return self.use_artifact(val)
|
1475
1397
|
else:
|
1476
1398
|
raise ValueError(
|
1477
1399
|
f"Cannot call _config_artifact_callback on type {type(val)}"
|
@@ -1775,10 +1697,10 @@ class Run:
|
|
1775
1697
|
commit: bool | None = None,
|
1776
1698
|
) -> None:
|
1777
1699
|
if not isinstance(data, Mapping):
|
1778
|
-
raise
|
1700
|
+
raise TypeError("wandb.log must be passed a dictionary")
|
1779
1701
|
|
1780
1702
|
if any(not isinstance(key, str) for key in data.keys()):
|
1781
|
-
raise
|
1703
|
+
raise TypeError("Key values passed to `wandb.log` must be strings.")
|
1782
1704
|
|
1783
1705
|
self._partial_history_callback(data, step, commit)
|
1784
1706
|
|
@@ -1807,7 +1729,6 @@ class Run:
|
|
1807
1729
|
self._step += 1
|
1808
1730
|
|
1809
1731
|
@_log_to_run
|
1810
|
-
@_noop_if_forked_with_no_service
|
1811
1732
|
@_raise_if_finished
|
1812
1733
|
@_attach
|
1813
1734
|
def log(
|
@@ -1815,7 +1736,6 @@ class Run:
|
|
1815
1736
|
data: dict[str, Any],
|
1816
1737
|
step: int | None = None,
|
1817
1738
|
commit: bool | None = None,
|
1818
|
-
sync: bool | None = None,
|
1819
1739
|
) -> None:
|
1820
1740
|
"""Upload run data.
|
1821
1741
|
|
@@ -1920,7 +1840,6 @@ class Run:
|
|
1920
1840
|
accumulate data for the step. See the notes in the description.
|
1921
1841
|
If `step` is `None`, then the default is `commit=True`;
|
1922
1842
|
otherwise, the default is `commit=False`.
|
1923
|
-
sync: This argument is deprecated and does nothing.
|
1924
1843
|
|
1925
1844
|
Examples:
|
1926
1845
|
For more and more detailed examples, see
|
@@ -2053,14 +1972,6 @@ class Run:
|
|
2053
1972
|
with telemetry.context(run=self) as tel:
|
2054
1973
|
tel.feature.set_step_log = True
|
2055
1974
|
|
2056
|
-
if sync is not None:
|
2057
|
-
deprecate.deprecate(
|
2058
|
-
field_name=Deprecated.run__log_sync,
|
2059
|
-
warning_message=(
|
2060
|
-
"`sync` argument is deprecated and does not affect the behaviour of `wandb.log`"
|
2061
|
-
),
|
2062
|
-
run=self,
|
2063
|
-
)
|
2064
1975
|
if self._settings._shared and step is not None:
|
2065
1976
|
wandb.termwarn(
|
2066
1977
|
"In shared mode, the use of `wandb.log` with the step argument is not supported "
|
@@ -2075,7 +1986,7 @@ class Run:
|
|
2075
1986
|
@_attach
|
2076
1987
|
def save(
|
2077
1988
|
self,
|
2078
|
-
glob_str: str | os.PathLike
|
1989
|
+
glob_str: str | os.PathLike,
|
2079
1990
|
base_path: str | os.PathLike | None = None,
|
2080
1991
|
policy: PolicyName = "live",
|
2081
1992
|
) -> bool | list[str]:
|
@@ -2126,18 +2037,6 @@ class Run:
|
|
2126
2037
|
|
2127
2038
|
For historical reasons, this may return a boolean in legacy code.
|
2128
2039
|
"""
|
2129
|
-
if glob_str is None:
|
2130
|
-
# noop for historical reasons, run.save() may be called in legacy code
|
2131
|
-
deprecate.deprecate(
|
2132
|
-
field_name=Deprecated.run__save_no_args,
|
2133
|
-
warning_message=(
|
2134
|
-
"Calling wandb.run.save without any arguments is deprecated."
|
2135
|
-
"Changes to attributes are automatically persisted."
|
2136
|
-
),
|
2137
|
-
run=self,
|
2138
|
-
)
|
2139
|
-
return True
|
2140
|
-
|
2141
2040
|
if isinstance(glob_str, bytes):
|
2142
2041
|
# Preserved for backward compatibility: allow bytes inputs.
|
2143
2042
|
glob_str = glob_str.decode("utf-8")
|
@@ -2274,7 +2173,6 @@ class Run:
|
|
2274
2173
|
)
|
2275
2174
|
|
2276
2175
|
@_log_to_run
|
2277
|
-
@_noop_if_forked_with_no_service
|
2278
2176
|
@_attach
|
2279
2177
|
def finish(
|
2280
2178
|
self,
|
@@ -2355,21 +2253,6 @@ class Run:
|
|
2355
2253
|
module.unset_globals()
|
2356
2254
|
wandb._sentry.end_session()
|
2357
2255
|
|
2358
|
-
@_log_to_run
|
2359
|
-
@_noop_if_forked_with_no_service
|
2360
|
-
@_attach
|
2361
|
-
def join(self, exit_code: int | None = None) -> None:
|
2362
|
-
"""Deprecated alias for `finish()` - use finish instead."""
|
2363
|
-
if hasattr(self, "_telemetry_obj"):
|
2364
|
-
deprecate.deprecate(
|
2365
|
-
field_name=Deprecated.run__join,
|
2366
|
-
warning_message=(
|
2367
|
-
"wandb.run.join() is deprecated, please use wandb.run.finish()."
|
2368
|
-
),
|
2369
|
-
run=self,
|
2370
|
-
)
|
2371
|
-
self._finish(exit_code=exit_code)
|
2372
|
-
|
2373
2256
|
@_log_to_run
|
2374
2257
|
@_raise_if_finished
|
2375
2258
|
@_attach
|
@@ -2414,10 +2297,7 @@ class Run:
|
|
2414
2297
|
console = self._settings.console
|
2415
2298
|
# only use raw for service to minimize potential changes
|
2416
2299
|
if console == "wrap":
|
2417
|
-
|
2418
|
-
console = "wrap_raw"
|
2419
|
-
else:
|
2420
|
-
console = "wrap_emu"
|
2300
|
+
console = "wrap_raw"
|
2421
2301
|
logger.info("redirect: %s", console)
|
2422
2302
|
|
2423
2303
|
out_redir: redirect.RedirectBase
|
@@ -2513,7 +2393,7 @@ class Run:
|
|
2513
2393
|
logger.info("Redirects installed.")
|
2514
2394
|
except Exception as e:
|
2515
2395
|
wandb.termwarn(f"Failed to redirect: {e}")
|
2516
|
-
logger.
|
2396
|
+
logger.exception("Failed to redirect.")
|
2517
2397
|
return
|
2518
2398
|
|
2519
2399
|
def _restore(self) -> None:
|
@@ -2554,9 +2434,9 @@ class Run:
|
|
2554
2434
|
wandb.termerror("Control-C detected -- Run data was not synced")
|
2555
2435
|
raise
|
2556
2436
|
|
2557
|
-
except Exception
|
2437
|
+
except Exception:
|
2558
2438
|
self._console_stop()
|
2559
|
-
logger.
|
2439
|
+
logger.exception("Problem finishing run")
|
2560
2440
|
wandb.termerror("Problem finishing run")
|
2561
2441
|
raise
|
2562
2442
|
|
@@ -2573,11 +2453,6 @@ class Run:
|
|
2573
2453
|
logger.info("atexit reg")
|
2574
2454
|
self._hooks = ExitHooks()
|
2575
2455
|
|
2576
|
-
if self.settings.x_disable_service:
|
2577
|
-
self._hooks.hook()
|
2578
|
-
# NB: manager will perform atexit hook like behavior for outstanding runs
|
2579
|
-
atexit.register(lambda: self._atexit_cleanup())
|
2580
|
-
|
2581
2456
|
self._redirect(self._stdout_slave_fd, self._stderr_slave_fd)
|
2582
2457
|
|
2583
2458
|
def _console_stop(self) -> None:
|
@@ -2659,8 +2534,8 @@ class Run:
|
|
2659
2534
|
|
2660
2535
|
try:
|
2661
2536
|
self._detect_and_apply_job_inputs()
|
2662
|
-
except Exception
|
2663
|
-
logger.
|
2537
|
+
except Exception:
|
2538
|
+
logger.exception("Problem applying launch job inputs")
|
2664
2539
|
|
2665
2540
|
# object is about to be returned to the user, don't let them modify it
|
2666
2541
|
self._freeze()
|
@@ -2691,7 +2566,7 @@ class Run:
|
|
2691
2566
|
installed_packages_list: list[str],
|
2692
2567
|
patch_path: os.PathLike | None = None,
|
2693
2568
|
) -> Artifact:
|
2694
|
-
job_artifact = job_builder.
|
2569
|
+
job_artifact = InternalArtifact(name, job_builder.JOB_ARTIFACT_TYPE)
|
2695
2570
|
if patch_path and os.path.exists(patch_path):
|
2696
2571
|
job_artifact.add_file(FilePathStr(str(patch_path)), "diff.patch")
|
2697
2572
|
with job_artifact.new_file("requirements.frozen.txt") as f:
|
@@ -3047,41 +2922,6 @@ class Run:
|
|
3047
2922
|
"""
|
3048
2923
|
wandb.sdk._unwatch(self, models=models)
|
3049
2924
|
|
3050
|
-
# TODO(kdg): remove all artifact swapping logic
|
3051
|
-
def _swap_artifact_name(self, artifact_name: str, use_as: str | None) -> str:
|
3052
|
-
artifact_key_string = use_as or artifact_name
|
3053
|
-
replacement_artifact_info = self._launch_artifact_mapping.get(
|
3054
|
-
artifact_key_string
|
3055
|
-
)
|
3056
|
-
if replacement_artifact_info is not None:
|
3057
|
-
new_name = replacement_artifact_info.get("name")
|
3058
|
-
entity = replacement_artifact_info.get("entity")
|
3059
|
-
project = replacement_artifact_info.get("project")
|
3060
|
-
if new_name is None or entity is None or project is None:
|
3061
|
-
raise ValueError(
|
3062
|
-
"Misconfigured artifact in launch config. Must include name, project and entity keys."
|
3063
|
-
)
|
3064
|
-
return f"{entity}/{project}/{new_name}"
|
3065
|
-
elif replacement_artifact_info is None and use_as is None:
|
3066
|
-
sequence_name = artifact_name.split(":")[0].split("/")[-1]
|
3067
|
-
unique_artifact_replacement_info = (
|
3068
|
-
self._unique_launch_artifact_sequence_names.get(sequence_name)
|
3069
|
-
)
|
3070
|
-
if unique_artifact_replacement_info is not None:
|
3071
|
-
new_name = unique_artifact_replacement_info.get("name")
|
3072
|
-
entity = unique_artifact_replacement_info.get("entity")
|
3073
|
-
project = unique_artifact_replacement_info.get("project")
|
3074
|
-
if new_name is None or entity is None or project is None:
|
3075
|
-
raise ValueError(
|
3076
|
-
"Misconfigured artifact in launch config. Must include name, project and entity keys."
|
3077
|
-
)
|
3078
|
-
return f"{entity}/{project}/{new_name}"
|
3079
|
-
|
3080
|
-
else:
|
3081
|
-
return artifact_name
|
3082
|
-
|
3083
|
-
return artifact_name
|
3084
|
-
|
3085
2925
|
def _detach(self) -> None:
|
3086
2926
|
pass
|
3087
2927
|
|
@@ -3151,6 +2991,7 @@ class Run:
|
|
3151
2991
|
response = result.response.link_artifact_response
|
3152
2992
|
if response.error_message:
|
3153
2993
|
wandb.termerror(response.error_message)
|
2994
|
+
return None
|
3154
2995
|
if response.version_index is None:
|
3155
2996
|
wandb.termerror(
|
3156
2997
|
"Error fetching the linked artifact's version index after linking"
|
@@ -3194,8 +3035,7 @@ class Run:
|
|
3194
3035
|
You can also pass an Artifact object created by calling `wandb.Artifact`
|
3195
3036
|
type: (str, optional) The type of artifact to use.
|
3196
3037
|
aliases: (list, optional) Aliases to apply to this artifact
|
3197
|
-
use_as:
|
3198
|
-
Will be shown in UI.
|
3038
|
+
use_as: This argument is deprecated and does nothing.
|
3199
3039
|
|
3200
3040
|
Returns:
|
3201
3041
|
An `Artifact` object.
|
@@ -3211,40 +3051,28 @@ class Run:
|
|
3211
3051
|
)
|
3212
3052
|
api.set_current_run_id(self._settings.run_id)
|
3213
3053
|
|
3054
|
+
if use_as is not None:
|
3055
|
+
deprecate.deprecate(
|
3056
|
+
field_name=Deprecated.run__use_artifact_use_as,
|
3057
|
+
warning_message=(
|
3058
|
+
"`use_as` argument is deprecated and does not affect the behaviour of `run.use_artifact`"
|
3059
|
+
),
|
3060
|
+
)
|
3061
|
+
|
3214
3062
|
if isinstance(artifact_or_name, str):
|
3215
|
-
|
3216
|
-
name = self._swap_artifact_name(artifact_or_name, use_as)
|
3217
|
-
else:
|
3218
|
-
name = artifact_or_name
|
3063
|
+
name = artifact_or_name
|
3219
3064
|
public_api = self._public_api()
|
3220
3065
|
artifact = public_api._artifact(type=type, name=name)
|
3221
3066
|
if type is not None and type != artifact.type:
|
3222
3067
|
raise ValueError(
|
3223
|
-
"Supplied type {} does not match type {} of artifact {}"
|
3224
|
-
type, artifact.type, artifact.name
|
3225
|
-
)
|
3068
|
+
f"Supplied type {type} does not match type {artifact.type} of artifact {artifact.name}"
|
3226
3069
|
)
|
3227
|
-
artifact._use_as = use_as or artifact_or_name
|
3228
|
-
if use_as:
|
3229
|
-
if (
|
3230
|
-
use_as in self._used_artifact_slots.keys()
|
3231
|
-
and self._used_artifact_slots[use_as] != artifact.id
|
3232
|
-
):
|
3233
|
-
raise ValueError(
|
3234
|
-
"Cannot call use_artifact with the same use_as argument more than once"
|
3235
|
-
)
|
3236
|
-
elif ":" in use_as or "/" in use_as:
|
3237
|
-
raise ValueError(
|
3238
|
-
"use_as cannot contain special characters ':' or '/'"
|
3239
|
-
)
|
3240
|
-
self._used_artifact_slots[use_as] = artifact.id
|
3241
3070
|
api.use_artifact(
|
3242
3071
|
artifact.id,
|
3243
3072
|
entity_name=self._settings.entity,
|
3244
3073
|
project_name=self._settings.project,
|
3245
3074
|
artifact_entity_name=artifact.entity,
|
3246
3075
|
artifact_project_name=artifact.project,
|
3247
|
-
use_as=use_as or artifact_or_name,
|
3248
3076
|
)
|
3249
3077
|
else:
|
3250
3078
|
artifact = artifact_or_name
|
@@ -3264,20 +3092,9 @@ class Run:
|
|
3264
3092
|
use_after_commit=True,
|
3265
3093
|
)
|
3266
3094
|
artifact.wait()
|
3267
|
-
artifact._use_as = use_as or artifact.name
|
3268
3095
|
elif isinstance(artifact, Artifact) and not artifact.is_draft():
|
3269
|
-
if (
|
3270
|
-
self._launch_artifact_mapping
|
3271
|
-
and artifact.name in self._launch_artifact_mapping.keys()
|
3272
|
-
):
|
3273
|
-
wandb.termwarn(
|
3274
|
-
"Swapping artifacts is not supported when using a non-draft artifact. "
|
3275
|
-
f"Using {artifact.name}."
|
3276
|
-
)
|
3277
|
-
artifact._use_as = use_as or artifact.name
|
3278
3096
|
api.use_artifact(
|
3279
3097
|
artifact.id,
|
3280
|
-
use_as=use_as or artifact._use_as or artifact.name,
|
3281
3098
|
artifact_entity_name=artifact.entity,
|
3282
3099
|
artifact_project_name=artifact.project,
|
3283
3100
|
)
|
@@ -3567,7 +3384,7 @@ class Run:
|
|
3567
3384
|
name
|
3568
3385
|
or f"run-{self._settings.run_id}-{os.path.basename(artifact_or_path)}"
|
3569
3386
|
)
|
3570
|
-
artifact =
|
3387
|
+
artifact = Artifact(name, type or "unspecified")
|
3571
3388
|
if os.path.isfile(artifact_or_path):
|
3572
3389
|
artifact.add_file(str(artifact_or_path))
|
3573
3390
|
elif os.path.isdir(artifact_or_path):
|
@@ -3581,8 +3398,8 @@ class Run:
|
|
3581
3398
|
)
|
3582
3399
|
else:
|
3583
3400
|
artifact = artifact_or_path
|
3584
|
-
if not isinstance(artifact,
|
3585
|
-
raise
|
3401
|
+
if not isinstance(artifact, Artifact):
|
3402
|
+
raise TypeError(
|
3586
3403
|
"You must pass an instance of wandb.Artifact or a "
|
3587
3404
|
"valid file path to log_artifact"
|
3588
3405
|
)
|
@@ -3836,7 +3653,7 @@ class Run:
|
|
3836
3653
|
if isinstance(wait_duration, int) or isinstance(wait_duration, float):
|
3837
3654
|
wait_duration = timedelta(seconds=wait_duration)
|
3838
3655
|
elif not callable(getattr(wait_duration, "total_seconds", None)):
|
3839
|
-
raise
|
3656
|
+
raise TypeError(
|
3840
3657
|
"wait_duration must be an int, float, or datetime.timedelta"
|
3841
3658
|
)
|
3842
3659
|
wait_duration = int(wait_duration.total_seconds() * 1000)
|
@@ -3916,8 +3733,8 @@ class Run:
|
|
3916
3733
|
try:
|
3917
3734
|
response = result.response.get_system_metrics_response
|
3918
3735
|
return pb_to_dict(response) if response else {}
|
3919
|
-
except Exception
|
3920
|
-
logger.
|
3736
|
+
except Exception:
|
3737
|
+
logger.exception("Error getting system metrics.")
|
3921
3738
|
return {}
|
3922
3739
|
|
3923
3740
|
@property
|
@@ -3942,23 +3759,18 @@ class Run:
|
|
3942
3759
|
try:
|
3943
3760
|
result = handle.wait_or(timeout=1)
|
3944
3761
|
except TimeoutError:
|
3945
|
-
logger.
|
3762
|
+
logger.exception("Timeout getting run metadata.")
|
3946
3763
|
return None
|
3947
3764
|
|
3948
|
-
|
3949
|
-
response = result.response.get_system_metadata_response
|
3950
|
-
|
3951
|
-
# Temporarily disable the callback to prevent triggering
|
3952
|
-
# an update call to wandb-core with the callback.
|
3953
|
-
with self.__metadata.disable_callback():
|
3954
|
-
# Values stored in the metadata object take precedence.
|
3955
|
-
self.__metadata.update_from_proto(response.metadata, skip_existing=True)
|
3765
|
+
response = result.response.get_system_metadata_response
|
3956
3766
|
|
3957
|
-
|
3958
|
-
|
3959
|
-
|
3767
|
+
# Temporarily disable the callback to prevent triggering
|
3768
|
+
# an update call to wandb-core with the callback.
|
3769
|
+
with self.__metadata.disable_callback():
|
3770
|
+
# Values stored in the metadata object take precedence.
|
3771
|
+
self.__metadata.update_from_proto(response.metadata, skip_existing=True)
|
3960
3772
|
|
3961
|
-
return
|
3773
|
+
return self.__metadata
|
3962
3774
|
|
3963
3775
|
@_log_to_run
|
3964
3776
|
@_raise_if_finished
|