wandb 0.18.1__py3-none-win32.whl → 0.18.2__py3-none-win32.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +3 -3
- wandb/__init__.pyi +67 -12
- wandb/apis/internal.py +3 -0
- wandb/apis/public/api.py +128 -2
- wandb/apis/public/artifacts.py +11 -7
- wandb/apis/public/jobs.py +8 -0
- wandb/apis/public/runs.py +16 -5
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +0 -3
- wandb/errors/__init__.py +11 -40
- wandb/errors/errors.py +37 -0
- wandb/errors/warnings.py +2 -0
- wandb/integration/tensorboard/log.py +1 -1
- wandb/old/core.py +2 -80
- wandb/plot/bar.py +7 -4
- wandb/plot/confusion_matrix.py +5 -4
- wandb/plot/histogram.py +7 -4
- wandb/plot/line.py +7 -4
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/sdk/artifacts/_validators.py +48 -3
- wandb/sdk/artifacts/artifact.py +157 -183
- wandb/sdk/artifacts/artifact_file_cache.py +13 -11
- wandb/sdk/artifacts/artifact_instance_cache.py +4 -2
- wandb/sdk/artifacts/artifact_manifest.py +13 -11
- wandb/sdk/artifacts/artifact_manifest_entry.py +24 -22
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +9 -7
- wandb/sdk/artifacts/artifact_saver.py +27 -25
- wandb/sdk/artifacts/exceptions.py +26 -25
- wandb/sdk/artifacts/storage_handler.py +11 -9
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +16 -14
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +15 -13
- wandb/sdk/artifacts/storage_handlers/http_handler.py +15 -14
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +10 -8
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +14 -12
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +19 -19
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +10 -8
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +12 -10
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +9 -7
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +31 -29
- wandb/sdk/artifacts/storage_policy.py +20 -20
- wandb/sdk/backend/backend.py +8 -26
- wandb/sdk/data_types/base_types/wb_value.py +1 -3
- wandb/sdk/data_types/video.py +2 -2
- wandb/sdk/interface/interface.py +0 -24
- wandb/sdk/interface/interface_shared.py +0 -12
- wandb/sdk/internal/handler.py +0 -10
- wandb/sdk/internal/internal_api.py +71 -0
- wandb/sdk/internal/sender.py +0 -43
- wandb/sdk/internal/tb_watcher.py +1 -1
- wandb/sdk/lib/_settings_toposort_generated.py +1 -0
- wandb/sdk/lib/hashutil.py +34 -12
- wandb/sdk/lib/service_connection.py +216 -0
- wandb/sdk/lib/service_token.py +94 -0
- wandb/sdk/lib/sock_client.py +7 -3
- wandb/sdk/service/server.py +2 -5
- wandb/sdk/service/service.py +0 -22
- wandb/sdk/wandb_init.py +32 -22
- wandb/sdk/wandb_run.py +12 -7
- wandb/sdk/wandb_settings.py +2 -0
- wandb/sdk/wandb_setup.py +25 -16
- wandb/sdk/wandb_sync.py +9 -3
- wandb/sdk/wandb_watch.py +31 -15
- wandb/util.py +8 -1
- {wandb-0.18.1.dist-info → wandb-0.18.2.dist-info}/METADATA +2 -1
- {wandb-0.18.1.dist-info → wandb-0.18.2.dist-info}/RECORD +71 -71
- wandb/sdk/internal/update.py +0 -113
- wandb/sdk/service/service_base.py +0 -50
- wandb/sdk/service/service_sock.py +0 -70
- wandb/sdk/wandb_manager.py +0 -232
- /wandb/{sdk/lib → plot}/viz.py +0 -0
- {wandb-0.18.1.dist-info → wandb-0.18.2.dist-info}/WHEEL +0 -0
- {wandb-0.18.1.dist-info → wandb-0.18.2.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.1.dist-info → wandb-0.18.2.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_run.py
CHANGED
@@ -44,6 +44,7 @@ from wandb.apis.internal import Api
|
|
44
44
|
from wandb.apis.public import Api as PublicApi
|
45
45
|
from wandb.errors import CommError
|
46
46
|
from wandb.integration.torch import wandb_torch
|
47
|
+
from wandb.plot.viz import CustomChart, Visualize, custom_chart
|
47
48
|
from wandb.proto.wandb_internal_pb2 import (
|
48
49
|
MetricRecord,
|
49
50
|
PollExitResponse,
|
@@ -57,7 +58,6 @@ from wandb.sdk.lib.import_hooks import (
|
|
57
58
|
unregister_post_import_hook,
|
58
59
|
)
|
59
60
|
from wandb.sdk.lib.paths import FilePathStr, LogicalPath, StrPath
|
60
|
-
from wandb.sdk.lib.viz import CustomChart, Visualize, custom_chart
|
61
61
|
from wandb.util import (
|
62
62
|
_is_artifact_object,
|
63
63
|
_is_artifact_string,
|
@@ -592,12 +592,14 @@ class Run:
|
|
592
592
|
) -> None:
|
593
593
|
# pid is set, so we know if this run object was initialized by this process
|
594
594
|
self._init_pid = os.getpid()
|
595
|
-
self._settings = settings
|
596
595
|
|
597
596
|
if settings._noop:
|
597
|
+
# TODO: properly handle setting for disabled mode
|
598
|
+
self._settings = settings
|
598
599
|
return
|
599
600
|
|
600
601
|
self._init(
|
602
|
+
settings=settings,
|
601
603
|
config=config,
|
602
604
|
sweep_config=sweep_config,
|
603
605
|
launch_config=launch_config,
|
@@ -605,10 +607,13 @@ class Run:
|
|
605
607
|
|
606
608
|
def _init(
|
607
609
|
self,
|
610
|
+
settings: Settings,
|
608
611
|
config: Optional[Dict[str, Any]] = None,
|
609
612
|
sweep_config: Optional[Dict[str, Any]] = None,
|
610
613
|
launch_config: Optional[Dict[str, Any]] = None,
|
611
614
|
) -> None:
|
615
|
+
self._settings = settings
|
616
|
+
|
612
617
|
self._config = wandb_config.Config()
|
613
618
|
self._config._set_callback(self._config_callback)
|
614
619
|
self._config._set_artifact_callback(self._config_artifact_callback)
|
@@ -2194,9 +2199,9 @@ class Run:
|
|
2194
2199
|
# Inform the service that we're done sending messages for this run.
|
2195
2200
|
#
|
2196
2201
|
# TODO: Why not do this in _atexit_cleanup()?
|
2197
|
-
|
2198
|
-
if
|
2199
|
-
|
2202
|
+
service = self._wl and self._wl.service
|
2203
|
+
if service:
|
2204
|
+
service.inform_finish(run_id=self._run_id)
|
2200
2205
|
|
2201
2206
|
finally:
|
2202
2207
|
module.unset_globals()
|
@@ -2459,8 +2464,8 @@ class Run:
|
|
2459
2464
|
logger.info("atexit reg")
|
2460
2465
|
self._hooks = ExitHooks()
|
2461
2466
|
|
2462
|
-
|
2463
|
-
if not
|
2467
|
+
service = self._wl and self._wl.service
|
2468
|
+
if not service:
|
2464
2469
|
self._hooks.hook()
|
2465
2470
|
# NB: manager will perform atexit hook like behavior for outstanding runs
|
2466
2471
|
atexit.register(lambda: self._atexit_cleanup())
|
wandb/sdk/wandb_settings.py
CHANGED
@@ -315,6 +315,7 @@ class SettingsData:
|
|
315
315
|
_executable: str
|
316
316
|
_extra_http_headers: Mapping[str, str]
|
317
317
|
_file_stream_max_bytes: int # max size for filestream requests in core
|
318
|
+
_file_stream_transmit_interval: float # tx interval for filestream requests in core
|
318
319
|
# file stream retry client configuration
|
319
320
|
_file_stream_retry_max: int # max number of retries
|
320
321
|
_file_stream_retry_wait_min_seconds: float # min wait time between retries
|
@@ -664,6 +665,7 @@ class Settings(SettingsData):
|
|
664
665
|
_disable_viewer={"preprocessor": _str_as_bool},
|
665
666
|
_extra_http_headers={"preprocessor": _str_as_json},
|
666
667
|
_file_stream_max_bytes={"preprocessor": int},
|
668
|
+
_file_stream_transmit_interval={"preprocessor": float},
|
667
669
|
_file_stream_retry_max={"preprocessor": int},
|
668
670
|
_file_stream_retry_wait_min_seconds={"preprocessor": float},
|
669
671
|
_file_stream_retry_wait_max_seconds={"preprocessor": float},
|
wandb/sdk/wandb_setup.py
CHANGED
@@ -20,7 +20,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
|
20
20
|
import wandb
|
21
21
|
from wandb.sdk.lib import import_hooks
|
22
22
|
|
23
|
-
from . import
|
23
|
+
from . import wandb_settings
|
24
24
|
from .lib import config_util, server, tracelog
|
25
25
|
|
26
26
|
Settings = Union["wandb.sdk.wandb_settings.Settings", Dict[str, Any]]
|
@@ -28,6 +28,8 @@ Settings = Union["wandb.sdk.wandb_settings.Settings", Dict[str, Any]]
|
|
28
28
|
Logger = Union[logging.Logger, "_EarlyLogger"]
|
29
29
|
|
30
30
|
if TYPE_CHECKING:
|
31
|
+
from wandb.sdk.lib import service_connection
|
32
|
+
|
31
33
|
from . import wandb_run
|
32
34
|
|
33
35
|
# logger will be configured to be either a standard logger instance or _EarlyLogger
|
@@ -82,20 +84,18 @@ class _EarlyLogger:
|
|
82
84
|
class _WandbSetup__WandbSetup: # noqa: N801
|
83
85
|
"""Inner class of _WandbSetup."""
|
84
86
|
|
85
|
-
_manager: Optional[wandb_manager._Manager]
|
86
|
-
_pid: int
|
87
|
-
|
88
87
|
def __init__(
|
89
88
|
self,
|
90
89
|
pid: int,
|
91
90
|
settings: Optional[Settings] = None,
|
92
91
|
environ: Optional[Dict[str, Any]] = None,
|
93
92
|
) -> None:
|
93
|
+
self._connection: Optional[service_connection.ServiceConnection] = None
|
94
|
+
|
94
95
|
self._environ = environ or dict(os.environ)
|
95
96
|
self._sweep_config: Optional[Dict[str, Any]] = None
|
96
97
|
self._config: Optional[Dict[str, Any]] = None
|
97
98
|
self._server: Optional[server.Server] = None
|
98
|
-
self._manager: Optional[wandb_manager._Manager] = None
|
99
99
|
self._pid = pid
|
100
100
|
|
101
101
|
# keep track of multiple runs, so we can unwind with join()s
|
@@ -248,7 +248,10 @@ class _WandbSetup__WandbSetup: # noqa: N801
|
|
248
248
|
print("frozen, could be trouble")
|
249
249
|
|
250
250
|
def _setup(self) -> None:
|
251
|
-
self.
|
251
|
+
if not self._settings._noop and not self._settings._disable_service:
|
252
|
+
from wandb.sdk.lib import service_connection
|
253
|
+
|
254
|
+
self._connection = service_connection.connect_to_service(self._settings)
|
252
255
|
|
253
256
|
sweep_path = self._settings.sweep_param_path
|
254
257
|
if sweep_path:
|
@@ -271,22 +274,21 @@ class _WandbSetup__WandbSetup: # noqa: N801
|
|
271
274
|
def _teardown(self, exit_code: Optional[int] = None) -> None:
|
272
275
|
import_hooks.unregister_all_post_import_hooks()
|
273
276
|
|
274
|
-
if not self.
|
277
|
+
if not self._connection:
|
275
278
|
return
|
276
279
|
|
277
|
-
internal_exit_code = self.
|
278
|
-
|
280
|
+
internal_exit_code = self._connection.teardown(exit_code or 0)
|
281
|
+
|
282
|
+
# Reset to None so that setup() creates a new connection.
|
283
|
+
self._connection = None
|
279
284
|
|
280
285
|
if internal_exit_code != 0:
|
281
286
|
sys.exit(internal_exit_code)
|
282
287
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
def _get_manager(self) -> Optional[wandb_manager._Manager]:
|
289
|
-
return self._manager
|
288
|
+
@property
|
289
|
+
def service(self) -> "Optional[service_connection.ServiceConnection]":
|
290
|
+
"""Returns a connection to the service process, if it exists."""
|
291
|
+
return self._connection
|
290
292
|
|
291
293
|
|
292
294
|
class _WandbSetup:
|
@@ -305,6 +307,13 @@ class _WandbSetup:
|
|
305
307
|
return
|
306
308
|
_WandbSetup._instance = _WandbSetup__WandbSetup(settings=settings, pid=pid)
|
307
309
|
|
310
|
+
@property
|
311
|
+
def service(self) -> "Optional[service_connection.ServiceConnection]":
|
312
|
+
"""Returns a connection to the service process, if it exists."""
|
313
|
+
if not self._instance:
|
314
|
+
return None
|
315
|
+
return self._instance.service
|
316
|
+
|
308
317
|
def __getattr__(self, name: str) -> Any:
|
309
318
|
return getattr(self._instance, name)
|
310
319
|
|
wandb/sdk/wandb_sync.py
CHANGED
@@ -37,11 +37,17 @@ def _sync(
|
|
37
37
|
if append:
|
38
38
|
settings.resume.value = "allow"
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
service = wl.service
|
41
|
+
assert service
|
42
|
+
|
43
|
+
service.inform_init(settings=settings, run_id=stream_id)
|
42
44
|
|
43
45
|
mailbox = Mailbox()
|
44
|
-
backend = Backend(
|
46
|
+
backend = Backend(
|
47
|
+
settings=wl.settings,
|
48
|
+
service=service,
|
49
|
+
mailbox=mailbox,
|
50
|
+
)
|
45
51
|
backend.ensure_launched()
|
46
52
|
|
47
53
|
assert backend.interface
|
wandb/sdk/wandb_watch.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
"""watch."""
|
2
2
|
|
3
|
+
from __future__ import annotations
|
4
|
+
|
3
5
|
import logging
|
4
|
-
from typing import
|
6
|
+
from typing import TYPE_CHECKING, Sequence
|
5
7
|
|
6
8
|
try:
|
7
9
|
from typing import Literal
|
@@ -12,36 +14,50 @@ import wandb
|
|
12
14
|
|
13
15
|
from .lib import telemetry
|
14
16
|
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
import torch # type: ignore [import-not-found]
|
19
|
+
|
15
20
|
logger = logging.getLogger("wandb")
|
16
21
|
|
17
22
|
_global_watch_idx = 0
|
18
23
|
|
19
24
|
|
20
25
|
def watch(
|
21
|
-
models,
|
22
|
-
criterion=None,
|
23
|
-
log:
|
26
|
+
models: torch.nn.Module | Sequence[torch.nn.Module],
|
27
|
+
criterion: torch.F | None = None,
|
28
|
+
log: Literal["gradients", "parameters", "all"] | None = "gradients",
|
24
29
|
log_freq: int = 1000,
|
25
|
-
idx:
|
30
|
+
idx: int | None = None,
|
26
31
|
log_graph: bool = False,
|
27
32
|
):
|
28
|
-
"""
|
33
|
+
"""Hooks into the given PyTorch model(s) to monitor gradients and the model's computational graph.
|
29
34
|
|
30
|
-
|
35
|
+
This function can track parameters, gradients, or both during training. It should be
|
36
|
+
extended to support arbitrary machine learning models in the future.
|
31
37
|
|
32
38
|
Args:
|
33
|
-
models
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
models (Union[torch.nn.Module, Sequence[torch.nn.Module]]):
|
40
|
+
A single model or a sequence of models to be monitored.
|
41
|
+
criterion (Optional[torch.F]):
|
42
|
+
The loss function being optimized (optional).
|
43
|
+
log (Optional[Literal["gradients", "parameters", "all"]]):
|
44
|
+
Specifies whether to log "gradients", "parameters", or "all".
|
45
|
+
Set to None to disable logging. (default="gradients")
|
46
|
+
log_freq (int):
|
47
|
+
Frequency (in batches) to log gradients and parameters. (default=1000)
|
48
|
+
idx (Optional[int]):
|
49
|
+
Index used when tracking multiple models with `wandb.watch`. (default=None)
|
50
|
+
log_graph (bool):
|
51
|
+
Whether to log the model's computational graph. (default=False)
|
39
52
|
|
40
53
|
Returns:
|
41
|
-
|
54
|
+
wandb.Graph:
|
55
|
+
The graph object, which will be populated after the first backward pass.
|
42
56
|
|
43
57
|
Raises:
|
44
|
-
ValueError:
|
58
|
+
ValueError:
|
59
|
+
If `wandb.init` has not been called or if any of the models are not instances
|
60
|
+
of `torch.nn.Module`.
|
45
61
|
"""
|
46
62
|
global _global_watch_idx
|
47
63
|
|
wandb/util.py
CHANGED
@@ -1888,7 +1888,14 @@ def working_set() -> Iterable[InstalledDistribution]:
|
|
1888
1888
|
from importlib_metadata import distributions # type: ignore
|
1889
1889
|
|
1890
1890
|
for d in distributions():
|
1891
|
-
|
1891
|
+
try:
|
1892
|
+
# In some distributions, the "Name" attribute may not be present,
|
1893
|
+
# which can raise a KeyError. To handle this, we catch the exception
|
1894
|
+
# and skip those distributions.
|
1895
|
+
# For additional context, see: https://github.com/python/importlib_metadata/issues/371.
|
1896
|
+
yield InstalledDistribution(key=d.metadata["Name"], version=d.version)
|
1897
|
+
except KeyError:
|
1898
|
+
pass
|
1892
1899
|
|
1893
1900
|
|
1894
1901
|
def parse_version(version: str) -> "packaging.version.Version":
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wandb
|
3
|
-
Version: 0.18.
|
3
|
+
Version: 0.18.2
|
4
4
|
Summary: A CLI and library for interacting with the Weights & Biases API.
|
5
5
|
Project-URL: Source, https://github.com/wandb/wandb
|
6
6
|
Project-URL: Bug Reports, https://github.com/wandb/wandb/issues
|
@@ -105,6 +105,7 @@ Requires-Dist: tomli; extra == 'launch'
|
|
105
105
|
Requires-Dist: typing-extensions; extra == 'launch'
|
106
106
|
Provides-Extra: media
|
107
107
|
Requires-Dist: bokeh; extra == 'media'
|
108
|
+
Requires-Dist: imageio; extra == 'media'
|
108
109
|
Requires-Dist: moviepy; extra == 'media'
|
109
110
|
Requires-Dist: numpy; extra == 'media'
|
110
111
|
Requires-Dist: pillow; extra == 'media'
|