wandb 0.17.5__py3-none-any.whl → 0.17.7__py3-none-any.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.
Files changed (72) hide show
  1. wandb/__init__.py +5 -16
  2. wandb/agents/pyagent.py +1 -2
  3. wandb/apis/public/api.py +1 -1
  4. wandb/apis/public/jobs.py +5 -0
  5. wandb/bin/nvidia_gpu_stats +0 -0
  6. wandb/cli/cli.py +21 -0
  7. wandb/data_types.py +5 -4
  8. wandb/env.py +6 -0
  9. wandb/integration/kfp/wandb_logging.py +1 -1
  10. wandb/integration/lightning/fabric/logger.py +5 -5
  11. wandb/integration/openai/fine_tuning.py +13 -5
  12. wandb/integration/ultralytics/pose_utils.py +0 -1
  13. wandb/proto/v3/wandb_internal_pb2.py +226 -226
  14. wandb/proto/v3/wandb_settings_pb2.py +1 -1
  15. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  16. wandb/proto/v4/wandb_internal_pb2.py +226 -226
  17. wandb/proto/v4/wandb_settings_pb2.py +1 -1
  18. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  19. wandb/proto/v5/wandb_internal_pb2.py +226 -226
  20. wandb/proto/v5/wandb_settings_pb2.py +1 -1
  21. wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
  22. wandb/proto/wandb_deprecated.py +4 -0
  23. wandb/proto/wandb_internal_pb2.py +6 -0
  24. wandb/sdk/artifacts/artifact.py +6 -1
  25. wandb/sdk/artifacts/artifact_manifest_entry.py +31 -0
  26. wandb/sdk/artifacts/storage_handlers/azure_handler.py +35 -23
  27. wandb/sdk/data_types/_dtypes.py +5 -5
  28. wandb/sdk/data_types/base_types/media.py +3 -1
  29. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +3 -1
  30. wandb/sdk/data_types/helper_types/image_mask.py +3 -1
  31. wandb/sdk/data_types/image.py +3 -1
  32. wandb/sdk/data_types/object_3d.py +113 -2
  33. wandb/sdk/data_types/saved_model.py +3 -1
  34. wandb/sdk/interface/interface.py +40 -16
  35. wandb/sdk/interface/interface_shared.py +6 -9
  36. wandb/sdk/internal/datastore.py +1 -1
  37. wandb/sdk/internal/handler.py +0 -2
  38. wandb/sdk/internal/internal.py +1 -1
  39. wandb/sdk/internal/job_builder.py +5 -2
  40. wandb/sdk/internal/sender.py +31 -15
  41. wandb/sdk/internal/tb_watcher.py +2 -2
  42. wandb/sdk/internal/update.py +2 -2
  43. wandb/sdk/launch/_launch.py +4 -2
  44. wandb/sdk/launch/_project_spec.py +34 -8
  45. wandb/sdk/launch/agent/agent.py +6 -2
  46. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -4
  47. wandb/sdk/launch/builder/build.py +4 -2
  48. wandb/sdk/launch/builder/kaniko_builder.py +13 -5
  49. wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +2 -1
  50. wandb/sdk/launch/create_job.py +2 -0
  51. wandb/sdk/launch/inputs/internal.py +42 -28
  52. wandb/sdk/launch/inputs/schema.py +39 -0
  53. wandb/sdk/launch/runner/kubernetes_runner.py +72 -0
  54. wandb/sdk/launch/runner/local_container.py +13 -10
  55. wandb/sdk/launch/runner/sagemaker_runner.py +3 -5
  56. wandb/sdk/launch/utils.py +2 -0
  57. wandb/sdk/lib/apikey.py +1 -1
  58. wandb/sdk/lib/disabled.py +13 -174
  59. wandb/sdk/service/streams.py +2 -4
  60. wandb/sdk/wandb_config.py +1 -1
  61. wandb/sdk/wandb_init.py +77 -33
  62. wandb/sdk/wandb_login.py +6 -6
  63. wandb/sdk/wandb_run.py +150 -90
  64. wandb/sdk/wandb_settings.py +4 -3
  65. wandb/sdk/wandb_setup.py +66 -3
  66. wandb/sdk/wandb_sweep.py +5 -2
  67. wandb/wandb_agent.py +2 -0
  68. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/METADATA +3 -2
  69. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/RECORD +72 -70
  70. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/WHEEL +0 -0
  71. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/entry_points.txt +0 -0
  72. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/licenses/LICENSE +0 -0
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
@@ -30,15 +31,7 @@ from wandb.util import _is_artifact_representation
30
31
 
