wandb 0.21.0__py3-none-musllinux_1_2_aarch64.whl → 0.21.1__py3-none-musllinux_1_2_aarch64.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 (97) hide show
  1. wandb/__init__.py +16 -14
  2. wandb/__init__.pyi +427 -450
  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/public/__init__.py +1 -1
  7. wandb/apis/public/api.py +526 -360
  8. wandb/apis/public/artifacts.py +204 -8
  9. wandb/apis/public/automations.py +19 -3
  10. wandb/apis/public/files.py +172 -33
  11. wandb/apis/public/history.py +67 -15
  12. wandb/apis/public/integrations.py +25 -2
  13. wandb/apis/public/jobs.py +90 -2
  14. wandb/apis/public/projects.py +130 -79
  15. wandb/apis/public/query_generator.py +11 -1
  16. wandb/apis/public/registries/registries_search.py +7 -15
  17. wandb/apis/public/reports.py +83 -5
  18. wandb/apis/public/runs.py +299 -105
  19. wandb/apis/public/sweeps.py +222 -22
  20. wandb/apis/public/teams.py +41 -4
  21. wandb/apis/public/users.py +45 -4
  22. wandb/beta/workflows.py +66 -30
  23. wandb/bin/gpu_stats +0 -0
  24. wandb/bin/wandb-core +0 -0
  25. wandb/cli/cli.py +80 -1
  26. wandb/env.py +8 -0
  27. wandb/errors/errors.py +4 -1
  28. wandb/integration/lightning/fabric/logger.py +3 -4
  29. wandb/integration/metaflow/__init__.py +6 -0
  30. wandb/integration/metaflow/data_pandas.py +74 -0
  31. wandb/integration/metaflow/errors.py +13 -0
  32. wandb/integration/metaflow/metaflow.py +205 -190
  33. wandb/integration/openai/fine_tuning.py +1 -2
  34. wandb/jupyter.py +5 -5
  35. wandb/plot/custom_chart.py +30 -7
  36. wandb/proto/v3/wandb_internal_pb2.py +280 -280
  37. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  38. wandb/proto/v4/wandb_internal_pb2.py +280 -280
  39. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  40. wandb/proto/v5/wandb_internal_pb2.py +280 -280
  41. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  42. wandb/proto/v6/wandb_internal_pb2.py +280 -280
  43. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  44. wandb/proto/wandb_deprecated.py +6 -0
  45. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  46. wandb/sdk/artifacts/_validators.py +8 -0
  47. wandb/sdk/artifacts/artifact.py +106 -75
  48. wandb/sdk/data_types/audio.py +38 -10
  49. wandb/sdk/data_types/base_types/media.py +6 -56
  50. wandb/sdk/data_types/graph.py +48 -14
  51. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  52. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  53. wandb/sdk/data_types/histogram.py +34 -21
  54. wandb/sdk/data_types/html.py +35 -12
  55. wandb/sdk/data_types/image.py +104 -68
  56. wandb/sdk/data_types/molecule.py +32 -19
  57. wandb/sdk/data_types/object_3d.py +36 -17
  58. wandb/sdk/data_types/plotly.py +18 -5
  59. wandb/sdk/data_types/saved_model.py +4 -6
  60. wandb/sdk/data_types/table.py +59 -30
  61. wandb/sdk/data_types/video.py +53 -26
  62. wandb/sdk/integration_utils/auto_logging.py +2 -2
  63. wandb/sdk/internal/internal_api.py +6 -0
  64. wandb/sdk/internal/job_builder.py +6 -0
  65. wandb/sdk/launch/agent/agent.py +8 -1
  66. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  67. wandb/sdk/launch/create_job.py +3 -1
  68. wandb/sdk/launch/inputs/internal.py +3 -4
  69. wandb/sdk/launch/inputs/schema.py +1 -0
  70. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  71. wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
  72. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  73. wandb/sdk/lib/asyncio_compat.py +3 -0
  74. wandb/sdk/lib/deprecate.py +1 -7
  75. wandb/sdk/lib/disabled.py +1 -1
  76. wandb/sdk/lib/hashutil.py +14 -1
  77. wandb/sdk/lib/module.py +7 -13
  78. wandb/sdk/lib/progress.py +0 -19
  79. wandb/sdk/lib/sock_client.py +0 -4
  80. wandb/sdk/wandb_init.py +66 -91
  81. wandb/sdk/wandb_login.py +18 -14
  82. wandb/sdk/wandb_metric.py +2 -0
  83. wandb/sdk/wandb_run.py +406 -414
  84. wandb/sdk/wandb_settings.py +130 -2
  85. wandb/sdk/wandb_setup.py +28 -28
  86. wandb/sdk/wandb_sweep.py +14 -13
  87. wandb/sdk/wandb_watch.py +4 -6
  88. wandb/sync/sync.py +10 -0
  89. wandb/util.py +57 -0
  90. wandb/wandb_run.py +1 -2
  91. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
  92. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/RECORD +786 -786
  93. wandb/vendor/pynvml/__init__.py +0 -0
  94. wandb/vendor/pynvml/pynvml.py +0 -4779
  95. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
  96. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
  97. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
