wandb 0.19.7__py3-none-win32.whl → 0.19.9__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 +5 -1
- wandb/__init__.pyi +43 -9
- wandb/_pydantic/__init__.py +23 -0
- wandb/_pydantic/base.py +113 -0
- wandb/_pydantic/v1_compat.py +262 -0
- wandb/apis/paginator.py +82 -38
- wandb/apis/public/api.py +10 -64
- wandb/apis/public/artifacts.py +73 -17
- wandb/apis/public/files.py +2 -2
- wandb/apis/public/projects.py +3 -2
- wandb/apis/public/reports.py +2 -2
- wandb/apis/public/runs.py +19 -11
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/data_types.py +1 -1
- wandb/filesync/dir_watcher.py +2 -1
- wandb/integration/metaflow/metaflow.py +19 -17
- wandb/integration/sacred/__init__.py +1 -1
- wandb/jupyter.py +18 -15
- wandb/proto/v3/wandb_internal_pb2.py +7 -3
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v4/wandb_internal_pb2.py +3 -3
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v5/wandb_internal_pb2.py +3 -3
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
- wandb/proto/wandb_deprecated.py +2 -0
- wandb/sdk/artifacts/_graphql_fragments.py +18 -20
- wandb/sdk/artifacts/_validators.py +1 -0
- wandb/sdk/artifacts/artifact.py +81 -46
- wandb/sdk/artifacts/artifact_saver.py +16 -2
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +23 -2
- wandb/sdk/backend/backend.py +16 -5
- wandb/sdk/data_types/audio.py +1 -3
- wandb/sdk/data_types/base_types/media.py +11 -4
- wandb/sdk/data_types/image.py +44 -25
- wandb/sdk/data_types/molecule.py +1 -5
- wandb/sdk/data_types/object_3d.py +2 -1
- wandb/sdk/data_types/saved_model.py +7 -9
- wandb/sdk/data_types/video.py +1 -4
- wandb/sdk/interface/interface.py +65 -43
- wandb/sdk/interface/interface_queue.py +0 -7
- wandb/sdk/interface/interface_relay.py +6 -16
- wandb/sdk/interface/interface_shared.py +47 -40
- wandb/sdk/interface/interface_sock.py +1 -8
- wandb/sdk/interface/router.py +22 -54
- wandb/sdk/interface/router_queue.py +11 -10
- wandb/sdk/interface/router_relay.py +24 -12
- wandb/sdk/interface/router_sock.py +6 -11
- wandb/{apis/public → sdk/internal}/_generated/__init__.py +0 -6
- wandb/sdk/internal/_generated/base.py +226 -0
- wandb/{apis/public → sdk/internal}/_generated/server_features_query.py +3 -3
- wandb/{apis/public → sdk/internal}/_generated/typing_compat.py +1 -1
- wandb/sdk/internal/internal_api.py +138 -47
- wandb/sdk/internal/sender.py +5 -1
- wandb/sdk/internal/sender_config.py +8 -11
- wandb/sdk/internal/settings_static.py +24 -2
- wandb/sdk/lib/apikey.py +15 -16
- wandb/sdk/lib/console_capture.py +172 -0
- wandb/sdk/lib/redirect.py +102 -76
- wandb/sdk/lib/run_moment.py +4 -6
- wandb/sdk/lib/service_connection.py +37 -17
- wandb/sdk/lib/sock_client.py +2 -52
- wandb/sdk/lib/wb_logging.py +161 -0
- wandb/sdk/mailbox/__init__.py +3 -3
- wandb/sdk/mailbox/mailbox.py +31 -17
- wandb/sdk/mailbox/mailbox_handle.py +127 -0
- wandb/sdk/mailbox/{handles.py → response_handle.py} +34 -66
- wandb/sdk/mailbox/wait_with_progress.py +16 -15
- wandb/sdk/service/server_sock.py +4 -2
- wandb/sdk/service/streams.py +10 -5
- wandb/sdk/wandb_config.py +44 -43
- wandb/sdk/wandb_init.py +151 -92
- wandb/sdk/wandb_metadata.py +107 -91
- wandb/sdk/wandb_run.py +160 -54
- wandb/sdk/wandb_settings.py +410 -202
- wandb/sdk/wandb_setup.py +3 -1
- wandb/sdk/wandb_sync.py +1 -7
- {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/METADATA +3 -3
- {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/RECORD +88 -84
- wandb/apis/public/_generated/base.py +0 -128
- wandb/sdk/interface/message_future.py +0 -27
- wandb/sdk/interface/message_future_poll.py +0 -50
- /wandb/{apis/public → sdk/internal}/_generated/enums.py +0 -0
- /wandb/{apis/public → sdk/internal}/_generated/input_types.py +0 -0
- /wandb/{apis/public → sdk/internal}/_generated/operations.py +0 -0
- {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/WHEEL +0 -0
- {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/entry_points.txt +0 -0
- {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,21 +1,22 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import time
|
4
|
-
from typing import Any, Callable, Coroutine, List, cast
|
4
|
+
from typing import Any, Callable, Coroutine, List, TypeVar, cast
|
5
5
|
|
6
|
-
from wandb.proto import wandb_internal_pb2 as pb
|
7
6
|
from wandb.sdk.lib import asyncio_compat
|
8
7
|
|
9
|
-
from . import
|
8
|
+
from .mailbox_handle import MailboxHandle
|
9
|
+
|
10
|
+
_T = TypeVar("_T")
|
10
11
|
|
11
12
|
|
12
13
|
def wait_with_progress(
|
13
|
-
handle:
|
14
|
+
handle: MailboxHandle[_T],
|
14
15
|
*,
|
15
16
|
timeout: float | None,
|
16
17
|
progress_after: float,
|
17
18
|
display_progress: Callable[[], Coroutine[Any, Any, None]],
|
18
|
-
) ->
|
19
|
+
) -> _T:
|
19
20
|
"""Wait for a handle, possibly displaying progress to the user.
|
20
21
|
|
21
22
|
Equivalent to passing a single handle to `wait_all_with_progress`.
|
@@ -29,12 +30,12 @@ def wait_with_progress(
|
|
29
30
|
|
30
31
|
|
31
32
|
def wait_all_with_progress(
|
32
|
-
handle_list: list[
|
33
|
+
handle_list: list[MailboxHandle[_T]],
|
33
34
|
*,
|
34
35
|
timeout: float | None,
|
35
36
|
progress_after: float,
|
36
37
|
display_progress: Callable[[], Coroutine[Any, Any, None]],
|
37
|
-
) -> list[
|
38
|
+
) -> list[_T]:
|
38
39
|
"""Wait for multiple handles, possibly displaying progress to the user.
|
39
40
|
|
40
41
|
Args:
|
@@ -70,7 +71,7 @@ def wait_all_with_progress(
|
|
70
71
|
except TimeoutError:
|
71
72
|
pass
|
72
73
|
|
73
|
-
async def progress_loop_with_timeout() -> list[
|
74
|
+
async def progress_loop_with_timeout() -> list[_T]:
|
74
75
|
with asyncio_compat.cancel_on_exit(display_progress()):
|
75
76
|
if timeout is not None:
|
76
77
|
elapsed_time = time.monotonic() - start_time
|
@@ -87,10 +88,10 @@ def wait_all_with_progress(
|
|
87
88
|
|
88
89
|
|
89
90
|
def _wait_handles(
|
90
|
-
handle_list: list[
|
91
|
+
handle_list: list[MailboxHandle[_T]],
|
91
92
|
*,
|
92
93
|
timeout: float,
|
93
|
-
) -> list[
|
94
|
+
) -> list[_T]:
|
94
95
|
"""Wait for multiple mailbox handles.
|
95
96
|
|
96
97
|
Returns:
|
@@ -100,7 +101,7 @@ def _wait_handles(
|
|
100
101
|
TimeoutError: If the overall timeout expires.
|
101
102
|
HandleAbandonedError: If any handle becomes abandoned.
|
102
103
|
"""
|
103
|
-
results: list[
|
104
|
+
results: list[_T] = []
|
104
105
|
|
105
106
|
start_time = time.monotonic()
|
106
107
|
for handle in handle_list:
|
@@ -112,15 +113,15 @@ def _wait_handles(
|
|
112
113
|
|
113
114
|
|
114
115
|
async def _wait_handles_async(
|
115
|
-
handle_list: list[
|
116
|
+
handle_list: list[MailboxHandle[_T]],
|
116
117
|
*,
|
117
118
|
timeout: float | None,
|
118
|
-
) -> list[
|
119
|
+
) -> list[_T]:
|
119
120
|
"""Asynchronously wait for multiple mailbox handles.
|
120
121
|
|
121
122
|
Just like _wait_handles.
|
122
123
|
"""
|
123
|
-
results: list[
|
124
|
+
results: list[_T | None] = [None for _ in handle_list]
|
124
125
|
|
125
126
|
async def wait_single(index: int) -> None:
|
126
127
|
handle = handle_list[index]
|
@@ -131,4 +132,4 @@ async def _wait_handles_async(
|
|
131
132
|
task_group.start_soon(wait_single(index))
|
132
133
|
|
133
134
|
# NOTE: `list` is not subscriptable until Python 3.10, so we use List.
|
134
|
-
return cast(List[
|
135
|
+
return cast(List[_T], results)
|
wandb/sdk/service/server_sock.py
CHANGED
@@ -44,7 +44,10 @@ class SockServerInterfaceReaderThread(threading.Thread):
|
|
44
44
|
_stopped: "Event"
|
45
45
|
|
46
46
|
def __init__(
|
47
|
-
self,
|
47
|
+
self,
|
48
|
+
clients: ClientDict,
|
49
|
+
iface: "InterfaceRelay",
|
50
|
+
stopped: "Event",
|
48
51
|
) -> None:
|
49
52
|
self._iface = iface
|
50
53
|
self._clients = clients
|
@@ -53,7 +56,6 @@ class SockServerInterfaceReaderThread(threading.Thread):
|
|
53
56
|
self._stopped = stopped
|
54
57
|
|
55
58
|
def run(self) -> None:
|
56
|
-
assert self._iface.relay_q
|
57
59
|
while not self._stopped.is_set():
|
58
60
|
try:
|
59
61
|
result = self._iface.relay_q.get(timeout=1)
|
wandb/sdk/service/streams.py
CHANGED
@@ -21,16 +21,14 @@ import psutil
|
|
21
21
|
import wandb
|
22
22
|
import wandb.util
|
23
23
|
from wandb.proto import wandb_internal_pb2 as pb
|
24
|
+
from wandb.sdk.interface.interface_relay import InterfaceRelay
|
25
|
+
from wandb.sdk.interface.router_relay import MessageRelayRouter
|
24
26
|
from wandb.sdk.internal.settings_static import SettingsStatic
|
25
27
|
from wandb.sdk.lib import asyncio_compat, progress
|
26
28
|
from wandb.sdk.lib import printer as printerlib
|
27
29
|
from wandb.sdk.mailbox import Mailbox, MailboxHandle, wait_all_with_progress
|
28
30
|
from wandb.sdk.wandb_run import Run
|
29
31
|
|
30
|
-
from ..interface.interface_relay import InterfaceRelay
|
31
|
-
|
32
|
-
# from wandb.sdk.wandb_settings import Settings
|
33
|
-
|
34
32
|
|
35
33
|
class StreamThread(threading.Thread):
|
36
34
|
"""Class to running internal process as a thread."""
|
@@ -62,6 +60,12 @@ class StreamRecord:
|
|
62
60
|
self._record_q = queue.Queue()
|
63
61
|
self._result_q = queue.Queue()
|
64
62
|
self._relay_q = queue.Queue()
|
63
|
+
self._router = MessageRelayRouter(
|
64
|
+
request_queue=self._record_q,
|
65
|
+
response_queue=self._result_q,
|
66
|
+
relay_queue=self._relay_q,
|
67
|
+
mailbox=self._mailbox,
|
68
|
+
)
|
65
69
|
self._iface = InterfaceRelay(
|
66
70
|
record_q=self._record_q,
|
67
71
|
result_q=self._result_q,
|
@@ -80,6 +84,7 @@ class StreamRecord:
|
|
80
84
|
|
81
85
|
def join(self) -> None:
|
82
86
|
self._iface.join()
|
87
|
+
self._router.join()
|
83
88
|
if self._thread:
|
84
89
|
self._thread.join()
|
85
90
|
|
@@ -290,7 +295,7 @@ class StreamMux:
|
|
290
295
|
|
291
296
|
# fixme: for now we have a single printer for all streams,
|
292
297
|
# and jupyter is disabled if at least single stream's setting set `_jupyter` to false
|
293
|
-
exit_handles: list[MailboxHandle] = []
|
298
|
+
exit_handles: list[MailboxHandle[pb.Result]] = []
|
294
299
|
|
295
300
|
# only finish started streams, non started streams failed early
|
296
301
|
started_streams: dict[str, StreamRecord] = {}
|
wandb/sdk/wandb_config.py
CHANGED
@@ -22,65 +22,63 @@ logger = logging.getLogger("wandb")
|
|
22
22
|
class Config:
|
23
23
|
"""Config object.
|
24
24
|
|
25
|
-
Config objects are intended to hold all of the hyperparameters associated
|
26
|
-
a wandb run and are saved with the run object when `wandb.init` is
|
25
|
+
Config objects are intended to hold all of the hyperparameters associated
|
26
|
+
with a wandb run and are saved with the run object when `wandb.init` is
|
27
|
+
called.
|
27
28
|
|
28
|
-
We recommend setting
|
29
|
-
|
29
|
+
We recommend setting the config once when initializing your run by passing
|
30
|
+
the `config` parameter to `init`:
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
```
|
33
|
+
wandb.init(config=my_config_dict)
|
34
|
+
```
|
35
|
+
|
36
|
+
You can create a file called `config-defaults.yaml`, and it will
|
37
|
+
automatically be loaded as each run's config. You can also pass the name
|
38
|
+
of the file as the `config` parameter to `init`:
|
39
|
+
|
40
|
+
```
|
41
|
+
wandb.init(config="my_config.yaml")
|
42
|
+
```
|
33
43
|
|
34
|
-
You can also load a config YAML file with your custom name and pass the filename
|
35
|
-
into `wandb.init(config="special_config.yaml")`.
|
36
44
|
See https://docs.wandb.com/guides/track/config#file-based-configs.
|
37
45
|
|
38
46
|
Examples:
|
39
47
|
Basic usage
|
40
48
|
```
|
41
|
-
wandb.config
|
42
|
-
|
43
|
-
|
44
|
-
# train
|
45
|
-
```
|
46
|
-
|
47
|
-
Using wandb.init to set config
|
48
|
-
```
|
49
|
-
wandb.init(config={"epochs": 4, "batch_size": 32})
|
50
|
-
for x in range(wandb.config.epochs):
|
51
|
-
# train
|
49
|
+
with wandb.init(config={"epochs": 4}) as run:
|
50
|
+
for x in range(run.config.epochs):
|
51
|
+
# train
|
52
52
|
```
|
53
53
|
|
54
|
-
Nested
|
54
|
+
Nested values
|
55
55
|
```
|
56
|
-
wandb.config
|
57
|
-
|
58
|
-
|
59
|
-
# train
|
56
|
+
with wandb.init(config={"train": {"epochs": 4}}) as run:
|
57
|
+
for x in range(run.config["train"]["epochs"]):
|
58
|
+
# train
|
60
59
|
```
|
61
60
|
|
62
61
|
Using absl flags
|
63
62
|
```
|
64
63
|
flags.DEFINE_string("model", None, "model to run") # name, default, help
|
65
|
-
wandb.
|
64
|
+
with wandb.init() as run:
|
65
|
+
run.config.update(flags.FLAGS) # adds all absl flags to config
|
66
66
|
```
|
67
67
|
|
68
68
|
Argparse flags
|
69
69
|
```python
|
70
|
-
wandb.init()
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
args = parser.parse_args()
|
83
|
-
wandb.config.update(args)
|
70
|
+
with wandb.init(config={"epochs": 4}) as run:
|
71
|
+
parser = argparse.ArgumentParser()
|
72
|
+
parser.add_argument(
|
73
|
+
"-b",
|
74
|
+
"--batch-size",
|
75
|
+
type=int,
|
76
|
+
default=8,
|
77
|
+
metavar="N",
|
78
|
+
help="input batch size for training (default: 8)",
|
79
|
+
)
|
80
|
+
args = parser.parse_args()
|
81
|
+
run.config.update(args)
|
84
82
|
```
|
85
83
|
|
86
84
|
Using TensorFlow flags (deprecated in tensorflow v2)
|
@@ -88,7 +86,9 @@ class Config:
|
|
88
86
|
flags = tf.app.flags
|
89
87
|
flags.DEFINE_string("data_dir", "/tmp/data")
|
90
88
|
flags.DEFINE_integer("batch_size", 128, "Batch size.")
|
91
|
-
|
89
|
+
|
90
|
+
with wandb.init() as run:
|
91
|
+
run.config.update(flags.FLAGS)
|
92
92
|
```
|
93
93
|
"""
|
94
94
|
|
@@ -298,7 +298,8 @@ class Config:
|
|
298
298
|
# best if we don't allow nested artifacts until we can lock nested keys in the config
|
299
299
|
if isinstance(v, dict) and check_dict_contains_nested_artifact(v, nested):
|
300
300
|
raise ValueError(
|
301
|
-
"Instances of wandb.Artifact can only be top level keys in
|
301
|
+
"Instances of wandb.Artifact can only be top level keys in"
|
302
|
+
" a run's config"
|
302
303
|
)
|
303
304
|
|
304
305
|
|
@@ -307,10 +308,10 @@ class ConfigStatic:
|
|
307
308
|
object.__setattr__(self, "__dict__", dict(config))
|
308
309
|
|
309
310
|
def __setattr__(self, name, value):
|
310
|
-
raise AttributeError("Error:
|
311
|
+
raise AttributeError("Error: run.config_static is a readonly object")
|
311
312
|
|
312
313
|
def __setitem__(self, key, val):
|
313
|
-
raise AttributeError("Error:
|
314
|
+
raise AttributeError("Error: run.config_static is a readonly object")
|
314
315
|
|
315
316
|
def keys(self):
|
316
317
|
return self.__dict__.keys()
|