31
32
  from . import wandb_login, wandb_setup
32
33
  from .backend.backend import Backend
33
- from .lib import (
34
- RunDisabled,
35
- SummaryDisabled,
36
- filesystem,
37
- ipython,
38
- module,
39
- reporting,
40
- telemetry,
41
- )
34
+ from .lib import SummaryDisabled, filesystem, ipython, module, reporting, telemetry
42
35
  from .lib.deprecate import Deprecated, deprecate
43
36
  from .lib.mailbox import Mailbox, MailboxProgress
44
37
  from .lib.printer import Printer, get_printer
@@ -182,7 +175,9 @@ class _WandbInit:
182
175
  # we add this logic to be backward compatible with the old behavior of disable
183
176
  # where it would disable the service if the mode was set to disabled
184
177
  mode = kwargs.get("mode")
185
- 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
+ )
186
181
  _disable_service = mode == "disabled" or settings_mode == "disabled"
187
182
  setup_settings = {"_disable_service": _disable_service}
188
183
 
@@ -270,7 +265,7 @@ class _WandbInit:
270
265
 
271
266
  monitor_gym = kwargs.pop("monitor_gym", None)
272
267
  if monitor_gym and len(wandb.patched["gym"]) == 0:
273
- wandb.gym.monitor()
268
+ wandb.gym.monitor() # type: ignore
274
269
 
275
270
  if wandb.patched["tensorboard"]:
276
271
  with telemetry.context(obj=self._init_telemetry_obj) as tel:
@@ -279,7 +274,7 @@ class _WandbInit:
279
274
  tensorboard = kwargs.pop("tensorboard", None)
280
275
  sync_tensorboard = kwargs.pop("sync_tensorboard", None)
281
276
  if tensorboard or sync_tensorboard and len(wandb.patched["tensorboard"]) == 0:
282
- wandb.tensorboard.patch()
277
+ wandb.tensorboard.patch() # type: ignore
283
278
  with telemetry.context(obj=self._init_telemetry_obj) as tel:
284
279
  tel.feature.tensorboard_sync = True
285
280
 
@@ -467,7 +462,7 @@ class _WandbInit:
467
462
 
468
463
  def _jupyter_setup(self, settings: Settings) -> None:
469
464
  """Add hooks, and session history saving."""
470
- self.notebook = wandb.jupyter.Notebook(settings)
465
+ self.notebook = wandb.jupyter.Notebook(settings) # type: ignore
471
466
  ipython = self.notebook.shell
472
467
 
473
468
  # Monkey patch ipython publish to capture displayed outputs
@@ -529,20 +524,63 @@ class _WandbInit:
529
524
  logger.info(f"Logging user logs to {settings.log_user}")
530
525
  logger.info(f"Logging internal logs to {settings.log_internal}")
531
526
 
