wandb 0.15.9__py3-none-any.whl → 0.15.11__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +5 -1
- wandb/apis/public.py +137 -17
- wandb/apis/reports/_panels.py +1 -1
- wandb/apis/reports/blocks.py +1 -0
- wandb/apis/reports/report.py +27 -5
- wandb/cli/cli.py +52 -41
- wandb/docker/__init__.py +17 -0
- wandb/docker/auth.py +1 -1
- wandb/env.py +24 -4
- wandb/filesync/step_checksum.py +3 -3
- wandb/integration/openai/openai.py +3 -0
- wandb/integration/ultralytics/__init__.py +9 -0
- wandb/integration/ultralytics/bbox_utils.py +196 -0
- wandb/integration/ultralytics/callback.py +458 -0
- wandb/integration/ultralytics/classification_utils.py +66 -0
- wandb/integration/ultralytics/mask_utils.py +141 -0
- wandb/integration/ultralytics/pose_utils.py +92 -0
- wandb/integration/xgboost/xgboost.py +3 -3
- wandb/integration/yolov8/__init__.py +0 -7
- wandb/integration/yolov8/yolov8.py +22 -3
- wandb/old/settings.py +7 -0
- wandb/plot/line_series.py +0 -1
- wandb/proto/v3/wandb_internal_pb2.py +353 -300
- wandb/proto/v3/wandb_server_pb2.py +37 -41
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +16 -16
- wandb/proto/v4/wandb_internal_pb2.py +272 -260
- wandb/proto/v4/wandb_server_pb2.py +37 -40
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +16 -16
- wandb/proto/wandb_internal_codegen.py +7 -31
- wandb/sdk/artifacts/artifact.py +321 -189
- wandb/sdk/artifacts/artifact_cache.py +14 -0
- wandb/sdk/artifacts/artifact_manifest.py +5 -4
- wandb/sdk/artifacts/artifact_manifest_entry.py +37 -9
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -9
- wandb/sdk/artifacts/artifact_saver.py +13 -50
- wandb/sdk/artifacts/artifact_ttl.py +6 -0
- wandb/sdk/artifacts/artifacts_cache.py +119 -93
- wandb/sdk/artifacts/staging.py +25 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +12 -7
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +2 -3
- wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
- wandb/sdk/artifacts/storage_policies/register.py +1 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +4 -3
- wandb/sdk/artifacts/storage_policy.py +4 -2
- wandb/sdk/backend/backend.py +0 -16
- wandb/sdk/data_types/image.py +3 -1
- wandb/sdk/integration_utils/auto_logging.py +38 -13
- wandb/sdk/interface/interface.py +16 -135
- wandb/sdk/interface/interface_shared.py +9 -147
- wandb/sdk/interface/interface_sock.py +0 -26
- wandb/sdk/internal/file_pusher.py +20 -3
- wandb/sdk/internal/file_stream.py +3 -1
- wandb/sdk/internal/handler.py +53 -70
- wandb/sdk/internal/internal_api.py +220 -130
- wandb/sdk/internal/job_builder.py +41 -37
- wandb/sdk/internal/sender.py +7 -25
- wandb/sdk/internal/system/assets/disk.py +144 -11
- wandb/sdk/internal/system/system_info.py +6 -2
- wandb/sdk/launch/__init__.py +5 -0
- wandb/sdk/launch/{launch.py → _launch.py} +53 -54
- wandb/sdk/launch/{launch_add.py → _launch_add.py} +34 -31
- wandb/sdk/launch/_project_spec.py +13 -2
- wandb/sdk/launch/agent/agent.py +103 -59
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +6 -4
- wandb/sdk/launch/builder/build.py +19 -1
- wandb/sdk/launch/builder/docker_builder.py +5 -1
- wandb/sdk/launch/builder/kaniko_builder.py +5 -1
- wandb/sdk/launch/create_job.py +20 -5
- wandb/sdk/launch/loader.py +14 -5
- wandb/sdk/launch/runner/abstract.py +0 -2
- wandb/sdk/launch/runner/kubernetes_monitor.py +329 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +66 -209
- wandb/sdk/launch/runner/local_container.py +5 -2
- wandb/sdk/launch/runner/local_process.py +4 -1
- wandb/sdk/launch/sweeps/scheduler.py +43 -25
- wandb/sdk/launch/sweeps/utils.py +5 -3
- wandb/sdk/launch/utils.py +3 -1
- wandb/sdk/lib/_settings_toposort_generate.py +3 -9
- wandb/sdk/lib/_settings_toposort_generated.py +27 -3
- wandb/sdk/lib/_wburls_generated.py +1 -0
- wandb/sdk/lib/filenames.py +27 -6
- wandb/sdk/lib/filesystem.py +181 -7
- wandb/sdk/lib/fsm.py +5 -3
- wandb/sdk/lib/gql_request.py +3 -0
- wandb/sdk/lib/ipython.py +7 -0
- wandb/sdk/lib/wburls.py +1 -0
- wandb/sdk/service/port_file.py +2 -15
- wandb/sdk/service/server.py +7 -55
- wandb/sdk/service/service.py +56 -26
- wandb/sdk/service/service_base.py +1 -1
- wandb/sdk/service/streams.py +11 -5
- wandb/sdk/verify/verify.py +2 -2
- wandb/sdk/wandb_init.py +8 -2
- wandb/sdk/wandb_manager.py +4 -14
- wandb/sdk/wandb_run.py +143 -53
- wandb/sdk/wandb_settings.py +148 -35
- wandb/testing/relay.py +85 -38
- wandb/util.py +87 -4
- wandb/wandb_torch.py +24 -38
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/METADATA +48 -23
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/RECORD +107 -103
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/WHEEL +1 -1
- wandb/proto/v3/wandb_server_pb2_grpc.py +0 -1422
- wandb/proto/v4/wandb_server_pb2_grpc.py +0 -1422
- wandb/proto/wandb_server_pb2_grpc.py +0 -8
- wandb/sdk/artifacts/storage_policies/s3_bucket_policy.py +0 -61
- wandb/sdk/interface/interface_grpc.py +0 -460
- wandb/sdk/service/server_grpc.py +0 -444
- wandb/sdk/service/service_grpc.py +0 -73
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/LICENSE +0 -0
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/entry_points.txt +0 -0
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/top_level.txt +0 -0
wandb/sdk/service/service.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
"""Reliably launch and connect to backend server process (wandb service).
|
2
2
|
|
3
|
-
Backend server process can be connected to using tcp sockets
|
3
|
+
Backend server process can be connected to using tcp sockets transport.
|
4
4
|
"""
|
5
|
-
|
5
|
+
import datetime
|
6
6
|
import os
|
7
|
+
import pathlib
|
7
8
|
import platform
|
8
9
|
import shutil
|
9
10
|
import subprocess
|
@@ -12,7 +13,8 @@ import tempfile
|
|
12
13
|
import time
|
13
14
|
from typing import TYPE_CHECKING, Any, Dict, Optional
|
14
15
|
|
15
|
-
from wandb import _sentry
|
16
|
+
from wandb import _minimum_nexus_version, _sentry, termlog
|
17
|
+
from wandb.env import error_reporting_enabled
|
16
18
|
from wandb.errors import Error
|
17
19
|
from wandb.util import get_module
|
18
20
|
|
@@ -42,13 +44,22 @@ class ServiceStartPortError(Error):
|
|
42
44
|
pass
|
43
45
|
|
44
46
|
|
47
|
+
def _check_nexus_version_compatibility(nexus_version: str) -> None:
|
48
|
+
"""Checks if the installed nexus version is compatible with the wandb version."""
|
49
|
+
from pkg_resources import parse_version
|
50
|
+
|
51
|
+
if parse_version(nexus_version) < parse_version(_minimum_nexus_version):
|
52
|
+
raise ImportError(
|
53
|
+
f"Requires wandb-core version {_minimum_nexus_version} or later, "
|
54
|
+
f"but you have {nexus_version}. Run `pip install --upgrade wandb[nexus]` to upgrade."
|
55
|
+
)
|
56
|
+
|
57
|
+
|
45
58
|
class _Service:
|
46
59
|
_settings: "Settings"
|
47
|
-
_grpc_port: Optional[int]
|
48
60
|
_sock_port: Optional[int]
|
49
61
|
_service_interface: ServiceInterface
|
50
62
|
_internal_proc: Optional[subprocess.Popen]
|
51
|
-
_use_grpc: bool
|
52
63
|
_startup_debug_enabled: bool
|
53
64
|
|
54
65
|
def __init__(
|
@@ -57,25 +68,15 @@ class _Service:
|
|
57
68
|
) -> None:
|
58
69
|
self._settings = settings
|
59
70
|
self._stub = None
|
60
|
-
self._grpc_port = None
|
61
71
|
self._sock_port = None
|
62
72
|
self._internal_proc = None
|
63
73
|
self._startup_debug_enabled = _startup_debug.is_enabled()
|
64
74
|
|
65
75
|
_sentry.configure_scope(tags=dict(settings), process_context="service")
|
66
76
|
|
67
|
-
#
|
68
|
-
# that code from rotting during the transition
|
69
|
-
self._use_grpc = self._settings._service_transport == "grpc"
|
70
|
-
|
71
|
-
# current code only supports grpc or socket server implementation, in the
|
77
|
+
# current code only supports socket server implementation, in the
|
72
78
|
# future we might be able to support both
|
73
|
-
|
74
|
-
from .service_grpc import ServiceGrpcInterface
|
75
|
-
|
76
|
-
self._service_interface = ServiceGrpcInterface()
|
77
|
-
else:
|
78
|
-
self._service_interface = ServiceSockInterface()
|
79
|
+
self._service_interface = ServiceSockInterface()
|
79
80
|
|
80
81
|
def _startup_debug_print(self, message: str) -> None:
|
81
82
|
if not self._startup_debug_enabled:
|
@@ -130,7 +131,6 @@ class _Service:
|
|
130
131
|
if not pf.is_valid:
|
131
132
|
time.sleep(0.2)
|
132
133
|
continue
|
133
|
-
self._grpc_port = pf.grpc_port
|
134
134
|
self._sock_port = pf.sock_port
|
135
135
|
except Exception as e:
|
136
136
|
# todo: point at the docs. this could be due to a number of reasons,
|
@@ -186,8 +186,11 @@ class _Service:
|
|
186
186
|
"wandb_core",
|
187
187
|
required="The nexus experiment requires the wandb_core module.",
|
188
188
|
)
|
189
|
+
_check_nexus_version_compatibility(wandb_nexus.__version__)
|
189
190
|
nexus_path = wandb_nexus.get_nexus_path()
|
190
191
|
service_args.extend([nexus_path])
|
192
|
+
if not error_reporting_enabled():
|
193
|
+
service_args.append("--no-observability")
|
191
194
|
exec_cmd_list = []
|
192
195
|
else:
|
193
196
|
service_args.extend(["wandb", "service"])
|
@@ -199,10 +202,40 @@ class _Service:
|
|
199
202
|
pid,
|
200
203
|
"--debug",
|
201
204
|
]
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
205
|
+
service_args.append("--serve-sock")
|
206
|
+
|
207
|
+
if os.environ.get("WANDB_SERVICE_PROFILE") == "memray":
|
208
|
+
_ = get_module(
|
209
|
+
"memray",
|
210
|
+
required=(
|
211
|
+
"wandb service memory profiling requires memray, "
|
212
|
+
"install with `pip install memray`"
|
213
|
+
),
|
214
|
+
)
|
215
|
+
|
216
|
+
time_tag = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
217
|
+
output_file = f"wandb_service.memray.{time_tag}.bin"
|
218
|
+
cli_executable = (
|
219
|
+
pathlib.Path(__file__).parent.parent.parent.parent
|
220
|
+
/ "tools"
|
221
|
+
/ "cli.py"
|
222
|
+
)
|
223
|
+
exec_cmd_list = [
|
224
|
+
executable,
|
225
|
+
"-m",
|
226
|
+
"memray",
|
227
|
+
"run",
|
228
|
+
"-o",
|
229
|
+
output_file,
|
230
|
+
]
|
231
|
+
service_args[0] = str(cli_executable)
|
232
|
+
termlog(
|
233
|
+
f"wandb service memory profiling enabled, output file: {output_file}"
|
234
|
+
)
|
235
|
+
termlog(
|
236
|
+
f"Convert to flamegraph with: `python -m memray flamegraph {output_file}`"
|
237
|
+
)
|
238
|
+
|
206
239
|
try:
|
207
240
|
internal_proc = subprocess.Popen(
|
208
241
|
exec_cmd_list + service_args,
|
@@ -211,6 +244,7 @@ class _Service:
|
|
211
244
|
)
|
212
245
|
except Exception as e:
|
213
246
|
_sentry.reraise(e)
|
247
|
+
|
214
248
|
self._startup_debug_print("wait_ports")
|
215
249
|
try:
|
216
250
|
self._wait_for_ports(fname, proc=internal_proc)
|
@@ -223,10 +257,6 @@ class _Service:
|
|
223
257
|
def start(self) -> None:
|
224
258
|
self._launch_server()
|
225
259
|
|
226
|
-
@property
|
227
|
-
def grpc_port(self) -> Optional[int]:
|
228
|
-
return self._grpc_port
|
229
|
-
|
230
260
|
@property
|
231
261
|
def sock_port(self) -> Optional[int]:
|
232
262
|
return self._sock_port
|
wandb/sdk/service/streams.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
StreamThread: Thread that runs internal.wandb_internal()
|
4
4
|
StreamRecord: All the external state for the internal thread (queues, etc)
|
5
|
-
StreamAction: Lightweight record for stream ops for thread safety
|
5
|
+
StreamAction: Lightweight record for stream ops for thread safety
|
6
6
|
StreamMux: Container for dictionary of stream threads per runid
|
7
7
|
"""
|
8
8
|
import functools
|
@@ -321,6 +321,11 @@ class StreamMux:
|
|
321
321
|
server_info_handle = stream.interface.deliver_request_server_info()
|
322
322
|
final_summary_handle = stream.interface.deliver_get_summary()
|
323
323
|
sampled_history_handle = stream.interface.deliver_request_sampled_history()
|
324
|
+
internal_messages_handle = stream.interface.deliver_internal_messages()
|
325
|
+
|
326
|
+
result = internal_messages_handle.wait(timeout=-1)
|
327
|
+
assert result
|
328
|
+
internal_messages_response = result.response.internal_messages_response
|
324
329
|
job_info_handle = stream.interface.deliver_request_job_info()
|
325
330
|
|
326
331
|
# wait for them, it's ok to do this serially but this can be improved
|
@@ -345,10 +350,11 @@ class StreamMux:
|
|
345
350
|
job_info = result.response.job_info_response
|
346
351
|
|
347
352
|
Run._footer(
|
348
|
-
sampled_history,
|
349
|
-
final_summary,
|
350
|
-
poll_exit_response,
|
351
|
-
server_info_response,
|
353
|
+
sampled_history=sampled_history,
|
354
|
+
final_summary=final_summary,
|
355
|
+
poll_exit_response=poll_exit_response,
|
356
|
+
server_info_response=server_info_response,
|
357
|
+
internal_messages_response=internal_messages_response,
|
352
358
|
job_info=job_info,
|
353
359
|
settings=stream._settings, # type: ignore
|
354
360
|
printer=printer,
|
wandb/sdk/verify/verify.py
CHANGED
@@ -314,7 +314,7 @@ def check_artifacts() -> bool:
|
|
314
314
|
# test checksum
|
315
315
|
sing_art_dir = "./verify_sing_art"
|
316
316
|
alias = "sing_art1"
|
317
|
-
name = "sing-artys"
|
317
|
+
name = nice_id("sing-artys")
|
318
318
|
singular_art = artifact_with_path_or_paths(name, singular=True)
|
319
319
|
cont_test, download_artifact, failed_test_strings = log_use_download_artifact(
|
320
320
|
singular_art, alias, name, sing_art_dir, failed_test_strings, False
|
@@ -332,7 +332,7 @@ def check_artifacts() -> bool:
|
|
332
332
|
# test manifest and digest
|
333
333
|
multi_art_dir = "./verify_art"
|
334
334
|
alias = "art1"
|
335
|
-
name = "my-artys"
|
335
|
+
name = nice_id("my-artys")
|
336
336
|
art1 = artifact_with_path_or_paths(name, "./verify_art_dir", singular=False)
|
337
337
|
cont_test, download_artifact, failed_test_strings = log_use_download_artifact(
|
338
338
|
art1, alias, name, multi_art_dir, failed_test_strings, True
|
wandb/sdk/wandb_init.py
CHANGED
@@ -136,6 +136,8 @@ class _WandbInit:
|
|
136
136
|
|
137
137
|
self.deprecated_features_used: Dict[str, str] = dict()
|
138
138
|
|
139
|
+
self._require_nexus = os.environ.get("WANDB_REQUIRE_NEXUS") == "True"
|
140
|
+
|
139
141
|
def _setup_printer(self, settings: Settings) -> None:
|
140
142
|
if self.printer:
|
141
143
|
return
|
@@ -427,7 +429,8 @@ class _WandbInit:
|
|
427
429
|
return None
|
428
430
|
|
429
431
|
# Attempt to save the code on every execution
|
430
|
-
|
432
|
+
# todo(nexus): remove nexus check once incremental artifact is supported
|
433
|
+
if not self._require_nexus and self.notebook.save_ipynb(): # type: ignore
|
431
434
|
assert self.run is not None
|
432
435
|
res = self.run.log_code(root=None)
|
433
436
|
logger.info("saved code: %s", res) # type: ignore
|
@@ -445,7 +448,8 @@ class _WandbInit:
|
|
445
448
|
assert self.notebook
|
446
449
|
ipython = self.notebook.shell
|
447
450
|
self.notebook.save_history()
|
448
|
-
|
451
|
+
# todo(nexus): remove nexus check once incremental artifact is supported
|
452
|
+
if not self._require_nexus and self.notebook.save_ipynb():
|
449
453
|
assert self.run is not None
|
450
454
|
res = self.run.log_code(root=None)
|
451
455
|
logger.info("saved code and history: %s", res) # type: ignore
|
@@ -571,6 +575,7 @@ class _WandbInit:
|
|
571
575
|
logger.info(
|
572
576
|
f"wandb.init called with sweep_config: {self.sweep_config}\nconfig: {self.config}"
|
573
577
|
)
|
578
|
+
|
574
579
|
if self.settings._noop:
|
575
580
|
return self._make_run_disabled()
|
576
581
|
if self.settings.reinit or (
|
@@ -636,6 +641,7 @@ class _WandbInit:
|
|
636
641
|
with telemetry.context(run=run, obj=self._init_telemetry_obj) as tel:
|
637
642
|
tel.cli_version = wandb.__version__
|
638
643
|
tel.python_version = platform.python_version()
|
644
|
+
tel.platform = f"{platform.system()}-{platform.machine()}".lower()
|
639
645
|
hf_version = _huggingface_version()
|
640
646
|
if hf_version:
|
641
647
|
tel.huggingface_version = hf_version
|
wandb/sdk/wandb_manager.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"""Manage wandb processes.
|
2
2
|
|
3
|
-
Create a
|
3
|
+
Create a manager channel.
|
4
4
|
"""
|
5
5
|
|
6
6
|
import atexit
|
@@ -35,7 +35,7 @@ class ManagerConnectionRefusedError(ManagerConnectionError):
|
|
35
35
|
|
36
36
|
class _ManagerToken:
|
37
37
|
_version = "2"
|
38
|
-
_supported_transports = {"
|
38
|
+
_supported_transports = {"tcp"}
|
39
39
|
_token_str: str
|
40
40
|
_pid: int
|
41
41
|
_transport: str
|
@@ -126,7 +126,6 @@ class _Manager:
|
|
126
126
|
raise ManagerConnectionError(f"Connection to wandb service failed: {e}")
|
127
127
|
|
128
128
|
def __init__(self, settings: "Settings") -> None:
|
129
|
-
# TODO: warn if user doesn't have grpc installed
|
130
129
|
from wandb.sdk.service import service
|
131
130
|
|
132
131
|
self._settings = settings
|
@@ -134,21 +133,12 @@ class _Manager:
|
|
134
133
|
self._hooks = None
|
135
134
|
|
136
135
|
self._service = service._Service(settings=self._settings)
|
137
|
-
|
138
|
-
# Temporary setting to allow use of grpc so that we can keep
|
139
|
-
# that code from rotting during the transition
|
140
|
-
use_grpc = self._settings._service_transport == "grpc"
|
141
|
-
|
142
136
|
token = _ManagerToken.from_environment()
|
143
137
|
if not token:
|
144
138
|
self._service.start()
|
145
139
|
host = "localhost"
|
146
|
-
|
147
|
-
|
148
|
-
port = self._service.grpc_port
|
149
|
-
else:
|
150
|
-
transport = "tcp"
|
151
|
-
port = self._service.sock_port
|
140
|
+
transport = "tcp"
|
141
|
+
port = self._service.sock_port
|
152
142
|
assert port
|
153
143
|
token = _ManagerToken.from_params(transport=transport, host=host, port=port)
|
154
144
|
token.set_environment()
|