wandb/cli/cli.py CHANGED
@@ -14,7 +14,7 @@ import textwrap
14
14
  import time
15
15
  import traceback
16
16
  from functools import wraps
17
- from typing import Any, Dict, Optional
17
+ from typing import Any, Dict, Optional, Tuple
18
18
 
19
19
  import click
20
20
  import yaml
@@ -95,6 +95,39 @@ class ClickWandbException(ClickException):
95
95
  )
96
96
 
97
97
 
98
+ def parse_service_config(
99
+ ctx: Optional[click.Context],
100
+ param: Optional[click.Parameter],
101
+ value: Optional[Tuple[str, ...]],
102
+ ) -> Dict[str, str]:
103
+ """Parse service configurations in format serviceName=policy."""
104
+ if not value:
105
+ return {}
106
+
107
+ result = {}
108
+ for config in value:
109
+ if "=" not in config:
110
+ raise click.BadParameter(
111
+ f"Service must be in format 'serviceName=policy', got '{config}'"
112
+ )
113
+
114
+ service_name, policy = config.split("=", 1)
115
+ service_name = service_name.strip()
116
+ policy = policy.strip()
117
+ if not service_name:
118
+ raise click.BadParameter("Service name cannot be empty")
119
+
120
+ # Simple validation for two policies
121
+ if policy not in ["always", "never"]:
122
+ raise click.BadParameter(
123
+ f"Policy must be 'always' or 'never', got '{policy}'"
124
+ )
125
+
126
+ result[service_name] = policy
127
+
128
+ return result
129
+
130
+
98
131
  def display_error(func):
99
132
  """Function decorator for catching common errors and re-raising as wandb.Error."""
100
133
 
@@ -454,6 +487,10 @@ def init(ctx, project, entity, reset, mode):
454
487
  @click.option("--show", default=5, help="Number of runs to show")
455
488
  @click.option("--append", is_flag=True, default=False, help="Append run")
456
489
  @click.option("--skip-console", is_flag=True, default=False, help="Skip console logs")
490
+ @click.option(
491
+ "--replace-tags",
492
+ help="Replace tags in the format 'old_tag1=new_tag1,old_tag2=new_tag2'",
493
+ )
457
494
  @display_error
