wandb 0.20.2rc20250616__py3-none-win32.whl → 0.21.1__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.
Files changed (140) hide show
  1. wandb/__init__.py +16 -14
  2. wandb/__init__.pyi +450 -472
  3. wandb/agents/pyagent.py +41 -12
  4. wandb/analytics/sentry.py +7 -2
  5. wandb/apis/importers/mlflow.py +1 -1
  6. wandb/apis/internal.py +3 -0
  7. wandb/apis/paginator.py +17 -4
  8. wandb/apis/public/__init__.py +1 -1
  9. wandb/apis/public/api.py +606 -359
  10. wandb/apis/public/artifacts.py +214 -16
  11. wandb/apis/public/automations.py +19 -3
  12. wandb/apis/public/files.py +177 -38
  13. wandb/apis/public/history.py +67 -15
  14. wandb/apis/public/integrations.py +25 -2
  15. wandb/apis/public/jobs.py +90 -2
  16. wandb/apis/public/projects.py +161 -69
  17. wandb/apis/public/query_generator.py +11 -1
  18. wandb/apis/public/registries/registries_search.py +7 -15
  19. wandb/apis/public/reports.py +147 -13
  20. wandb/apis/public/runs.py +315 -128
  21. wandb/apis/public/sweeps.py +222 -22
  22. wandb/apis/public/teams.py +41 -4
  23. wandb/apis/public/users.py +45 -4
  24. wandb/automations/__init__.py +10 -10
  25. wandb/automations/_filters/run_metrics.py +0 -2
  26. wandb/automations/_utils.py +0 -2
  27. wandb/automations/actions.py +0 -2
  28. wandb/automations/automations.py +0 -2
  29. wandb/automations/events.py +0 -2
  30. wandb/beta/workflows.py +66 -30
  31. wandb/bin/gpu_stats.exe +0 -0
  32. wandb/bin/wandb-core +0 -0
  33. wandb/cli/cli.py +80 -1
  34. wandb/env.py +8 -0
  35. wandb/errors/errors.py +4 -1
  36. wandb/integration/catboost/catboost.py +6 -2
  37. wandb/integration/kfp/kfp_patch.py +3 -1
  38. wandb/integration/lightning/fabric/logger.py +3 -4
  39. wandb/integration/metaflow/__init__.py +6 -0
  40. wandb/integration/metaflow/data_pandas.py +74 -0
  41. wandb/integration/metaflow/errors.py +13 -0
  42. wandb/integration/metaflow/metaflow.py +205 -190
  43. wandb/integration/openai/fine_tuning.py +1 -2
  44. wandb/integration/sb3/sb3.py +3 -3
  45. wandb/integration/ultralytics/callback.py +6 -2
  46. wandb/jupyter.py +5 -5
  47. wandb/plot/__init__.py +2 -0
  48. wandb/plot/bar.py +30 -29
  49. wandb/plot/confusion_matrix.py +75 -71
  50. wandb/plot/custom_chart.py +30 -7
  51. wandb/plot/histogram.py +26 -25
  52. wandb/plot/line.py +33 -32
  53. wandb/plot/line_series.py +100 -103
  54. wandb/plot/pr_curve.py +33 -32
  55. wandb/plot/roc_curve.py +38 -38
  56. wandb/plot/scatter.py +27 -27
  57. wandb/proto/v3/wandb_internal_pb2.py +366 -385
  58. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  59. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  60. wandb/proto/v4/wandb_internal_pb2.py +352 -356
  61. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  62. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  63. wandb/proto/v5/wandb_internal_pb2.py +352 -356
  64. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  65. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  66. wandb/proto/v6/wandb_internal_pb2.py +352 -356
  67. wandb/proto/v6/wandb_settings_pb2.py +2 -2
  68. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  69. wandb/proto/wandb_deprecated.py +6 -0
  70. wandb/sdk/artifacts/_generated/__init__.py +12 -1
  71. wandb/sdk/artifacts/_generated/input_types.py +20 -2
  72. wandb/sdk/artifacts/_generated/link_artifact.py +21 -0
  73. wandb/sdk/artifacts/_generated/operations.py +9 -0
  74. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  75. wandb/sdk/artifacts/_validators.py +48 -2
  76. wandb/sdk/artifacts/artifact.py +269 -96
  77. wandb/sdk/data_types/audio.py +38 -10
  78. wandb/sdk/data_types/base_types/media.py +15 -63
  79. wandb/sdk/data_types/base_types/wb_value.py +6 -6
  80. wandb/sdk/data_types/graph.py +48 -14
  81. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  82. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  83. wandb/sdk/data_types/histogram.py +34 -21
  84. wandb/sdk/data_types/html.py +35 -12
  85. wandb/sdk/data_types/image.py +104 -68
  86. wandb/sdk/data_types/molecule.py +32 -19
  87. wandb/sdk/data_types/object_3d.py +36 -17
  88. wandb/sdk/data_types/plotly.py +18 -5
  89. wandb/sdk/data_types/saved_model.py +7 -9
  90. wandb/sdk/data_types/table.py +99 -70
  91. wandb/sdk/data_types/trace_tree.py +12 -12
  92. wandb/sdk/data_types/video.py +53 -26
  93. wandb/sdk/integration_utils/auto_logging.py +2 -2
  94. wandb/sdk/interface/interface.py +8 -19
  95. wandb/sdk/interface/interface_shared.py +7 -16
  96. wandb/sdk/internal/datastore.py +18 -18
  97. wandb/sdk/internal/handler.py +3 -5
  98. wandb/sdk/internal/internal_api.py +60 -0
  99. wandb/sdk/internal/job_builder.py +6 -0
  100. wandb/sdk/internal/sender.py +23 -3
  101. wandb/sdk/internal/sender_config.py +9 -0
  102. wandb/sdk/launch/_project_spec.py +3 -3
  103. wandb/sdk/launch/agent/agent.py +11 -4
  104. wandb/sdk/launch/agent/job_status_tracker.py +3 -1
  105. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  106. wandb/sdk/launch/create_job.py +3 -1
  107. wandb/sdk/launch/inputs/internal.py +3 -4
  108. wandb/sdk/launch/inputs/schema.py +1 -0
  109. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  110. wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
  111. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  112. wandb/sdk/launch/utils.py +3 -3
  113. wandb/sdk/lib/asyncio_compat.py +3 -0
  114. wandb/sdk/lib/console_capture.py +66 -19
  115. wandb/sdk/lib/deprecate.py +1 -7
  116. wandb/sdk/lib/disabled.py +1 -1
  117. wandb/sdk/lib/hashutil.py +14 -1
  118. wandb/sdk/lib/module.py +7 -13
  119. wandb/sdk/lib/progress.py +0 -19
  120. wandb/sdk/lib/sock_client.py +0 -4
  121. wandb/sdk/wandb_init.py +67 -93
  122. wandb/sdk/wandb_login.py +18 -14
  123. wandb/sdk/wandb_metric.py +2 -0
  124. wandb/sdk/wandb_require.py +0 -1
  125. wandb/sdk/wandb_run.py +429 -527
  126. wandb/sdk/wandb_settings.py +364 -74
  127. wandb/sdk/wandb_setup.py +28 -28
  128. wandb/sdk/wandb_sweep.py +14 -13
  129. wandb/sdk/wandb_watch.py +4 -6
  130. wandb/sync/sync.py +10 -0
  131. wandb/util.py +57 -0
  132. wandb/wandb_run.py +1 -2
  133. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
  134. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/RECORD +137 -137
  135. wandb/sdk/wandb_metadata.py +0 -623
  136. wandb/vendor/pynvml/__init__.py +0 -0
  137. wandb/vendor/pynvml/pynvml.py +0 -4779
  138. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
  139. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
  140. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_setup.py CHANGED
