wandb 0.20.2rc20250616__py3-none-macosx_11_0_arm64.whl → 0.21.1__py3-none-macosx_11_0_arm64.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 +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
@@ -1,7 +1,12 @@
1
- """Public API: reports."""
1
+ """W&B Public API for Report objects.
2
+
3
+ This module provides classes for interacting with W&B reports and
4
+ managing report-related data.
5
+ """
2
6
 
3
7
  import ast
4
8
  import json
9
+ import re
5
10
  import urllib
6
11
 
7
12
  from wandb_gql import gql
@@ -14,7 +19,17 @@ from wandb.sdk.lib import ipython
14
19
 
15
20
 
16
21
  class Reports(SizedPaginator["BetaReport"]):
17
- """Reports is an iterable collection of `BetaReport` objects."""
22
+ """Reports is a lazy iterator of `BetaReport` objects.
23
+
24
+ Args:
25
+ client (`wandb.apis.internal.Api`): The API client instance to use.
26
+ project (`wandb.sdk.internal.Project`): The project to fetch reports from.
27
+ name (str, optional): The name of the report to filter by. If `None`,
28
+ fetches all reports.
29
+ entity (str, optional): The entity name for the project. Defaults to
30
+ the project entity.
31
+ per_page (int): Number of reports to fetch per page (default is 50).
32
+ """
18
33
 
19
34
  QUERY = gql(
20
35
  """
@@ -32,9 +47,11 @@ class Reports(SizedPaginator["BetaReport"]):
32
47
  user {
33
48
  username
34
49
  photoUrl
50
+ email
35
51
  }
36
52
  spec
37
53
  updatedAt
54
+ createdAt
38
55
  }
39
56
  cursor
40
57
  }
@@ -60,7 +77,11 @@ class Reports(SizedPaginator["BetaReport"]):
60
77
  super().__init__(client, variables, per_page)
61
78
 
62
79
  @property
63
- def length(self):
80
+ def _length(self):
81
+ """The number of reports in the project.
82
+
83
+ <!-- lazydoc-ignore: internal -->
84
+ """
64
85
  # TODO: Add the count the backend
65
86
  if self.last_response:
66
87
  return len(self.objects)
@@ -68,25 +89,37 @@ class Reports(SizedPaginator["BetaReport"]):
68
89
  return None
69
90
 
70
91
  @property
71
- def more(self):
92
+ def more(self) -> bool:
93
+ """Returns whether there are more files to fetch.
94
+
95
+ <!-- lazydoc-ignore: internal -->
96
+ """
72
97
  if self.last_response:
73
- return self.last_response["project"]["allViews"]["pageInfo"]["hasNextPage"]
98
+ return bool(
99
+ self.last_response["project"]["allViews"]["pageInfo"]["hasNextPage"]
100
+ )
74
101
  else:
75
102
  return True
76
103
 
77
104
  @property
78
105
  def cursor(self):
106
+ """Returns the cursor position for pagination of file results.
107
+
108
+ <!-- lazydoc-ignore: internal -->
109
+ """
79
110
  if self.last_response:
80
111
  return self.last_response["project"]["allViews"]["edges"][-1]["cursor"]
81
112
  else:
82
113
  return None
83
114
 
84
115
  def update_variables(self):
116
+ """Updates the GraphQL query variables for pagination."""
85
117
  self.variables.update(
86
118
  {"reportCursor": self.cursor, "reportLimit": self.per_page}
87
119
  )
88
120
 
89
121
  def convert_objects(self):
122
+ """Converts GraphQL edges to File objects."""
90
123
  if self.last_response["project"] is None:
91
124
  raise ValueError(
92
125
  f"Project {self.variables['project']} does not exist under entity {self.variables['entity']}"
@@ -106,16 +139,20 @@ class Reports(SizedPaginator["BetaReport"]):
106
139
 
107
140
 
108
141
  class BetaReport(Attrs):
109
- """BetaReport is a class associated with reports created in wandb.
142
+ """BetaReport is a class associated with reports created in W&B.
110
143
 
111
144
  WARNING: this API will likely change in a future release
112
145
 
113
146
  Attributes:
147
+ id (string): unique identifier of the report
114
148
  name (string): report name
115
- description (string): report description;
116
- user (User): the user that created the report
117
- spec (dict): the spec off the report;
149
+ display_name (string): display name of the report
150
+ description (string): report description
151
+ user (User): the user that created the report (contains username and email)
152
+ spec (dict): the spec of the report
153
+ url (string): the url of the report
118
154
  updated_at (string): timestamp of last update
155
+ created_at (string): timestamp when the report was created
119
156
  """
120
157
 
121
158
  def __init__(self, client, attrs, entity=None, project=None):
@@ -124,13 +161,24 @@ class BetaReport(Attrs):
124
161
  self.entity = entity
125
162
  self.query_generator = public.QueryGenerator()
126
163
  super().__init__(dict(attrs))
127
- self._attrs["spec"] = json.loads(self._attrs["spec"])
164
+
165
+ if "spec" in self._attrs:
166
+ if isinstance(self._attrs["spec"], str):
167
+ self._attrs["spec"] = json.loads(self._attrs["spec"])
168
+ else:
169
+ self._attrs["spec"] = {}
170
+
171
+ @property
172
+ def spec(self):
173
+ return self._attrs["spec"]
128
174
 
129
175
  @property
130
176
  def sections(self):
177
+ """Get the panel sections (groups) from the report."""
131
178
  return self.spec["panelGroups"]
132
179
 
133
180
  def runs(self, section, per_page=50, only_selected=True):
181
+ """Get runs associated with a section of the report."""
134
182
  run_set_idx = section.get("openRunSet", 0)
135
183
  run_set = section["runSets"][run_set_idx]
136
184
  order = self.query_generator.key_to_server_path(run_set["sort"]["key"])
@@ -153,12 +201,44 @@ class BetaReport(Attrs):
153
201
  per_page=per_page,
154
202
  )
