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/lib/gitlib.py
CHANGED
@@ -51,12 +51,12 @@ class GitRepo:
|
|
51
51
|
return Repo(self._root or os.getcwd(), search_parent_directories=True)
|
52
52
|
except FileNotFoundError:
|
53
53
|
wandb.termwarn("current working directory has been invalidated")
|
54
|
-
logger.
|
54
|
+
logger.warning("current working directory has been invalidated")
|
55
55
|
except InvalidGitRepositoryError:
|
56
56
|
logger.debug("git repository is invalid")
|
57
57
|
except NoSuchPathError:
|
58
58
|
wandb.termwarn(f"git root {self._root} does not exist")
|
59
|
-
logger.
|
59
|
+
logger.warning(f"git root {self._root} does not exist")
|
60
60
|
return None
|
61
61
|
|
62
62
|
@property
|
@@ -87,9 +87,9 @@ class GitRepo:
|
|
87
87
|
return None
|
88
88
|
try:
|
89
89
|
return self.repo.git.rev_parse("--show-toplevel")
|
90
|
-
except GitCommandError
|
90
|
+
except GitCommandError:
|
91
91
|
# todo: collect telemetry on this
|
92
|
-
logger.
|
92
|
+
logger.exception("git root error")
|
93
93
|
return None
|
94
94
|
|
95
95
|
@property
|
@@ -214,12 +214,13 @@ class GitRepo:
|
|
214
214
|
most_recent_ancestor = ancestor
|
215
215
|
elif self.repo.is_ancestor(most_recent_ancestor, ancestor): # type: ignore
|
216
216
|
most_recent_ancestor = ancestor
|
217
|
-
return most_recent_ancestor
|
218
217
|
except GitCommandError as e:
|
219
218
|
logger.debug("git remote upstream fork point could not be found")
|
220
219
|
logger.debug(str(e))
|
221
220
|
return None
|
222
221
|
|
222
|
+
return most_recent_ancestor
|
223
|
+
|
223
224
|
def tag(self, name: str, message: Optional[str]) -> Any:
|
224
225
|
if not self.repo:
|
225
226
|
return None
|
wandb/sdk/lib/ipython.py
CHANGED
@@ -95,9 +95,9 @@ class ProgressWidget:
|
|
95
95
|
if not self._displayed:
|
96
96
|
self._displayed = True
|
97
97
|
self._ipython_display.display(self._widget)
|
98
|
-
except Exception
|
98
|
+
except Exception:
|
99
|
+
logger.exception("Error in ProgressWidget.update()")
|
99
100
|
self._disabled = True
|
100
|
-
logger.exception(e)
|
101
101
|
wandb.termwarn(
|
102
102
|
"Unable to render progress bar, see the user log for details"
|
103
103
|
)
|
wandb/sdk/lib/json_util.py
CHANGED
@@ -25,8 +25,8 @@ try:
|
|
25
25
|
encoded = orjson.dumps(
|
26
26
|
obj, option=orjson.OPT_NON_STR_KEYS, **_kwargs
|
27
27
|
).decode()
|
28
|
-
except Exception
|
29
|
-
logger.exception(
|
28
|
+
except Exception:
|
29
|
+
logger.exception("Error using orjson.dumps")
|
30
30
|
if cls:
|
31
31
|
kwargs["cls"] = cls
|
32
32
|
encoded = json.dumps(obj, **kwargs)
|
@@ -42,8 +42,8 @@ try:
|
|
42
42
|
_kwargs["default"] = cls.default
|
43
43
|
encoded = orjson.dumps(obj, option=orjson.OPT_NON_STR_KEYS, **_kwargs)
|
44
44
|
fp.write(encoded)
|
45
|
-
except Exception
|
46
|
-
logger.exception(
|
45
|
+
except Exception:
|
46
|
+
logger.exception("Error using orjson.dump")
|
47
47
|
if cls:
|
48
48
|
kwargs["cls"] = cls
|
49
49
|
json.dump(obj, fp, **kwargs)
|
@@ -52,8 +52,8 @@ try:
|
|
52
52
|
"""Wrapper for orjson.loads."""
|
53
53
|
try:
|
54
54
|
decoded = orjson.loads(obj)
|
55
|
-
except Exception
|
56
|
-
logger.exception(
|
55
|
+
except Exception:
|
56
|
+
logger.exception("Error using orjson.loads")
|
57
57
|
decoded = json.loads(obj)
|
58
58
|
|
59
59
|
return decoded
|
@@ -62,19 +62,14 @@ try:
|
|
62
62
|
"""Wrapper for orjson.load."""
|
63
63
|
try:
|
64
64
|
decoded = orjson.loads(fp.read())
|
65
|
-
except Exception
|
66
|
-
logger.exception(
|
65
|
+
except Exception:
|
66
|
+
logger.exception("Error using orjson.load")
|
67
67
|
decoded = json.load(fp)
|
68
68
|
|
69
69
|
return decoded
|
70
70
|
|
71
71
|
else:
|
72
|
-
from json import
|
73
|
-
dump,
|
74
|
-
dumps,
|
75
|
-
load,
|
76
|
-
loads,
|
77
|
-
)
|
72
|
+
from json import dump, dumps, load, loads # type: ignore[assignment]
|
78
73
|
|
79
74
|
except ImportError:
|
80
75
|
from json import dump, dumps, load, loads # type: ignore[assignment] # noqa: F401
|
wandb/sdk/lib/printer.py
CHANGED
@@ -9,16 +9,11 @@ import platform
|
|
9
9
|
import sys
|
10
10
|
from typing import Callable, Iterator
|
11
11
|
|
12
|
-
import wandb.util
|
13
|
-
|
14
|
-
if sys.version_info >= (3, 12):
|
15
|
-
from typing import override
|
16
|
-
else:
|
17
|
-
from typing_extensions import override
|
18
|
-
|
19
12
|
import click
|
13
|
+
from typing_extensions import override
|
20
14
|
|
21
15
|
import wandb
|
16
|
+
import wandb.util
|
22
17
|
from wandb.errors import term
|
23
18
|
from wandb.sdk import wandb_setup
|
24
19
|
|
@@ -107,7 +102,7 @@ def new_printer(settings: wandb.Settings | None = None) -> Printer:
|
|
107
102
|
has been called, then global settings are used. Otherwise,
|
108
103
|
settings (such as silent mode) are ignored.
|
109
104
|
"""
|
110
|
-
if not settings and (singleton := wandb_setup.
|
105
|
+
if not settings and (singleton := wandb_setup.singleton_if_setup()):
|
111
106
|
settings = singleton.settings
|
112
107
|
|
113
108
|
if ipython.in_jupyter():
|
wandb/sdk/lib/redirect.py
CHANGED
wandb/sdk/lib/retry.py
CHANGED
@@ -94,7 +94,7 @@ class Retry(Generic[_R]):
|
|
94
94
|
"""The number of iterations the previous __call__ retried."""
|
95
95
|
return self._num_iter
|
96
96
|
|
97
|
-
def __call__(self, *args: Any, **kwargs: Any) -> _R:
|
97
|
+
def __call__(self, *args: Any, **kwargs: Any) -> _R:
|
98
98
|
"""Call the wrapped function, with retries.
|
99
99
|
|
100
100
|
Args:
|
@@ -140,9 +140,7 @@ class Retry(Generic[_R]):
|
|
140
140
|
if self.retry_callback:
|
141
141
|
self.retry_callback(
|
142
142
|
200,
|
143
|
-
"{} resolved after {}, resuming normal operation."
|
144
|
-
self._error_prefix, NOW_FN() - start_time
|
145
|
-
),
|
143
|
+
f"{self._error_prefix} resolved after {NOW_FN() - start_time}, resuming normal operation.",
|
146
144
|
)
|
147
145
|
return result
|
148
146
|
except self._retryable_exceptions as e:
|
@@ -184,9 +182,7 @@ class Retry(Generic[_R]):
|
|
184
182
|
# but some of these can be raised before the retry handler thread (RunStatusChecker) is
|
185
183
|
# spawned in wandb_init
|
186
184
|
wandb.termlog(
|
187
|
-
"{} ({}), entering retry loop."
|
188
|
-
self._error_prefix, e.__class__.__name__
|
189
|
-
)
|
185
|
+
f"{self._error_prefix} ({e.__class__.__name__}), entering retry loop."
|
190
186
|
)
|
191
187
|
# if wandb.env.is_debug():
|
192
188
|
# traceback.print_exc()
|
wandb/sdk/lib/run_moment.py
CHANGED
@@ -33,11 +33,11 @@ class RunMoment:
|
|
33
33
|
f"Only the metric '_step' is supported, got '{self.metric}'."
|
34
34
|
)
|
35
35
|
if not isinstance(self.value, (int, float)):
|
36
|
-
raise
|
36
|
+
raise TypeError(
|
37
37
|
f"Only int or float values are supported, got '{self.value}'."
|
38
38
|
)
|
39
39
|
if not isinstance(self.run, str):
|
40
|
-
raise
|
40
|
+
raise TypeError(f"Only string run names are supported, got '{self.run}'.")
|
41
41
|
|
42
42
|
@classmethod
|
43
43
|
def from_uri(cls, uri: str) -> RunMoment:
|
@@ -167,7 +167,6 @@ class ServiceConnection:
|
|
167
167
|
handle = self._mailbox.require_response(request)
|
168
168
|
self._client.send_server_request(request)
|
169
169
|
response = handle.wait_or(timeout=10)
|
170
|
-
return response.inform_attach_response.settings
|
171
170
|
|
172
171
|
except (MailboxClosedError, HandleAbandonedError, SockClientClosedError):
|
173
172
|
raise WandbAttachFailedError(
|
@@ -181,6 +180,9 @@ class ServiceConnection:
|
|
181
180
|
" process is busy (unlikely)."
|
182
181
|
) from None
|
183
182
|
|
183
|
+
else:
|
184
|
+
return response.inform_attach_response.settings
|
185
|
+
|
184
186
|
def inform_start(
|
185
187
|
self,
|
186
188
|
settings: wandb_settings_pb2.Settings,
|
wandb/sdk/lib/service_token.py
CHANGED
@@ -31,8 +31,7 @@ def get_service_token() -> ServiceToken | None:
|
|
31
31
|
|
32
32
|
if version != _CURRENT_VERSION:
|
33
33
|
raise ValueError(
|
34
|
-
f"Expected version {_CURRENT_VERSION},"
|
35
|
-
f" but got {version} (token={token})"
|
34
|
+
f"Expected version {_CURRENT_VERSION}, but got {version} (token={token})"
|
36
35
|
)
|
37
36
|
if transport not in _SUPPORTED_TRANSPORTS:
|
38
37
|
raise ValueError(
|
@@ -1,18 +1,14 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import abc
|
4
|
-
import
|
5
|
-
|
4
|
+
from typing import TYPE_CHECKING, Callable, Generic
|
5
|
+
|
6
|
+
from typing_extensions import TypeVar, override
|
6
7
|
|
7
8
|
# Necessary to break an import loop.
|
8
9
|
if TYPE_CHECKING:
|
9
10
|
from wandb.sdk.interface import interface
|
10
11
|
|
11
|
-
if sys.version_info >= (3, 12):
|
12
|
-
from typing import override
|
13
|
-
else:
|
14
|
-
from typing_extensions import override
|
15
|
-
|
16
12
|
|
17
13
|
_T = TypeVar("_T")
|
18
14
|
_S = TypeVar("_S")
|
@@ -2,10 +2,11 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import asyncio
|
4
4
|
import math
|
5
|
-
import sys
|
6
5
|
import threading
|
7
6
|
from typing import TYPE_CHECKING
|
8
7
|
|
8
|
+
from typing_extensions import override
|
9
|
+
|
9
10
|
from wandb.proto import wandb_server_pb2 as spb
|
10
11
|
|
11
12
|
from .mailbox_handle import HandleAbandonedError, MailboxHandle
|
@@ -14,11 +15,6 @@ from .mailbox_handle import HandleAbandonedError, MailboxHandle
|
|
14
15
|
if TYPE_CHECKING:
|
15
16
|
from wandb.sdk.interface import interface
|
16
17
|
|
17
|
-
if sys.version_info >= (3, 12):
|
18
|
-
from typing import override
|
19
|
-
else:
|
20
|
-
from typing_extensions import override
|
21
|
-
|
22
18
|
|
23
19
|
class MailboxResponseHandle(MailboxHandle[spb.ServerResponse]):
|
24
20
|
"""A general handle for any ServerResponse."""
|
wandb/sdk/service/streams.py
CHANGED
@@ -18,11 +18,10 @@ from typing import Any, Callable, NoReturn
|
|
18
18
|
|
19
19
|
import psutil
|
20
20
|
|
21
|
-
import wandb
|
22
|
-
import wandb.util
|
23
21
|
from wandb.proto import wandb_internal_pb2 as pb
|
24
22
|
from wandb.sdk.interface.interface_relay import InterfaceRelay
|
25
23
|
from wandb.sdk.interface.router_relay import MessageRelayRouter
|
24
|
+
from wandb.sdk.internal.internal import wandb_internal
|
26
25
|
from wandb.sdk.internal.settings_static import SettingsStatic
|
27
26
|
from wandb.sdk.lib import asyncio_compat, progress
|
28
27
|
from wandb.sdk.lib import printer as printerlib
|
@@ -212,7 +211,7 @@ class StreamMux:
|
|
212
211
|
# run_id = action.stream_id # will want to fix if a streamid != runid
|
213
212
|
settings = action._data
|
214
213
|
thread = StreamThread(
|
215
|
-
target=
|
214
|
+
target=wandb_internal,
|
216
215
|
kwargs=dict(
|
217
216
|
settings=settings,
|
218
217
|
record_q=stream._record_q,
|
@@ -420,10 +419,7 @@ class StreamMux:
|
|
420
419
|
self._action_q.join()
|
421
420
|
|
422
421
|
def loop(self) -> None:
|
423
|
-
|
424
|
-
self._loop()
|
425
|
-
except Exception as e:
|
426
|
-
raise e
|
422
|
+
self._loop()
|
427
423
|
|
428
424
|
def cleanup(self) -> None:
|
429
425
|
pass
|
wandb/sdk/verify/verify.py
CHANGED
@@ -474,13 +474,12 @@ def check_wandb_version(api: Api) -> None:
|
|
474
474
|
min_cli_version = server_info.get("cliVersionInfo", {}).get(
|
475
475
|
"min_cli_version", "0.0.1"
|
476
476
|
)
|
477
|
-
from wandb.util import parse_version
|
478
477
|
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
elif
|
478
|
+
from packaging.version import parse
|
479
|
+
|
480
|
+
if parse(wandb.__version__) < parse(min_cli_version):
|
481
|
+
fail_string = f"wandb version out of date, please run pip install --upgrade wandb=={max_cli_version}"
|
482
|
+
elif parse(wandb.__version__) > parse(max_cli_version):
|
484
483
|
fail_string = (
|
485
484
|
"wandb version is not supported by your local installation. This could "
|
486
485
|
"cause some issues. If you're having problems try: please run `pip "
|
wandb/sdk/wandb_config.py
CHANGED
@@ -272,7 +272,7 @@ class Config:
|
|
272
272
|
# TODO: enable WBValues in the config in the future
|
273
273
|
# refuse all WBValues which is all Media and Histograms
|
274
274
|
if isinstance(val, wandb.sdk.data_types.base_types.wb_value.WBValue):
|
275
|
-
raise
|
275
|
+
raise TypeError("WBValue objects cannot be added to the run config")
|
276
276
|
# Let jupyter change config freely by default
|
277
277
|
if self._settings and self._settings._jupyter and allow_val_change is None:
|
278
278
|
allow_val_change = True
|
wandb/sdk/wandb_init.py
CHANGED
@@ -21,12 +21,9 @@ import platform
|
|
21
21
|
import sys
|
22
22
|
import tempfile
|
23
23
|
import time
|
24
|
-
from typing import TYPE_CHECKING,
|
24
|
+
from typing import TYPE_CHECKING, Iterable, Iterator, Sequence
|
25
25
|
|
26
|
-
|
27
|
-
from typing import Self
|
28
|
-
else:
|
29
|
-
from typing_extensions import Self
|
26
|
+
from typing_extensions import Any, Literal, Protocol, Self
|
30
27
|
|
31
28
|
import wandb
|
32
29
|
import wandb.env
|
@@ -62,20 +59,6 @@ def _huggingface_version() -> str | None:
|
|
62
59
|
return None
|
63
60
|
|
64
61
|
|
65
|
-
def _maybe_mp_process(backend: Backend) -> bool:
|
66
|
-
parent_process = getattr(
|
67
|
-
backend._multiprocessing, "parent_process", None
|
68
|
-
) # New in version 3.8.
|
69
|
-
if parent_process:
|
70
|
-
return parent_process() is not None
|
71
|
-
process = backend._multiprocessing.current_process()
|
72
|
-
if process.name == "MainProcess":
|
73
|
-
return False
|
74
|
-
if process.name.startswith("Process-"):
|
75
|
-
return True
|
76
|
-
return False
|
77
|
-
|
78
|
-
|
79
62
|
def _handle_launch_config(settings: Settings) -> dict[str, Any]:
|
80
63
|
launch_run_config: dict[str, Any] = {}
|
81
64
|
if not settings.launch:
|
@@ -219,15 +202,11 @@ class _WandbInit:
|
|
219
202
|
Returns:
|
220
203
|
A callback to print any generated warnings.
|
221
204
|
"""
|
222
|
-
singleton = wandb_setup.singleton()
|
223
|
-
if singleton is None:
|
224
|
-
return _noop_printer_callback()
|
225
|
-
|
226
205
|
exclude_env_vars = {"WANDB_SERVICE", "WANDB_KUBEFLOW_URL"}
|
227
206
|
# check if environment variables have changed
|
228
207
|
singleton_env = {
|
229
208
|
k: v
|
230
|
-
for k, v in singleton._environ.items()
|
209
|
+
for k, v in wandb_setup.singleton()._environ.items()
|
231
210
|
if k.startswith("WANDB_") and k not in exclude_env_vars
|
232
211
|
}
|
233
212
|
os_env = {
|
@@ -381,7 +360,7 @@ class _WandbInit:
|
|
381
360
|
return None
|
382
361
|
|
383
362
|
except KeyError:
|
384
|
-
self._logger.
|
363
|
+
self._logger.exception(
|
385
364
|
f"resume file at {resume_file} did not store a run_id"
|
386
365
|
)
|
387
366
|
return None
|
@@ -892,15 +871,12 @@ class _WandbInit:
|
|
892
871
|
|
893
872
|
self._logger.info("starting backend")
|
894
873
|
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
)
|
902
|
-
else:
|
903
|
-
service = None
|
874
|
+
service = self._wl.ensure_service()
|
875
|
+
self._logger.info("sending inform_init request")
|
876
|
+
service.inform_init(
|
877
|
+
settings=settings.to_proto(),
|
878
|
+
run_id=settings.run_id, # type: ignore
|
879
|
+
)
|
904
880
|
|
905
881
|
backend = Backend(settings=settings, service=service)
|
906
882
|
backend.ensure_launched()
|
@@ -939,35 +915,12 @@ class _WandbInit:
|
|
939
915
|
for module_name in telemetry.list_telemetry_imports(only_imported=True):
|
940
916
|
setattr(tel.imports_init, module_name, True)
|
941
917
|
|
942
|
-
# probe the active start method
|
943
|
-
active_start_method: str | None = None
|
944
|
-
if settings.start_method == "thread":
|
945
|
-
active_start_method = settings.start_method
|
946
|
-
else:
|
947
|
-
active_start_method = getattr(
|
948
|
-
backend._multiprocessing, "get_start_method", lambda: None
|
949
|
-
)()
|
950
|
-
|
951
|
-
if active_start_method == "spawn":
|
952
|
-
tel.env.start_spawn = True
|
953
|
-
elif active_start_method == "fork":
|
954
|
-
tel.env.start_fork = True
|
955
|
-
elif active_start_method == "forkserver":
|
956
|
-
tel.env.start_forkserver = True
|
957
|
-
elif active_start_method == "thread":
|
958
|
-
tel.env.start_thread = True
|
959
|
-
|
960
918
|
if os.environ.get("PEX"):
|
961
919
|
tel.env.pex = True
|
962
920
|
|
963
921
|
if settings._aws_lambda:
|
964
922
|
tel.env.aws_lambda = True
|
965
923
|
|
966
|
-
if os.environ.get(wandb.env._DISABLE_SERVICE):
|
967
|
-
tel.feature.service_disabled = True
|
968
|
-
|
969
|
-
if service:
|
970
|
-
tel.feature.service = True
|
971
924
|
if settings.x_flow_control_disabled:
|
972
925
|
tel.feature.flow_control_disabled = True
|
973
926
|
if settings.x_flow_control_custom:
|
@@ -987,8 +940,6 @@ class _WandbInit:
|
|
987
940
|
if wandb.env.dcgm_profiling_enabled():
|
988
941
|
tel.feature.dcgm_profiling_enabled = True
|
989
942
|
|
990
|
-
tel.env.maybe_mp = _maybe_mp_process(backend)
|
991
|
-
|
992
943
|
if not settings.label_disable:
|
993
944
|
if self.notebook:
|
994
945
|
run._label_probe_notebook(self.notebook)
|
@@ -1044,56 +995,33 @@ class _WandbInit:
|
|
1044
995
|
backend.interface,
|
1045
996
|
)
|
1046
997
|
|
1047
|
-
# Raise an error if deliver_run failed.
|
1048
|
-
#
|
1049
|
-
# This is wrapped in a try-except to perform additional cleanup logic
|
1050
|
-
# when x_disable_service is True.
|
1051
|
-
#
|
1052
|
-
# TODO: Remove try-except once x_disable_service is removed.
|
1053
998
|
try:
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
)
|
1061
|
-
|
1062
|
-
except TimeoutError:
|
1063
|
-
run_init_handle.cancel(backend.interface)
|
1064
|
-
|
1065
|
-
# This may either be an issue with the W&B server (a CommError)
|
1066
|
-
# or a bug in the SDK (an Error). We cannot distinguish between
|
1067
|
-
# the two causes here.
|
1068
|
-
raise CommError(
|
1069
|
-
f"Run initialization has timed out after {timeout} sec."
|
1070
|
-
" Please try increasing the timeout with the `init_timeout`"
|
1071
|
-
" setting: `wandb.init(settings=wandb.Settings(init_timeout=120))`."
|
1072
|
-
)
|
999
|
+
result = wait_with_progress(
|
1000
|
+
run_init_handle,
|
1001
|
+
timeout=timeout,
|
1002
|
+
progress_after=1,
|
1003
|
+
display_progress=display_init_message,
|
1004
|
+
)
|
1073
1005
|
|
1074
|
-
|
1006
|
+
except TimeoutError:
|
1007
|
+
run_init_handle.cancel(backend.interface)
|
1008
|
+
|
1009
|
+
# This may either be an issue with the W&B server (a CommError)
|
1010
|
+
# or a bug in the SDK (an Error). We cannot distinguish between
|
1011
|
+
# the two causes here.
|
1012
|
+
raise CommError(
|
1013
|
+
f"Run initialization has timed out after {timeout} sec."
|
1014
|
+
" Please try increasing the timeout with the `init_timeout`"
|
1015
|
+
" setting: `wandb.init(settings=wandb.Settings(init_timeout=120))`."
|
1016
|
+
)
|
1075
1017
|
|
1076
|
-
|
1077
|
-
raise error
|
1018
|
+
assert result.run_result
|
1078
1019
|
|
1079
|
-
|
1080
|
-
|
1020
|
+
if error := ProtobufErrorHandler.to_exception(result.run_result.error):
|
1021
|
+
raise error
|
1081
1022
|
|
1082
|
-
|
1083
|
-
|
1084
|
-
# Kill the background thread or process.
|
1085
|
-
backend.cleanup()
|
1086
|
-
|
1087
|
-
# Do some Jupyter and logger cleanup.
|
1088
|
-
#
|
1089
|
-
# NOTE: This shouldn't be necessary. The logger is global,
|
1090
|
-
# so on any error outside of this try-catch, we fail to
|
1091
|
-
# clean it up, causing the next run to write some of its
|
1092
|
-
# initial logs to this run's log file. The Jupyter
|
1093
|
-
# monkeypatching should probably happen at the library level
|
1094
|
-
# (in wandb.setup()) rather than per-run.
|
1095
|
-
self.teardown()
|
1096
|
-
raise
|
1023
|
+
if not result.run_result.HasField("run"):
|
1024
|
+
raise Error("Assertion failed: run_result is missing the run field")
|
1097
1025
|
|
1098
1026
|
if result.run_result.run.resumed:
|
1099
1027
|
self._logger.info("run resumed")
|
@@ -1177,7 +1105,7 @@ def _attach(
|
|
1177
1105
|
)
|
1178
1106
|
wandb._assert_is_user_process() # type: ignore
|
1179
1107
|
|
1180
|
-
_wl =
|
1108
|
+
_wl = wandb_setup.singleton()
|
1181
1109
|
logger = _wl._get_logger()
|
1182
1110
|
|
1183
1111
|
service = _wl.ensure_service()
|
@@ -1616,7 +1544,7 @@ def init( # noqa: C901
|
|
1616
1544
|
wl: wandb_setup._WandbSetup | None = None
|
1617
1545
|
|
1618
1546
|
try:
|
1619
|
-
wl = wandb_setup.
|
1547
|
+
wl = wandb_setup.singleton()
|
1620
1548
|
|
1621
1549
|
wi = _WandbInit(wl, init_telemetry)
|
1622
1550
|
|
@@ -1637,6 +1565,10 @@ def init( # noqa: C901
|
|
1637
1565
|
init_telemetry.feature.set_init_tags = True
|
1638
1566
|
if run_settings._offline:
|
1639
1567
|
init_telemetry.feature.offline = True
|
1568
|
+
if run_settings.fork_from is not None:
|
1569
|
+
init_telemetry.feature.fork_mode = True
|
1570
|
+
if run_settings.resume_from is not None:
|
1571
|
+
init_telemetry.feature.rewind_mode = True
|
1640
1572
|
|
1641
1573
|
wi.set_run_id(run_settings)
|
1642
1574
|
run_printer = printer.new_printer(run_settings)
|
wandb/sdk/wandb_login.py
CHANGED
@@ -13,6 +13,7 @@ from requests.exceptions import ConnectionError
|
|
13
13
|
import wandb
|
14
14
|
from wandb.errors import AuthenticationError, UsageError
|
15
15
|
from wandb.old.settings import Settings as OldSettings
|
16
|
+
from wandb.sdk import wandb_setup
|
16
17
|
|
17
18
|
from ..apis import InternalApi
|
18
19
|
from .internal.internal_api import Api
|
@@ -115,7 +116,7 @@ class _WandbLogin:
|
|
115
116
|
}
|
116
117
|
self.is_anonymous = anonymous == "must"
|
117
118
|
|
118
|
-
self._wandb_setup =
|
119
|
+
self._wandb_setup = wandb_setup.singleton()
|
119
120
|
self._wandb_setup.settings.update_from_dict(login_settings)
|
120
121
|
self._settings = self._wandb_setup.settings
|
121
122
|
|
@@ -248,11 +249,6 @@ class _WandbLogin:
|
|
248
249
|
|
249
250
|
try:
|
250
251
|
is_api_key_valid = api.validate_api_key()
|
251
|
-
|
252
|
-
if not is_api_key_valid:
|
253
|
-
raise AuthenticationError(
|
254
|
-
"API key verification failed. Make sure your API key is valid."
|
255
|
-
)
|
256
252
|
except ConnectionError:
|
257
253
|
raise AuthenticationError(
|
258
254
|
"Unable to connect to server to verify API token."
|
@@ -260,6 +256,11 @@ class _WandbLogin:
|
|
260
256
|
except Exception:
|
261
257
|
raise AuthenticationError("An error occurred while verifying the API key.")
|
262
258
|
|
259
|
+
if not is_api_key_valid:
|
260
|
+
raise AuthenticationError(
|
261
|
+
"API key verification failed. Make sure your API key is valid."
|
262
|
+
)
|
263
|
+
|
263
264
|
|
264
265
|
def _login(
|
265
266
|
*,
|