@@ -419,49 +419,49 @@ def setup(settings: Settings | None = None) -> _WandbSetup:
419
419
  overridden by subsequent `wandb.init()` calls.
420
420
 
421
421
  Example:
422
- ```python
423
- import multiprocessing
422
+ ```python
423
+ import multiprocessing
424
424
 
425
- import wandb
425
+ import wandb
426
426
 
427
427
 
428
- def run_experiment(params):
429
- with wandb.init(config=params):
430
- # Run experiment
431
- pass
428
+ def run_experiment(params):
429
+ with wandb.init(config=params):
430
+ # Run experiment
431
+ pass
432
432
 
433
433
 
434
- if __name__ == "__main__":
435
- # Start backend and set global config
436
- wandb.setup(settings={"project": "my_project"})
434
+ if __name__ == "__main__":
435
+ # Start backend and set global config
436
+ wandb.setup(settings={"project": "my_project"})
437
437
 
438
- # Define experiment parameters
439
- experiment_params = [
440
- {"learning_rate": 0.01, "epochs": 10},
441
- {"learning_rate": 0.001, "epochs": 20},
442
- ]
438
+ # Define experiment parameters
439
+ experiment_params = [
440
+ {"learning_rate": 0.01, "epochs": 10},
441
+ {"learning_rate": 0.001, "epochs": 20},
442
+ ]
443
443
 
