wandb 0.19.2__py3-none-macosx_11_0_arm64.whl → 0.19.4__py3-none-macosx_11_0_arm64.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 -1
- wandb/__init__.pyi +13 -3
- wandb/bin/gpu_stats +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/integration/metaflow/metaflow.py +7 -9
- wandb/sdk/backend/backend.py +7 -11
- wandb/sdk/interface/interface.py +28 -20
- wandb/sdk/interface/interface_sock.py +7 -11
- wandb/sdk/internal/tb_watcher.py +3 -1
- wandb/sdk/lib/service_connection.py +2 -2
- wandb/sdk/wandb_init.py +395 -240
- wandb/sdk/wandb_run.py +12 -20
- wandb/sdk/wandb_settings.py +2 -27
- {wandb-0.19.2.dist-info → wandb-0.19.4.dist-info}/METADATA +1 -1
- {wandb-0.19.2.dist-info → wandb-0.19.4.dist-info}/RECORD +18 -18
- {wandb-0.19.2.dist-info → wandb-0.19.4.dist-info}/WHEEL +0 -0
- {wandb-0.19.2.dist-info → wandb-0.19.4.dist-info}/entry_points.txt +0 -0
- {wandb-0.19.2.dist-info → wandb-0.19.4.dist-info}/licenses/LICENSE +0 -0
wandb/__init__.py
CHANGED
wandb/__init__.pyi
CHANGED
@@ -103,7 +103,7 @@ if TYPE_CHECKING:
|
|
103
103
|
import wandb
|
104
104
|
from wandb.plot import CustomChart
|
105
105
|
|
106
|
-
__version__: str = "0.19.
|
106
|
+
__version__: str = "0.19.4"
|
107
107
|
|
108
108
|
run: Run | None
|
109
109
|
config: wandb_config.Config
|
@@ -651,7 +651,12 @@ def log(
|
|
651
651
|
run = wandb.init()
|
652
652
|
examples = []
|
653
653
|
for i in range(3):
|
654
|
-
pixels = np.random.randint(
|
654
|
+
pixels = np.random.randint(
|
655
|
+
low=0,
|
656
|
+
high=256,
|
657
|
+
size=(100, 100, 3),
|
658
|
+
dtype=np.uint8,
|
659
|
+
)
|
655
660
|
pil_image = PILImage.fromarray(pixels, mode="RGB")
|
656
661
|
image = wandb.Image(pil_image, caption=f"random field {i}")
|
657
662
|
examples.append(image)
|
@@ -666,7 +671,12 @@ def log(
|
|
666
671
|
|
667
672
|
run = wandb.init()
|
668
673
|
# axes are (time, channel, height, width)
|
669
|
-
frames = np.random.randint(
|
674
|
+
frames = np.random.randint(
|
675
|
+
low=0,
|
676
|
+
high=256,
|
677
|
+
size=(10, 3, 100, 100),
|
678
|
+
dtype=np.uint8,
|
679
|
+
)
|
670
680
|
run.log({"video": wandb.Video(frames, fps=4)})
|
671
681
|
```
|
672
682
|
|
wandb/bin/gpu_stats
CHANGED
Binary file
|
wandb/bin/wandb-core
CHANGED
Binary file
|
@@ -328,15 +328,13 @@ def wandb_log(
|
|
328
328
|
if not isinstance(settings, wandb.sdk.wandb_settings.Settings):
|
329
329
|
settings = wandb.Settings()
|
330
330
|
|
331
|
-
settings.
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
run_job_type=coalesce(settings.run_job_type, current.step_name),
|
339
|
-
source=wandb.sdk.wandb_settings.Source.INIT,
|
331
|
+
settings.update_from_dict(
|
332
|
+
{
|
333
|
+
"run_group": coalesce(
|
334
|
+
settings.run_group, f"{current.flow_name}/{current.run_id}"
|
335
|
+
),
|
336
|
+
"run_job_type": coalesce(settings.run_job_type, current.step_name),
|
337
|
+
}
|
340
338
|
)
|
341
339
|
|
342
340
|
with wandb.init(settings=settings) as run:
|
wandb/sdk/backend/backend.py
CHANGED
@@ -25,8 +25,6 @@ if TYPE_CHECKING:
|
|
25
25
|
from wandb.proto.wandb_internal_pb2 import Record, Result
|
26
26
|
from wandb.sdk.lib import service_connection
|
27
27
|
|
28
|
-
from ..wandb_run import Run
|
29
|
-
|
30
28
|
RecordQueue = Union["queue.Queue[Record]", multiprocessing.Queue[Record]]
|
31
29
|
ResultQueue = Union["queue.Queue[Result]", multiprocessing.Queue[Result]]
|
32
30
|
|
@@ -54,7 +52,7 @@ class Backend:
|
|
54
52
|
interface: Optional[InterfaceBase]
|
55
53
|
_internal_pid: Optional[int]
|
56
54
|
wandb_process: Optional[multiprocessing.process.BaseProcess]
|
57
|
-
_settings:
|
55
|
+
_settings: Settings
|
58
56
|
record_q: Optional["RecordQueue"]
|
59
57
|
result_q: Optional["ResultQueue"]
|
60
58
|
_mailbox: Mailbox
|
@@ -62,7 +60,7 @@ class Backend:
|
|
62
60
|
def __init__(
|
63
61
|
self,
|
64
62
|
mailbox: Mailbox,
|
65
|
-
settings:
|
63
|
+
settings: Settings,
|
66
64
|
log_level: Optional[int] = None,
|
67
65
|
service: "Optional[service_connection.ServiceConnection]" = None,
|
68
66
|
) -> None:
|
@@ -84,12 +82,7 @@ class Backend:
|
|
84
82
|
self._save_mod_path: Optional[str] = None
|
85
83
|
self._save_mod_spec = None
|
86
84
|
|
87
|
-
def _hack_set_run(self, run: "Run") -> None:
|
88
|
-
assert self.interface
|
89
|
-
self.interface._hack_set_run(run)
|
90
|
-
|
91
85
|
def _multiprocessing_setup(self) -> None:
|
92
|
-
assert self._settings
|
93
86
|
if self._settings.start_method == "thread":
|
94
87
|
return
|
95
88
|
|
@@ -141,10 +134,13 @@ class Backend:
|
|
141
134
|
def ensure_launched(self) -> None:
|
142
135
|
"""Launch backend worker if not running."""
|
143
136
|
if self._service:
|
144
|
-
|
137
|
+
assert self._settings.run_id
|
138
|
+
self.interface = self._service.make_interface(
|
139
|
+
self._mailbox,
|
140
|
+
stream_id=self._settings.run_id,
|
141
|
+
)
|
145
142
|
return
|
146
143
|
|
147
|
-
assert self._settings
|
148
144
|
settings = self._settings.model_copy()
|
149
145
|
settings.x_log_level = self._log_level or logging.DEBUG
|
150
146
|
|
wandb/sdk/interface/interface.py
CHANGED
@@ -10,7 +10,6 @@ InterfaceRelay: Responses are routed to a relay queue (not matching uuids)
|
|
10
10
|
|
11
11
|
import gzip
|
12
12
|
import logging
|
13
|
-
import os
|
14
13
|
import time
|
15
14
|
from abc import abstractmethod
|
16
15
|
from pathlib import Path
|
@@ -91,18 +90,11 @@ def file_enum_to_policy(enum: "pb.FilesItem.PolicyType.V") -> "PolicyName":
|
|
91
90
|
|
92
91
|
|
93
92
|
class InterfaceBase:
|
94
|
-
_run: Optional["Run"]
|
95
93
|
_drop: bool
|
96
94
|
|
97
95
|
def __init__(self) -> None:
|
98
|
-
self._run = None
|
99
96
|
self._drop = False
|
100
97
|
|
101
|
-
def _hack_set_run(self, run: "Run") -> None:
|
102
|
-
self._run = run
|
103
|
-
current_pid = os.getpid()
|
104
|
-
self._run._set_iface_pid(current_pid)
|
105
|
-
|
106
98
|
def publish_header(self) -> None:
|
107
99
|
header = pb.HeaderRecord()
|
108
100
|
self._publish_header(header)
|
@@ -235,7 +227,12 @@ class InterfaceBase:
|
|
235
227
|
update.value_json = json.dumps(v)
|
236
228
|
return summary
|
237
229
|
|
238
|
-
def _summary_encode(
|
230
|
+
def _summary_encode(
|
231
|
+
self,
|
232
|
+
value: Any,
|
233
|
+
path_from_root: str,
|
234
|
+
run: "Run",
|
235
|
+
) -> dict:
|
239
236
|
"""Normalize, compress, and encode sub-objects for backend storage.
|
240
237
|
|
241
238
|
value: Object to encode.
|
@@ -253,12 +250,14 @@ class InterfaceBase:
|
|
253
250
|
json_value = {}
|
254
251
|
for key, value in value.items(): # noqa: B020
|
255
252
|
json_value[key] = self._summary_encode(
|
256
|
-
value,
|
253
|
+
value,
|
254
|
+
path_from_root + "." + key,
|
255
|
+
run=run,
|
257
256
|
)
|
258
257
|
return json_value
|
259
258
|
else:
|
260
259
|
friendly_value, converted = json_friendly(
|
261
|
-
val_to_json(
|
260
|
+
val_to_json(run, path_from_root, value, namespace="summary")
|
262
261
|
)
|
263
262
|
json_value, compressed = maybe_compress_summary(
|
264
263
|
friendly_value, get_h5_typename(value)
|
@@ -270,7 +269,11 @@ class InterfaceBase:
|
|
270
269
|
|
271
270
|
return json_value
|
272
271
|
|
273
|
-
def _make_summary(
|
272
|
+
def _make_summary(
|
273
|
+
self,
|
274
|
+
summary_record: sr.SummaryRecord,
|
275
|
+
run: "Run",
|
276
|
+
) -> pb.SummaryRecord:
|
274
277
|
pb_summary_record = pb.SummaryRecord()
|
275
278
|
|
276
279
|
for item in summary_record.update:
|
@@ -285,7 +288,11 @@ class InterfaceBase:
|
|
285
288
|
pb_summary_item.key = item.key[0]
|
286
289
|
|
287
290
|
path_from_root = ".".join(item.key)
|
288
|
-
json_value = self._summary_encode(
|
291
|
+
json_value = self._summary_encode(
|
292
|
+
item.value,
|
293
|
+
path_from_root,
|
294
|
+
run=run,
|
295
|
+
)
|
289
296
|
json_value, _ = json_friendly(json_value) # type: ignore
|
290
297
|
|
291
298
|
pb_summary_item.value_json = json.dumps(
|
@@ -306,8 +313,12 @@ class InterfaceBase:
|
|
306
313
|
|
307
314
|
return pb_summary_record
|
308
315
|
|
309
|
-
def publish_summary(
|
310
|
-
|
316
|
+
def publish_summary(
|
317
|
+
self,
|
318
|
+
run: "Run",
|
319
|
+
summary_record: sr.SummaryRecord,
|
320
|
+
) -> None:
|
321
|
+
pb_summary_record = self._make_summary(summary_record, run=run)
|
311
322
|
self._publish_summary(pb_summary_record)
|
312
323
|
|
313
324
|
@abstractmethod
|
@@ -653,15 +664,13 @@ class InterfaceBase:
|
|
653
664
|
|
654
665
|
def publish_partial_history(
|
655
666
|
self,
|
667
|
+
run: "Run",
|
656
668
|
data: dict,
|
657
669
|
user_step: int,
|
658
670
|
step: Optional[int] = None,
|
659
671
|
flush: Optional[bool] = None,
|
660
672
|
publish_step: bool = True,
|
661
|
-
run: Optional["Run"] = None,
|
662
673
|
) -> None:
|
663
|
-
run = run or self._run
|
664
|
-
|
665
674
|
data = history_dict_to_json(run, data, step=user_step, ignore_copy_err=True)
|
666
675
|
data.pop("_step", None)
|
667
676
|
|
@@ -688,12 +697,11 @@ class InterfaceBase:
|
|
688
697
|
|
689
698
|
def publish_history(
|
690
699
|
self,
|
700
|
+
run: "Run",
|
691
701
|
data: dict,
|
692
702
|
step: Optional[int] = None,
|
693
|
-
run: Optional["Run"] = None,
|
694
703
|
publish_step: bool = True,
|
695
704
|
) -> None:
|
696
|
-
run = run or self._run
|
697
705
|
data = history_dict_to_json(run, data, step=step)
|
698
706
|
history = pb.HistoryRecord()
|
699
707
|
if publish_step:
|
@@ -16,32 +16,28 @@ from .router_sock import MessageSockRouter
|
|
16
16
|
if TYPE_CHECKING:
|
17
17
|
from wandb.proto import wandb_internal_pb2 as pb
|
18
18
|
|
19
|
-
from ..wandb_run import Run
|
20
|
-
|
21
19
|
|
22
20
|
logger = logging.getLogger("wandb")
|
23
21
|
|
24
22
|
|
25
23
|
class InterfaceSock(InterfaceShared):
|
26
|
-
_stream_id: Optional[str]
|
27
|
-
_sock_client: SockClient
|
28
24
|
_mailbox: Mailbox
|
29
25
|
|
30
|
-
def __init__(
|
26
|
+
def __init__(
|
27
|
+
self,
|
28
|
+
sock_client: SockClient,
|
29
|
+
mailbox: Mailbox,
|
30
|
+
stream_id: str,
|
31
|
+
) -> None:
|
31
32
|
# _sock_client is used when abstract method _init_router() is called by constructor
|
32
33
|
self._sock_client = sock_client
|
33
34
|
super().__init__(mailbox=mailbox)
|
34
35
|
self._process_check = False
|
35
|
-
self._stream_id =
|
36
|
+
self._stream_id = stream_id
|
36
37
|
|
37
38
|
def _init_router(self) -> None:
|
38
39
|
self._router = MessageSockRouter(self._sock_client, mailbox=self._mailbox)
|
39
40
|
|
40
|
-
def _hack_set_run(self, run: "Run") -> None:
|
41
|
-
super()._hack_set_run(run)
|
42
|
-
assert run._settings.run_id
|
43
|
-
self._stream_id = run._settings.run_id
|
44
|
-
|
45
41
|
def _assign(self, record: Any) -> None:
|
46
42
|
assert self._stream_id
|
47
43
|
record._info.stream_id = self._stream_id
|
wandb/sdk/internal/tb_watcher.py
CHANGED
@@ -124,9 +124,9 @@ class ServiceConnection:
|
|
124
124
|
self._torn_down = False
|
125
125
|
self._cleanup = cleanup
|
126
126
|
|
127
|
-
def make_interface(self, mailbox: Mailbox) -> InterfaceBase:
|
127
|
+
def make_interface(self, mailbox: Mailbox, stream_id: str) -> InterfaceBase:
|
128
128
|
"""Returns an interface for communicating with the service."""
|
129
|
-
return InterfaceSock(self._client, mailbox)
|
129
|
+
return InterfaceSock(self._client, mailbox, stream_id=stream_id)
|
130
130
|
|
131
131
|
def send_record(self, record: pb.Record) -> None:
|
132
132
|
"""Sends data to the service."""
|