wandb 0.17.6__py3-none-win_amd64.whl → 0.17.8rc1__py3-none-win_amd64.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +3 -16
- wandb/__init__.pyi +964 -0
- wandb/agents/pyagent.py +1 -2
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +21 -0
- wandb/data_types.py +3 -3
- wandb/integration/kfp/wandb_logging.py +1 -1
- wandb/integration/lightning/fabric/logger.py +1 -1
- wandb/integration/openai/fine_tuning.py +13 -5
- wandb/integration/ultralytics/pose_utils.py +0 -1
- wandb/proto/v3/wandb_internal_pb2.py +24 -24
- wandb/proto/v4/wandb_internal_pb2.py +24 -24
- wandb/proto/v5/wandb_internal_pb2.py +24 -24
- wandb/sdk/artifacts/artifact.py +16 -18
- wandb/sdk/data_types/_dtypes.py +5 -5
- wandb/sdk/data_types/base_types/media.py +3 -1
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +3 -1
- wandb/sdk/data_types/helper_types/image_mask.py +3 -1
- wandb/sdk/data_types/image.py +3 -1
- wandb/sdk/data_types/saved_model.py +3 -1
- wandb/sdk/data_types/video.py +2 -2
- wandb/sdk/interface/interface.py +17 -16
- wandb/sdk/interface/interface_shared.py +6 -9
- wandb/sdk/internal/datastore.py +1 -1
- wandb/sdk/internal/handler.py +5 -3
- wandb/sdk/internal/internal.py +1 -1
- wandb/sdk/internal/job_builder.py +5 -2
- wandb/sdk/internal/tb_watcher.py +2 -2
- wandb/sdk/internal/update.py +2 -2
- wandb/sdk/launch/builder/kaniko_builder.py +13 -5
- wandb/sdk/launch/create_job.py +2 -0
- wandb/sdk/lib/apikey.py +1 -1
- wandb/sdk/service/streams.py +2 -4
- wandb/sdk/wandb_config.py +4 -1
- wandb/sdk/wandb_init.py +55 -7
- wandb/sdk/wandb_run.py +137 -92
- wandb/sdk/wandb_settings.py +13 -1
- wandb/sdk/wandb_setup.py +66 -3
- wandb/sdk/wandb_sweep.py +5 -2
- {wandb-0.17.6.dist-info → wandb-0.17.8rc1.dist-info}/METADATA +1 -1
- {wandb-0.17.6.dist-info → wandb-0.17.8rc1.dist-info}/RECORD +44 -43
- {wandb-0.17.6.dist-info → wandb-0.17.8rc1.dist-info}/WHEEL +0 -0
- {wandb-0.17.6.dist-info → wandb-0.17.8rc1.dist-info}/entry_points.txt +0 -0
- {wandb-0.17.6.dist-info → wandb-0.17.8rc1.dist-info}/licenses/LICENSE +0 -0
@@ -63,6 +63,13 @@ else:
|
|
63
63
|
NAMESPACE = "wandb"
|
64
64
|
|
65
65
|
|
66
|
+
def get_pod_name_safe(job: client.V1Job):
|
67
|
+
try:
|
68
|
+
return job.spec.template.metadata.name
|
69
|
+
except AttributeError:
|
70
|
+
return None
|
71
|
+
|
72
|
+
|
66
73
|
async def _wait_for_completion(
|
67
74
|
batch_client: client.BatchV1Api, job_name: str, deadline_secs: Optional[int] = None
|
68
75
|
) -> bool:
|
@@ -319,17 +326,18 @@ class KanikoBuilder(AbstractBuilder):
|
|
319
326
|
await self._create_docker_ecr_config_map(
|
320
327
|
build_job_name, core_v1, repo_uri
|
321
328
|
)
|
322
|
-
await batch_v1.create_namespaced_job(NAMESPACE, build_job)
|
323
|
-
|
329
|
+
k8s_job = await batch_v1.create_namespaced_job(NAMESPACE, build_job)
|
324
330
|
# wait for double the job deadline since it might take time to schedule
|
325
331
|
if not await _wait_for_completion(
|
326
332
|
batch_v1, build_job_name, 3 * _DEFAULT_BUILD_TIMEOUT_SECS
|
327
333
|
):
|
328
334
|
if job_tracker:
|
329
335
|
job_tracker.set_err_stage("build")
|
330
|
-
|
331
|
-
|
332
|
-
|
336
|
+
msg = f"Failed to build image in kaniko for job {run_id}."
|
337
|
+
pod_name = get_pod_name_safe(k8s_job)
|
338
|
+
if pod_name:
|
339
|
+
msg += f" View logs with `kubectl logs -n {NAMESPACE} {pod_name}`."
|
340
|
+
raise Exception(msg)
|
333
341
|
try:
|
334
342
|
pods_from_job = await core_v1.list_namespaced_pod(
|
335
343
|
namespace=NAMESPACE, label_selector=f"job-name={build_job_name}"
|
wandb/sdk/launch/create_job.py
CHANGED
@@ -114,6 +114,7 @@ def _create_job(
|
|
114
114
|
git_hash: Optional[str] = None,
|
115
115
|
build_context: Optional[str] = None,
|
116
116
|
dockerfile: Optional[str] = None,
|
117
|
+
base_image: Optional[str] = None,
|
117
118
|
) -> Tuple[Optional[Artifact], str, List[str]]:
|
118
119
|
wandb.termlog(f"Creating launch job of type: {job_type}...")
|
119
120
|
|
@@ -188,6 +189,7 @@ def _create_job(
|
|
188
189
|
api.api,
|
189
190
|
dockerfile=dockerfile,
|
190
191
|
build_context=build_context,
|
192
|
+
base_image=base_image,
|
191
193
|
)
|
192
194
|
if not artifact:
|
193
195
|
wandb.termerror("JobBuilder failed to build a job")
|
wandb/sdk/lib/apikey.py
CHANGED
@@ -107,7 +107,7 @@ def prompt_api_key( # noqa: C901
|
|
107
107
|
|
108
108
|
if jupyter and "google.colab" in sys.modules:
|
109
109
|
log_string = term.LOG_STRING_NOCOLOR
|
110
|
-
key = wandb.jupyter.attempt_colab_login(app_url)
|
110
|
+
key = wandb.jupyter.attempt_colab_login(app_url) # type: ignore
|
111
111
|
if key is not None:
|
112
112
|
write_key(settings, key, api=api)
|
113
113
|
return key # type: ignore
|
wandb/sdk/service/streams.py
CHANGED
@@ -81,9 +81,7 @@ class StreamRecord:
|
|
81
81
|
self._wait_thread_active()
|
82
82
|
|
83
83
|
def _wait_thread_active(self) -> None:
|
84
|
-
|
85
|
-
# TODO: using the default communicate timeout, is that enough? retries?
|
86
|
-
assert result
|
84
|
+
self._iface.deliver_status().wait(timeout=-1)
|
87
85
|
|
88
86
|
def join(self) -> None:
|
89
87
|
self._iface.join()
|
@@ -212,7 +210,7 @@ class StreamMux:
|
|
212
210
|
# run_id = action.stream_id # will want to fix if a streamid != runid
|
213
211
|
settings = action._data
|
214
212
|
thread = StreamThread(
|
215
|
-
target=wandb.wandb_sdk.internal.internal.wandb_internal,
|
213
|
+
target=wandb.wandb_sdk.internal.internal.wandb_internal, # type: ignore
|
216
214
|
kwargs=dict(
|
217
215
|
settings=settings,
|
218
216
|
record_q=stream._record_q,
|
wandb/sdk/wandb_config.py
CHANGED
@@ -61,7 +61,7 @@ class Config:
|
|
61
61
|
|
62
62
|
Using absl flags
|
63
63
|
```
|
64
|
-
flags.DEFINE_string(
|
64
|
+
flags.DEFINE_string("model", None, "model to run") # name, default, help
|
65
65
|
wandb.config.update(flags.FLAGS) # adds all absl flags to config
|
66
66
|
```
|
67
67
|
|
@@ -129,6 +129,9 @@ class Config:
|
|
129
129
|
def __getitem__(self, key):
|
130
130
|
return self._items[key]
|
131
131
|
|
132
|
+
def __iter__(self):
|
133
|
+
return iter(self._items)
|
134
|
+
|
132
135
|
def _check_locked(self, key, ignore_locked=False) -> bool:
|
133
136
|
locked = self._locked.get(key)
|
134
137
|
if locked is not None:
|
wandb/sdk/wandb_init.py
CHANGED
@@ -15,6 +15,7 @@ import os
|
|
15
15
|
import platform
|
16
16
|
import sys
|
17
17
|
import tempfile
|
18
|
+
import time
|
18
19
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union
|
19
20
|
|
20
21
|
import wandb
|
@@ -174,7 +175,9 @@ class _WandbInit:
|
|
174
175
|
# we add this logic to be backward compatible with the old behavior of disable
|
175
176
|
# where it would disable the service if the mode was set to disabled
|
176
177
|
mode = kwargs.get("mode")
|
177
|
-
settings_mode = (kwargs.get("settings") or {}).get("mode")
|
178
|
+
settings_mode = (kwargs.get("settings") or {}).get("mode") or os.environ.get(
|
179
|
+
"WANDB_MODE"
|
180
|
+
)
|
178
181
|
_disable_service = mode == "disabled" or settings_mode == "disabled"
|
179
182
|
setup_settings = {"_disable_service": _disable_service}
|
180
183
|
|
@@ -262,7 +265,7 @@ class _WandbInit:
|
|
262
265
|
|
263
266
|
monitor_gym = kwargs.pop("monitor_gym", None)
|
264
267
|
if monitor_gym and len(wandb.patched["gym"]) == 0:
|
265
|
-
wandb.gym.monitor()
|
268
|
+
wandb.gym.monitor() # type: ignore
|
266
269
|
|
267
270
|
if wandb.patched["tensorboard"]:
|
268
271
|
with telemetry.context(obj=self._init_telemetry_obj) as tel:
|
@@ -271,7 +274,7 @@ class _WandbInit:
|
|
271
274
|
tensorboard = kwargs.pop("tensorboard", None)
|
272
275
|
sync_tensorboard = kwargs.pop("sync_tensorboard", None)
|
273
276
|
if tensorboard or sync_tensorboard and len(wandb.patched["tensorboard"]) == 0:
|
274
|
-
wandb.tensorboard.patch()
|
277
|
+
wandb.tensorboard.patch() # type: ignore
|
275
278
|
with telemetry.context(obj=self._init_telemetry_obj) as tel:
|
276
279
|
tel.feature.tensorboard_sync = True
|
277
280
|
|
@@ -459,7 +462,7 @@ class _WandbInit:
|
|
459
462
|
|
460
463
|
def _jupyter_setup(self, settings: Settings) -> None:
|
461
464
|
"""Add hooks, and session history saving."""
|
462
|
-
self.notebook = wandb.jupyter.Notebook(settings)
|
465
|
+
self.notebook = wandb.jupyter.Notebook(settings) # type: ignore
|
463
466
|
ipython = self.notebook.shell
|
464
467
|
|
465
468
|
# Monkey patch ipython publish to capture displayed outputs
|
@@ -522,17 +525,62 @@ class _WandbInit:
|
|
522
525
|
logger.info(f"Logging internal logs to {settings.log_internal}")
|
523
526
|
|
524
527
|
def _make_run_disabled(self) -> Run:
|
528
|
+
"""Returns a Run-like object where all methods are no-ops.
|
529
|
+
|
530
|
+
This method is used when wandb.init(mode="disabled") is called or WANDB_MODE=disabled
|
531
|
+
is set. It creates a Run object that mimics the behavior of a normal Run but doesn't
|
532
|
+
communicate with the W&B servers.
|
533
|
+
|
534
|
+
The returned Run object has all expected attributes and methods, but they are
|
535
|
+
no-op versions that don't perform any actual logging or communication.
|
536
|
+
"""
|
525
537
|
drun = Run(settings=Settings(mode="disabled", files_dir=tempfile.gettempdir()))
|
526
|
-
|
538
|
+
# config and summary objects
|
539
|
+
drun._config = wandb.sdk.wandb_config.Config()
|
527
540
|
drun._config.update(self.sweep_config)
|
528
541
|
drun._config.update(self.config)
|
529
542
|
drun.summary = SummaryDisabled() # type: ignore
|
543
|
+
# methods
|
530
544
|
drun.log = lambda data, *_, **__: drun.summary.update(data) # type: ignore
|
531
545
|
drun.finish = lambda *_, **__: module.unset_globals() # type: ignore
|
546
|
+
drun.join = drun.finish # type: ignore
|
547
|
+
drun.define_metric = lambda *_, **__: wandb.sdk.wandb_metric.Metric("dummy") # type: ignore
|
548
|
+
drun.save = lambda *_, **__: False # type: ignore
|
549
|
+
for symbol in (
|
550
|
+
"alert",
|
551
|
+
"finish_artifact",
|
552
|
+
"get_project_url",
|
553
|
+
"get_sweep_url",
|
554
|
+
"get_url",
|
555
|
+
"link_artifact",
|
556
|
+
"link_model",
|
557
|
+
"use_artifact",
|
558
|
+
"log_artifact",
|
559
|
+
"log_code",
|
560
|
+
"log_model",
|
561
|
+
"use_model",
|
562
|
+
"mark_preempting",
|
563
|
+
"plot_table",
|
564
|
+
"restore",
|
565
|
+
"status",
|
566
|
+
"watch",
|
567
|
+
"unwatch",
|
568
|
+
"upsert_artifact",
|
569
|
+
):
|
570
|
+
setattr(drun, symbol, lambda *_, **__: None) # type: ignore
|
571
|
+
# attributes
|
532
572
|
drun._step = 0
|
573
|
+
drun._attach_id = None
|
533
574
|
drun._run_obj = None
|
534
575
|
drun._run_id = runid.generate_id()
|
535
576
|
drun._name = "dummy-" + drun.id
|
577
|
+
drun._project = "dummy"
|
578
|
+
drun._entity = "dummy"
|
579
|
+
drun._tags = tuple()
|
580
|
+
drun._notes = None
|
581
|
+
drun._group = None
|
582
|
+
drun._start_time = time.time()
|
583
|
+
drun._starting_step = 0
|
536
584
|
module.set_global(
|
537
585
|
run=drun,
|
538
586
|
config=drun.config,
|
@@ -868,7 +916,7 @@ def _attach(
|
|
868
916
|
raise UsageError(
|
869
917
|
"Either `attach_id` or `run_id` must be specified or `run` must have `_attach_id`"
|
870
918
|
)
|
871
|
-
wandb._assert_is_user_process()
|
919
|
+
wandb._assert_is_user_process() # type: ignore
|
872
920
|
|
873
921
|
_wl = wandb_setup._setup()
|
874
922
|
assert _wl
|
@@ -1157,7 +1205,7 @@ def init(
|
|
1157
1205
|
Returns:
|
1158
1206
|
A `Run` object.
|
1159
1207
|
"""
|
1160
|
-
wandb._assert_is_user_process()
|
1208
|
+
wandb._assert_is_user_process() # type: ignore
|
1161
1209
|
|
1162
1210
|
kwargs = dict(locals())
|
1163
1211
|
|