444
- # Start multiple processes, each running a separate experiment
445
- processes = []
446
- for params in experiment_params:
447
- p = multiprocessing.Process(target=run_experiment, args=(params,))
448
- p.start()
449
- processes.append(p)
444
+ # Start multiple processes, each running a separate experiment
445
+ processes = []
446
+ for params in experiment_params:
447
+ p = multiprocessing.Process(target=run_experiment, args=(params,))
448
+ p.start()
449
+ processes.append(p)
450
450
 
451
- # Wait for all processes to complete
452
- for p in processes:
453
- p.join()
451
+ # Wait for all processes to complete
452
+ for p in processes:
453
+ p.join()
454
454
 
455
- # Optional: Explicitly shut down the backend
456
- wandb.teardown()
457
- ```
455
+ # Optional: Explicitly shut down the backend
456
+ wandb.teardown()
457
+ ```
458
458
  """
459
459
  return _setup(settings=settings)
460
460
 
461
461
 
462
462
  @wb_logging.log_to_all_runs()
463
463
  def teardown(exit_code: int | None = None) -> None:
464
- """Waits for wandb to finish and frees resources.
464
+ """Waits for W&B to finish and frees resources.
465
465
 
466
466
  Completes any runs that were not explicitly finished
467
467
  using `run.finish()` and waits for all data to be uploaded.
wandb/sdk/wandb_sweep.py CHANGED
@@ -45,11 +45,12 @@ def sweep(
45
45
  Make note the unique identifier, `sweep_id`, that is returned.
46
46
  At a later step provide the `sweep_id` to a sweep agent.
47
47
 
48
+ See [Sweep configuration structure](https://docs.wandb.ai/guides/sweeps/define-sweep-configuration)
49
+ for information on how to define your sweep.
50
+
48
51
  Args:
49
52
  sweep: The configuration of a hyperparameter search.
50
- (or configuration generator). See
51
- [Sweep configuration structure](https://docs.wandb.ai/guides/sweeps/define-sweep-configuration)
52
- for information on how to define your sweep.
53
+ (or configuration generator).
53
54
  If you provide a callable, ensure that the callable does
54
55
  not take arguments and that it returns a dictionary that
55
56
  conforms to the W&B sweep config spec.
@@ -64,7 +65,7 @@ def sweep(
64
65
  prior_runs: The run IDs of existing runs to add to this sweep.
65
66
 
66
67
  Returns:
67
- sweep_id: str. A unique identifier for the sweep.
68
+ str: A unique identifier for the sweep.
68
69
  """
69
70
  if callable(sweep):
70
71
  sweep = sweep()
@@ -99,16 +100,16 @@ def controller(
99
100
  ) -> "_WandbController":