532
- def _make_run_disabled(self) -> RunDisabled:
533
- drun = RunDisabled()
534
- drun.config = wandb.wandb_sdk.wandb_config.Config()
535
- drun.config.update(self.sweep_config)
536
- drun.config.update(self.config)
537
- drun.summary = SummaryDisabled()
538
- drun.log = lambda data, *_, **__: drun.summary.update(data)
539
- drun.finish = lambda *_, **__: module.unset_globals()
540
- drun.step = 0
541
- drun.resumed = False
542
- drun.disabled = True
543
- drun.id = runid.generate_id()
544
- drun.name = "dummy-" + drun.id
545
- drun.dir = tempfile.gettempdir()
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
+ """
537
+ drun = Run(settings=Settings(mode="disabled", files_dir=tempfile.gettempdir()))
538
+ # config and summary objects
539
+ drun._config = wandb.sdk.wandb_config.Config()
540
+ drun._config.update(self.sweep_config)
541
+ drun._config.update(self.config)
542
+ drun.summary = SummaryDisabled() # type: ignore
543
+ # methods
544
+ drun.log = lambda data, *_, **__: drun.summary.update(data) # type: ignore
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
572
+ drun._step = 0
573
+ drun._attach_id = None
574
+ drun._run_obj = None
575
+ drun._run_id = runid.generate_id()
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
546
584
  module.set_global(
547
585
  run=drun,
548
586
  config=drun.config,
@@ -563,7 +601,7 @@ class _WandbInit:
563
601
  percent_done = handle.percent_done
564
602
  self.printer.progress_update(line, percent_done=percent_done)
565
603
 
566
- def init(self) -> Union[Run, RunDisabled]: # noqa: C901
604
+ def init(self) -> Run: # noqa: C901
567
605
  if logger is None:
568
606
  raise RuntimeError("Logger not initialized")
569
607
  logger.info("calling init triggers")
@@ -700,6 +738,12 @@ class _WandbInit:
700
738
  tel.feature.flow_control_custom = True
701
739
  if self.settings._require_core:
702
740
  tel.feature.core = True
741
+ if self.settings._shared:
742
+ wandb.termwarn(
743
+ "The `_shared` feature is experimental and may change. "
744
+ "Please contact support@wandb.com for guidance and to report any issues."
745
+ )
746
+ tel.feature.shared_mode = True
703
747
 
704
748
  tel.env.maybe_mp = _maybe_mp_process(backend)
705
749
 
@@ -853,7 +897,7 @@ def _attach(
853
897
  run_id: Optional[str] = None,
854
898
  *,
855
899
  run: Optional["Run"] = None,
856
- ) -> Union[Run, RunDisabled, None]:
900
+ ) -> Optional[Run]:
857
901
  """Attach to a run currently executing in another process/thread.
858
902
 
859
903
  Arguments:
@@ -872,7 +916,7 @@ def _attach(
872
916
  raise UsageError(
873
917
  "Either `attach_id` or `run_id` must be specified or `run` must have `_attach_id`"
874
918
  )
875
- wandb._assert_is_user_process()
919
+ wandb._assert_is_user_process() # type: ignore
876
920
 
877
921
  _wl = wandb_setup._setup()
878
922
  assert _wl
@@ -907,7 +951,7 @@ def _attach(
907
951
  if run is None:
908
952
  run = Run(settings=settings)
909
953
  else:
910
- run._init(settings=settings)
954
+ run._init()
911
955
  run._set_library(_wl)
912
956
  run._set_backend(backend)
913
957
  backend._hack_set_run(run)
@@ -957,7 +1001,7 @@ def init(
957
1001
  fork_from: Optional[str] = None,
958
1002
  resume_from: Optional[str] = None,
959
1003
  settings: Union[Settings, Dict[str, Any], None] = None,
960
- ) -> Union[Run, RunDisabled]:
1004
+ ) -> Run:
961
1005
  r"""Start a new run to track and log to W&B.
962
1006
 
963
1007
  In an ML training pipeline, you could add `wandb.init()`
@@ -1161,7 +1205,7 @@ def init(
1161
1205
  Returns:
1162
1206
  A `Run` object.
1163
1207
  """
1164
- wandb._assert_is_user_process()
1208
+ wandb._assert_is_user_process() # type: ignore
1165
1209
 
1166
1210
  kwargs = dict(locals())
1167
1211
 
wandb/sdk/wandb_login.py CHANGED
@@ -54,16 +54,16 @@ def login(
54
54
  ) -> bool:
55
55
  """Set up W&B login credentials.
56
56
 
57
- By default, this will only store the credentials locally without
57
+ By default, this will only store credentials locally without
58
58
  verifying them with the W&B server. To verify credentials, pass
59
- verify=True.
59
+ `verify=True`.
60
60
 
61
61
  Arguments:
62
62
  anonymous: (string, optional) Can be "must", "allow", or "never".
63
- If set to "must" we'll always log in anonymously, if set to
64
- "allow" we'll only create an anonymous user if the user
65
- isn't already logged in.
66
- key: (string, optional) authentication key.
63
+ If set to "must", always log a user in anonymously. If set to
64
+ "allow", only create an anonymous user if the user
65
+ isn't already logged in. If set to "never", never log a
66
+ user anonymously. Default set to "never".
67
67
  relogin: (bool, optional) If true, will re-prompt for API key.
68
68
  host: (string, optional) The host to connect to.
69
69
  force: (bool, optional) If true, will force a relogin.