155
203
 
204
+ @property
205
+ def id(self):
206
+ return self._attrs.get("id")
207
+
208
+ @property
209
+ def name(self):
210
+ return self._attrs.get("name")
211
+
212
+ @property
213
+ def display_name(self):
214
+ return self._attrs.get("displayName")
215
+
216
+ @property
217
+ def description(self):
218
+ return self._attrs.get("description")
219
+
220
+ @property
221
+ def user(self):
222
+ return self._attrs.get("user")
223
+
156
224
  @property
157
225
  def updated_at(self):
158
- return self._attrs["updatedAt"]
226
+ return self._attrs.get("updatedAt")
227
+
228
+ @property
229
+ def created_at(self):
230
+ return self._attrs.get("createdAt")
159
231
 
160
232
  @property
161
233
  def url(self):
234
+ if (
235
+ not self.client
236
+ or not self.entity
237
+ or not self.project
238
+ or not self.display_name
239
+ or not self.id
240
+ ):
241
+ return None
162
242
  return self.client.app_url + "/".join(
163
243
  [
164
244
  self.entity,
@@ -166,7 +246,12 @@ class BetaReport(Attrs):
166
246
  "reports",
167
247
  "--".join(
168
248
  [
169
- urllib.parse.quote(self.display_name.replace(" ", "-")),
249
+ # made this more closely match the url creation in the frontend (https://github.com/wandb/core/blob/76943979c8e967f7a62dae8bef0a001a2672584c/frontends/app/src/util/report/urls.ts#L19)
250
+ urllib.parse.quote(
251
+ re.sub(
252
+ r"-+", "-", re.sub(r"\W", "-", self.display_name)
253
+ ).strip("-")
254
+ ),
170
255
  self.id.replace("=", ""),
171
256
  ]
172
257
  ),
@@ -175,7 +260,10 @@ class BetaReport(Attrs):
175
260
 
176
261
  def to_html(self, height=1024, hidden=False):
177
262
  """Generate HTML containing an iframe displaying this report."""
178
- url = self.url + "?jupyter=true"
263
+ url = self.url
264
+ if url is None:
265
+ return "<div>Report URL not available</div>"
266
+ url = url + "?jupyter=true"
179
267
  style = f"border:none;width:100%;height:{height}px;"
180
268
  prefix = ""
181
269
  if hidden:
@@ -188,6 +276,11 @@ class BetaReport(Attrs):
188
276
 
189
277
 
190
278
  class PythonMongoishQueryGenerator:
279
+ """Converts Python-style query expressions to MongoDB-style queries for W&B reports.
280
+
281
+ <!-- lazydoc-ignore-class: internal -->
282
+ """
283
+
191
284
  SPACER = "----------"
192
285
  DECIMAL_SPACER = ";;;"
193
286
  FRONTEND_NAME_MAPPING = {
@@ -298,6 +391,10 @@ class PythonMongoishQueryGenerator:
298
391
  return field_name.replace(self.SPACER, ".") # Allow dotted fields
299
392
 
300
393
  def python_to_mongo(self, filterstr):
394
+ """Convert Python expresion to MongoDB filter.
395
+
396
+ <!-- lazydoc-ignore: internal -->
397
+ """
301
398
  try:
302
399
  tree = ast.parse(self._convert(filterstr), mode="eval")
303
400
  except SyntaxError as e:
@@ -316,6 +413,10 @@ class PythonMongoishQueryGenerator:
316
413
  return {"$or": [{op: values}]}
317
414
 
318
415
  def front_to_back(self, name):
416
+ """Convert frontend metric names to backend field names.
417
+
418
+ <!-- lazydoc-ignore: internal -->
419
+ """
319
420
  name, *rest = name.split(".")
320
421
  rest = "." + ".".join(rest) if rest else ""
321
422
 
@@ -329,6 +430,10 @@ class PythonMongoishQueryGenerator:
329
430
  return f"summary_metrics.{name}{rest}"
330
431
 
331
432
  def back_to_front(self, name):
433
+ """Convert backend field names to frontend metric names.
434
+
435
+ <!-- lazydoc-ignore: internal -->
436
+ """
332
437
  if name in self.FRONTEND_NAME_MAPPING_REVERSED:
333
438
  return self.FRONTEND_NAME_MAPPING_REVERSED[name]
334
439
  elif name in self.FRONTEND_NAME_MAPPING:
@@ -345,6 +450,10 @@ class PythonMongoishQueryGenerator:
345
450
 
346
451
  # These are only used for ParallelCoordinatesPlot because it has weird backend names...
347
452
  def pc_front_to_back(self, name):
453
+ """Convert ParallelCoordinatesPlot to backend field names.
454
+
455
+ <!-- lazydoc-ignore: internal -->
456
+ """
348
457
  name, *rest = name.split(".")
349
458
  rest = "." + ".".join(rest) if rest else ""
350
459
  if name is None:
@@ -361,6 +470,10 @@ class PythonMongoishQueryGenerator:
361
470
  return f"summary:{name}{rest}"
362
471
 
363
472
  def pc_back_to_front(self, name):
473
+ """Convert backend backend field names to ParallelCoordinatesPlot names.
474
+
475
+ <!-- lazydoc-ignore: internal -->
476
+ """
364
477
  if name is None:
365
478
  return None
366
479
  elif "summary:" in name:
@@ -380,6 +493,11 @@ class PythonMongoishQueryGenerator:
380
493
 
381
494
 
382
495
  class PanelMetricsHelper:
496
+ """Converts Python-style query expressions to MongoDB-style queries for W&B reports.
497
+
498
+ <!-- lazydoc-ignore-class: internal -->
499
+ """
500
+
383
501
  FRONTEND_NAME_MAPPING = {
384
502
  "Step": "_step",
385
503
  "Relative Time (Wall)": "_absolute_runtime",
@@ -392,17 +510,29 @@ class PanelMetricsHelper:
392
510
  RUN_MAPPING_REVERSED = {v: k for k, v in RUN_MAPPING.items()}
393
511
 
394
512
  def front_to_back(self, name):
513
+ """Convert frontend metric names to backend field names.
514
+
515
+ <!-- lazydoc-ignore: internal -->
516
+ """
395
517
  if name in self.FRONTEND_NAME_MAPPING:
396
518
  return self.FRONTEND_NAME_MAPPING[name]
397
519
  return name
398
520
 
399
521
  def back_to_front(self, name):
522
+ """Convert backend field names to frontend metric names.
523
+
524
+ <!-- lazydoc-ignore: internal -->
525
+ """
400
526
  if name in self.FRONTEND_NAME_MAPPING_REVERSED:
401
527
  return self.FRONTEND_NAME_MAPPING_REVERSED[name]
402
528
  return name
403
529
 
404
530
  # ScatterPlot and ParallelCoords have weird conventions
405
531
  def special_front_to_back(self, name):
532
+ """Convert frontend metric names to backend field names.
533
+
534
+ <!-- lazydoc-ignore: internal -->
535
+ """
406
536
  if name is None:
407
537
  return name
408
538
 
@@ -429,6 +559,10 @@ class PanelMetricsHelper:
429
559
  return "summary:" + name
430
560
 
431
561
  def special_back_to_front(self, name):
562
+ """Convert backend field names to frontend metric names.
563
+
564
+ <!-- lazydoc-ignore: internal -->
565
+ """
432
566
  if name is not None:
433
567
  kind, rest = name.split(":", 1)
434
568