458
495
  def sync(
459
496
  ctx,
@@ -479,6 +516,7 @@ def sync(
479
516
  clean_force=None,
480
517
  append=None,
481
518
  skip_console=None,
519
+ replace_tags=None,
482
520
  ):
483
521
  api = _get_cling_api()
484
522
  if not api.is_authenticated:
@@ -493,6 +531,10 @@ def sync(
493
531
  if exclude_globs:
494
532
  exclude_globs = exclude_globs.split(",")
495
533
 
534
+ replace_tags_dict = _parse_sync_replace_tags(replace_tags)
535
+ if replace_tags and replace_tags_dict is None:
536
+ return # Error already printed by helper function
537
+
496
538
  def _summary():
497
539
  all_items = get_runs(
498
540
  include_online=True,
@@ -548,6 +590,7 @@ def sync(
548
590
  log_path=_wandb_log_path,
549
591
  append=append,
550
592
  skip_console=skip_console,
593
+ replace_tags=replace_tags_dict,
551
594
  )
552
595
  for p in _path:
553
596
  sm.add(p)
@@ -633,6 +676,31 @@ def sync(
633
676
  _summary()
634
677
 
635
678
 
679
+ def _parse_sync_replace_tags(replace_tags: str) -> Optional[Dict[str, str]]:
680
+ """Parse replace_tags string into a dictionary.
681
+
682
+ Args:
683
+ replace_tags: String in format 'old_tag1=new_tag1,old_tag2=new_tag2'
684
+
685
+ Returns:
686
+ Mapping of old tags to new tags, or None if format is invalid
687
+ """
688
+ if not replace_tags:
689
+ return {}
690
+
691
+ replace_tags_dict = {}
692
+ for pair in replace_tags.split(","):
693
+ if "=" not in pair:
694
+ wandb.termerror(
695
+ f"Invalid replace-tags format: {pair}. Use 'old_tag=new_tag' format."
696
+ )
697
+ return None
698
+ old_tag, new_tag = pair.split("=", 1)
699
+ replace_tags_dict[old_tag.strip()] = new_tag.strip()
700
+
701
+ return replace_tags_dict
702
+
703
+
636
704
  @cli.command(
637
705
  context_settings=CONTEXT,
638
706
  help="Initialize a hyperparameter sweep. Search for hyperparameters that optimizes a cost function of a machine learning model by testing various combinations.",
@@ -1829,6 +1897,15 @@ def describe(job):
1829
1897
  "job_type",
1830
1898
  type=click.Choice(("git", "code", "image")),
1831
1899
  )
1900
+ @click.option(
1901
+ "--service",
1902
+ "-s",
1903
+ "services",
1904
+ multiple=True,
1905
+ callback=parse_service_config,
1906
+ help="Service configurations in format serviceName=policy. Valid policies: always, never",
1907
+ hidden=True,
1908
+ )
1832
1909
  @click.argument("path")
1833
1910
  def create(
1834
1911
  path,
@@ -1844,6 +1921,7 @@ def create(
1844
1921
  build_context,
1845
1922
  base_image,
1846
1923
  dockerfile,
1924
+ services,
1847
1925
  ):
1848
1926
  """Create a job from a source, without a wandb run.
1849
1927
 
@@ -1893,6 +1971,7 @@ def create(
1893
1971
  build_context=build_context,
1894
1972
  base_image=base_image,
1895
1973
  dockerfile=dockerfile,
1974
+ services=services,
1896
1975
  )
1897
1976
  if not artifact:
1898
1977
  wandb.termerror("Job creation failed")
wandb/env.py CHANGED
@@ -159,6 +159,14 @@ def is_offline(env: MutableMapping | None = None) -> bool:
159
159
  return env.get(MODE) == "offline"
160
160
 
161
161
 
162
+ def is_quiet() -> bool:
163
+ return _env_as_bool(QUIET, default="false")
164
+
165
+
166
+ def is_silent() -> bool:
167
+ return _env_as_bool(SILENT, default="false")
168
+
169
+
162
170
  def error_reporting_enabled() -> bool:
163
171
  return _env_as_bool(ERROR_REPORTING, default="True")
164
172
 
wandb/errors/errors.py CHANGED
@@ -2,7 +2,10 @@ from typing import Optional
2
2
 
3
3
 
4
4
  class Error(Exception):
5
- """Base W&B Error."""
5
+ """Base W&B Error.
6
+
7
+ <!-- lazydoc-ignore-class: internal -->
8
+ """
6
9
 
7
10
  def __init__(self, message, context: Optional[dict] = None) -> None:
8
11
  super().__init__(message)
@@ -9,7 +9,6 @@ from typing_extensions import override
9
9
  import wandb
10
10
  from wandb import Artifact
11
11
  from wandb.sdk.lib import telemetry
12
- from wandb.sdk.wandb_run import Run
13
12
 
14
13
  try:
15
14
  import lightning
@@ -295,7 +294,7 @@ class WandbLogger(Logger):
295
294
  anonymous: Optional[bool] = None,
296
295
  project: Optional[str] = None,
297
296
  log_model: Union[Literal["all"], bool] = False,
298
- experiment: Optional["Run"] = None,
297
+ experiment: Optional["wandb.Run"] = None,
299
298
  prefix: str = "",
300
299
  checkpoint_name: Optional[str] = None,
301
300
  log_checkpoint_on: Union[Literal["success"], Literal["all"]] = "success",
@@ -362,7 +361,7 @@ class WandbLogger(Logger):
362
361
 
363
362
  @property
364
363
  @rank_zero_experiment
365
- def experiment(self) -> "Run":
364
+ def experiment(self) -> "wandb.Run":
366
365
  r"""Actual wandb object.
367
366
 
368
367
  To use wandb features in your :class:`~lightning.pytorch.core.LightningModule`, do the
@@ -395,7 +394,7 @@ class WandbLogger(Logger):
395
394
  self._experiment = wandb.init(**self._wandb_init)
396
395
 
397
396
  # define default x-axis
398
- if isinstance(self._experiment, Run) and getattr(
397
+ if isinstance(self._experiment, wandb.Run) and getattr(
399
398
  self._experiment, "define_metric", None
400
399
  ):
401
400
  self._experiment.define_metric("trainer/global_step")
@@ -1,3 +1,9 @@
1
+ """W&B Integration for Metaflow.
2
+
3
+ Defines a custom step and flow decorator `wandb_log` that automatically logs
4
+ flow parameters and artifacts to W&B.
5
+ """
6
+
1
7
  from .metaflow import wandb_log, wandb_track, wandb_use
2
8
 
3
9
  __all__ = ["wandb_log", "wandb_track", "wandb_use"]
@@ -0,0 +1,74 @@
1
+ """Support for Pandas datatypes.
2
+
3
+ May raise MissingDependencyError on import.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing_extensions import Any, TypeGuard
9
+
10
+ import wandb
11
+
12
+ from . import errors
13
+
14
+ try:
15
+ import pandas as pd
16
+ except ImportError as e:
17
+ warning = (
18
+ "`pandas` not installed >>"
19
+ " @wandb_log(datasets=True) may not auto log your dataset!"
20
+ )
21
+ raise errors.MissingDependencyError(warning=warning) from e
22
+
23
+
24
+ def is_dataframe(data: Any) -> TypeGuard[pd.DataFrame]:
25
+ """Returns whether the data is a Pandas DataFrame."""
26
+ return isinstance(data, pd.DataFrame)
27
+
28
+
29
+ def use_dataframe(
30
+ name: str,
31
+ run: wandb.Run | None,
32
+ testing: bool = False,
33
+ ) -> str | None:
34
+ """Log a dependency on a DataFrame input.
35
+
36
+ Args:
37
+ name: Name of the input.
38
+ run: The run to update.
39
+ testing: True in unit tests.
40
+ """
41
+ if testing:
42
+ return "datasets"
43
+ assert run
44
+
45
+ wandb.termlog(f"Using artifact: {name} (Pandas DataFrame)")
46
+ run.use_artifact(f"{name}:latest")
47
+ return None
48
+
49
+
50
+ def track_dataframe(
51
+ name: str,
52
+ data: pd.DataFrame,
53
+ run: wandb.Run | None,
54
+ testing: bool = False,
55
+ ) -> str | None:
56
+ """Log a DataFrame output as an artifact.
57
+
58
+ Args:
59
+ name: The output's name.
60
+ data: The output's value.
61
+ run: The run to update.
62
+ testing: True in unit tests.
63
+ """
64
+ if testing:
65
+ return "pd.DataFrame"
66
+ assert run
67
+
68
+ artifact = wandb.Artifact(name, type="dataset")
69
+ with artifact.new_file(f"{name}.parquet", "wb") as f:
70
+ data.to_parquet(f, engine="pyarrow")
71
+
72
+ wandb.termlog(f"Logging artifact: {name} (Pandas DataFrame)")
73
+ run.log_artifact(artifact)
74
+ return None
@@ -0,0 +1,13 @@
1
+ import wandb
2
+
3
+
4
+ class MissingDependencyError(Exception):
5
+ """An optional dependency is missing."""
6
+
7
+ def __init__(self, *args: object, warning: str) -> None:
8
+ super().__init__(*args)
9
+ self._wb_warning = warning
10
+
11
+ def warn(self) -> None:
12
+ """Print a warning for the problem."""
13
+ wandb.termwarn(self._wb_warning)