100
101
  """Public sweep controller constructor.
101
102
 
102
- Usage:
103
- ```python
104
- import wandb
103
+ Examples:
104
+ ```python
105
+ import wandb
105
106
 
106
- tuner = wandb.controller(...)
107
- print(tuner.sweep_config)
108
- print(tuner.sweep_id)
109
- tuner.configure_search(...)
110
- tuner.configure_stopping(...)
111
- ```
107
+ tuner = wandb.controller(...)
108
+ print(tuner.sweep_config)
109
+ print(tuner.sweep_id)
110
+ tuner.configure_search(...)
111
+ tuner.configure_stopping(...)
112
+ ```
112
113
 
113
114
  """
114
115
  from ..wandb_controller import _WandbController
wandb/sdk/wandb_watch.py CHANGED
@@ -17,15 +17,13 @@ from .lib import telemetry
17
17
  if TYPE_CHECKING:
18
18
  import torch # type: ignore [import-not-found]
19
19
 
20
- from wandb.sdk.wandb_run import Run
21
-
22
20
  logger = logging.getLogger("wandb")
23
21
 
24
22
  _global_watch_idx = 0
25
23
 
26
24
 
27
25
  def _watch(
28
- run: Run,
26
+ run: wandb.Run,
29
27
  models: torch.nn.Module | Sequence[torch.nn.Module],
30
28
  criterion: torch.F | None = None,
31
29
  log: Literal["gradients", "parameters", "all"] | None = "gradients",
@@ -39,7 +37,7 @@ def _watch(
39
37
  extended to support arbitrary machine learning models in the future.
40
38
 
41
39
  Args:
42
- run (wandb.sdk.wandb_run.Run): The run object to log to.
40
+ run (wandb.Run): The run object to log to.
43
41
  models (Union[torch.nn.Module, Sequence[torch.nn.Module]]):
44
42
  A single model or a sequence of models to be monitored.
45
43
  criterion (Optional[torch.F]):
@@ -122,12 +120,12 @@ def _watch(
122
120
 
123
121
 
124
122
  def _unwatch(
125
- run: Run, models: torch.nn.Module | Sequence[torch.nn.Module] | None = None
123
+ run: wandb.Run, models: torch.nn.Module | Sequence[torch.nn.Module] | None = None
126
124
  ) -> None:
127
125
  """Remove pytorch model topology, gradient and parameter hooks.
128
126
 
129
127
  Args:
130
- run (wandb.sdk.wandb_run.Run):
128
+ run (wandb.Run):
131
129
  The run object to log to.
132
130
  models (torch.nn.Module | Sequence[torch.nn.Module]):
133
131
  Optional list of pytorch models that have had watch called on them
wandb/sync/sync.py CHANGED
@@ -54,6 +54,7 @@ class SyncThread(threading.Thread):
54
54
  log_path=None,
55
55
  append=None,
56
56
  skip_console=None,
57
+ replace_tags=None,
57
58
  ):
58
59
  threading.Thread.__init__(self)
59
60
  # mark this process as internal
@@ -71,6 +72,7 @@ class SyncThread(threading.Thread):
71
72
  self._log_path = log_path
72
73
  self._append = append
73
74
  self._skip_console = skip_console
75
+ self._replace_tags = replace_tags or {}
74
76
 
75
77
  self._tmp_dir = tempfile.TemporaryDirectory()
76
78
  atexit.register(self._tmp_dir.cleanup)
@@ -94,6 +96,11 @@ class SyncThread(threading.Thread):
94
96
  pb.run.entity = self._entity
95
97
  if self._job_type:
96
98
  pb.run.job_type = self._job_type
99
+ # Replace tags if specified
100
+ if self._replace_tags:
101
+ new_tags = [self._replace_tags.get(tag, tag) for tag in pb.run.tags]
102
+ pb.run.ClearField("tags")
103
+ pb.run.tags.extend(new_tags)
97
104
  pb.control.req_resp = True
98
105
  elif record_type in ("output", "output_raw") and self._skip_console:
99
106
  return pb, exit_pb, True
@@ -338,6 +345,7 @@ class SyncManager:
338
345
  log_path=None,
339
346
  append=None,
340
347
  skip_console=None,
348
+ replace_tags=None,
341
349
  ):
342
350
  self._sync_list = []
343
351
  self._thread = None
@@ -353,6 +361,7 @@ class SyncManager:
353
361
  self._log_path = log_path
354
362
  self._append = append
355
363
  self._skip_console = skip_console
364
+ self._replace_tags = replace_tags or {}
356
365
 
357
366
  def status(self):
358
367
  pass
@@ -376,6 +385,7 @@ class SyncManager:
376
385
  log_path=self._log_path,
377
386
  append=self._append,
378
387
  skip_console=self._skip_console,
388
+ replace_tags=self._replace_tags,
379
389
  )
380
390
  self._thread.start()
381
391
 
wandb/util.py CHANGED
@@ -341,6 +341,63 @@ def get_local_path_or_none(path_or_uri: str) -> Optional[str]:
341
341
  return None
342
342
 
343
343
 
344
+ def check_windows_valid_filename(path: Union[int, str]) -> bool:
345
+ r"""Verify that the given path does not contain any invalid characters for a Windows filename.
346
+
347
+ Windows filenames cannot contain the following characters:
348
+ < > : " \ / | ? *
349
+
350
+ For more details, refer to the official documentation:
351
+ https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
352
+
353
+ Args:
354
+ path: The file path to check, which can be either an integer or a string.
355
+
356
+ Returns:
357
+ bool: True if the path does not contain any invalid characters, False otherwise.
358
+ """
359
+ return not bool(re.search(r'[<>:"\\?*]', path)) # type: ignore
360
+
361
+
362
+ def make_file_path_upload_safe(path: str) -> str:
363
+ r"""Makes the provide path safe for file upload.
364
+
365
+ The filename is made safe by:
366
+ 1. Removing any leading slashes to prevent writing to absolute paths
367
+ 2. Replacing '.' and '..' with underscores to prevent directory traversal attacks
368
+
369
+ Raises:
370
+ ValueError: If running on Windows and the key contains invalid filename characters
371
+ (\, :, *, ?, ", <, >, |)
372
+ """
373
+ sys_platform = platform.system()
374
+ if sys_platform == "Windows" and not check_windows_valid_filename(path):
375
+ raise ValueError(
376
+ f"Path {path} is invalid. Please remove invalid filename characters"
377
+ r' (\, :, *, ?, ", <, >, |)'
378
+ )
379
+
380
+ # On Windows, convert forward slashes to backslashes.
381
+ # This ensures that the key is a valid filename on Windows.
382
+ if sys_platform == "Windows":
383
+ path = str(path).replace("/", os.sep)
384
+
385
+ # Avoid writing to absolute paths by striping any leading slashes.
386
+ # The key has already been validated for windows operating systems in util.check_windows_valid_filename
387
+ # This ensures the key does not contain invalid characters for windows, such as '\' or ':'.
388
+ # So we can check only for '/' in the key.
389
+ path = path.lstrip(os.sep)
390
+
391
+ # Avoid directory traversal by replacing dots with underscores.
392
+ paths = path.split(os.sep)
393
+ safe_paths = [
394
+ p.replace(".", "_") if p in (os.curdir, os.pardir) else p for p in paths
395
+ ]
396
+
397
+ # Recombine the key into a relative path.
398
+ return os.sep.join(safe_paths)
399
+
400
+
344
401
  def make_tarfile(
345
402
  output_filename: str,
346
403
  source_dir: str,
wandb/wandb_run.py CHANGED
@@ -1,7 +1,6 @@
1
1
  """Compatibility wandb_run module.
2
2
 
3
- In the future use:
4
- from wandb.sdk.wandb_run import Run
3
+ Please use `wandb.Run` instead.
5
4
  """
6
5
 
7
6
  from wandb.sdk.wandb_run import Run
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wandb
3
- Version: 0.20.2rc20250616
3
+ Version: 0.21.1
4
4
  Summary: A CLI and library for interacting with the Weights & Biases API.
5
5
  Project-URL: Source, https://github.com/wandb/wandb
6
6
  Project-URL: Bug Reports, https://github.com/wandb/wandb/issues