wandb 0.20.2rc20250616__py3-none-any.whl → 0.21.0__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 (71) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +24 -23
  3. wandb/apis/internal.py +3 -0
  4. wandb/apis/paginator.py +17 -4
  5. wandb/apis/public/api.py +83 -2
  6. wandb/apis/public/artifacts.py +10 -8
  7. wandb/apis/public/files.py +5 -5
  8. wandb/apis/public/projects.py +44 -3
  9. wandb/apis/public/reports.py +64 -8
  10. wandb/apis/public/runs.py +16 -23
  11. wandb/automations/__init__.py +10 -10
  12. wandb/automations/_filters/run_metrics.py +0 -2
  13. wandb/automations/_utils.py +0 -2
  14. wandb/automations/actions.py +0 -2
  15. wandb/automations/automations.py +0 -2
  16. wandb/automations/events.py +0 -2
  17. wandb/bin/gpu_stats +0 -0
  18. wandb/integration/catboost/catboost.py +6 -2
  19. wandb/integration/kfp/kfp_patch.py +3 -1
  20. wandb/integration/sb3/sb3.py +3 -3
  21. wandb/integration/ultralytics/callback.py +6 -2
  22. wandb/plot/__init__.py +2 -0
  23. wandb/plot/bar.py +30 -29
  24. wandb/plot/confusion_matrix.py +75 -71
  25. wandb/plot/histogram.py +26 -25
  26. wandb/plot/line.py +33 -32
  27. wandb/plot/line_series.py +100 -103
  28. wandb/plot/pr_curve.py +33 -32
  29. wandb/plot/roc_curve.py +38 -38
  30. wandb/plot/scatter.py +27 -27
  31. wandb/proto/v3/wandb_internal_pb2.py +366 -385
  32. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  33. wandb/proto/v4/wandb_internal_pb2.py +352 -356
  34. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  35. wandb/proto/v5/wandb_internal_pb2.py +352 -356
  36. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  37. wandb/proto/v6/wandb_internal_pb2.py +352 -356
  38. wandb/proto/v6/wandb_settings_pb2.py +2 -2
  39. wandb/sdk/artifacts/_generated/__init__.py +12 -1
  40. wandb/sdk/artifacts/_generated/input_types.py +20 -2
  41. wandb/sdk/artifacts/_generated/link_artifact.py +21 -0
  42. wandb/sdk/artifacts/_generated/operations.py +9 -0
  43. wandb/sdk/artifacts/_validators.py +40 -2
  44. wandb/sdk/artifacts/artifact.py +163 -21
  45. wandb/sdk/data_types/base_types/media.py +9 -7
  46. wandb/sdk/data_types/base_types/wb_value.py +6 -6
  47. wandb/sdk/data_types/saved_model.py +3 -3
  48. wandb/sdk/data_types/table.py +41 -41
  49. wandb/sdk/data_types/trace_tree.py +12 -12
  50. wandb/sdk/interface/interface.py +8 -19
  51. wandb/sdk/interface/interface_shared.py +7 -16
  52. wandb/sdk/internal/datastore.py +18 -18
  53. wandb/sdk/internal/handler.py +3 -5
  54. wandb/sdk/internal/internal_api.py +54 -0
  55. wandb/sdk/internal/sender.py +23 -3
  56. wandb/sdk/internal/sender_config.py +9 -0
  57. wandb/sdk/launch/_project_spec.py +3 -3
  58. wandb/sdk/launch/agent/agent.py +3 -3
  59. wandb/sdk/launch/agent/job_status_tracker.py +3 -1
  60. wandb/sdk/launch/utils.py +3 -3
  61. wandb/sdk/lib/console_capture.py +66 -19
  62. wandb/sdk/wandb_init.py +1 -2
  63. wandb/sdk/wandb_require.py +0 -1
  64. wandb/sdk/wandb_run.py +23 -113
  65. wandb/sdk/wandb_settings.py +234 -72
  66. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.0.dist-info}/METADATA +1 -1
  67. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.0.dist-info}/RECORD +70 -70
  68. wandb/sdk/wandb_metadata.py +0 -623
  69. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.0.dist-info}/WHEEL +0 -0
  70. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.0.dist-info}/entry_points.txt +0 -0
  71. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,5 @@
1
1
  """Events that trigger W&B Automations."""
2
2
 
3
- # ruff: noqa: UP007 # Avoid using `X | Y` for union fields, as this can cause issues with pydantic < 2.6
4
-
5
3
  from __future__ import annotations
6
4
 
7
5
  from typing import TYPE_CHECKING, Any, Literal, Optional, Union
wandb/bin/gpu_stats CHANGED
Binary file
@@ -22,7 +22,9 @@ class WandbCallback:
22
22
 
23
23
  Example:
24
24
  ```
25
- train_pool = Pool(train[features], label=train["label"], cat_features=cat_features)
25
+ train_pool = Pool(
26
+ train[features], label=train["label"], cat_features=cat_features
27
+ )
26
28
  test_pool = Pool(test[features], label=test["label"], cat_features=cat_features)
27
29
 
28
30
  model = CatBoostRegressor(
@@ -130,7 +132,9 @@ def log_summary(
130
132
 
131
133
  Example:
132
134
  ```python
133
- train_pool = Pool(train[features], label=train["label"], cat_features=cat_features)
135
+ train_pool = Pool(
136
+ train[features], label=train["label"], cat_features=cat_features
137
+ )
134
138
  test_pool = Pool(test[features], label=test["label"], cat_features=cat_features)
135
139
 
136
140
  model = CatBoostRegressor(
@@ -270,7 +270,9 @@ def create_component_from_func(
270
270
  Example of a component function declaring file input and output::
271
271
 
272
272
  def catboost_train_classifier(
273
- training_data_path: InputPath("CSV"), # Path to input data file of type "CSV"
273
+ training_data_path: InputPath(
274
+ "CSV"
275
+ ), # Path to input data file of type "CSV"
274
276
  trained_model_path: OutputPath(
275
277
  "CatBoostModel"
276
278
  ), # Path to output data file of type "CatBoostModel"
@@ -106,9 +106,9 @@ class WandbCallback(BaseCallback):
106
106
  os.makedirs(self.model_save_path, exist_ok=True)
107
107
  self.path = os.path.join(self.model_save_path, "model.zip")
108
108
  else:
109
- assert (
110
- self.model_save_freq == 0
111
- ), "to use the `model_save_freq` you have to set the `model_save_path` parameter"
109
+ assert self.model_save_freq == 0, (
110
+ "to use the `model_save_freq` you have to set the `model_save_path` parameter"
111
+ )
112
112
 
113
113
  def _init_callback(self) -> None:
114
114
  d = {}
@@ -102,7 +102,9 @@ class WandBUltralyticsCallback:
102
102
  model = YOLO("yolov8n.pt")
103
103
 
104
104
  # add wandb callback
105
- add_wandb_callback(model, max_validation_batches=2, enable_model_checkpointing=True)
105
+ add_wandb_callback(
106
+ model, max_validation_batches=2, enable_model_checkpointing=True
107
+ )
106
108
 
107
109
  # train
108
110
  model.train(data="coco128.yaml", epochs=5, imgsz=640)
@@ -454,7 +456,9 @@ def add_wandb_callback(
454
456
  model = YOLO("yolov8n.pt")
455
457
 
456
458
  # add wandb callback
457
- add_wandb_callback(model, max_validation_batches=2, enable_model_checkpointing=True)
459
+ add_wandb_callback(
460
+ model, max_validation_batches=2, enable_model_checkpointing=True
461
+ )
458
462
 
459
463
  # train
460
464
  model.train(data="coco128.yaml", epochs=5, imgsz=640)
wandb/plot/__init__.py CHANGED
@@ -14,6 +14,8 @@ __all__ = [
14
14
  "pr_curve",
15
15
  "confusion_matrix",
16
16
  "line_series",
17
+ "plot_table",
18
+ "visualize", # doc:exclude
17
19
  ]
18
20
 
19
21
  from wandb.plot.bar import bar
wandb/plot/bar.py CHANGED
@@ -19,11 +19,11 @@ def bar(
19
19
  """Constructs a bar chart from a wandb.Table of data.
20
20
 
21
21
  Args:
22
- table (wandb.Table): A table containing the data for the bar chart.
23
- label (str): The name of the column to use for the labels of each bar.
24
- value (str): The name of the column to use for the values of each bar.
25
- title (str): The title of the bar chart.
26
- split_table (bool): Whether the table should be split into a separate section
22
+ table: A table containing the data for the bar chart.
23
+ label: The name of the column to use for the labels of each bar.
24
+ value: The name of the column to use for the values of each bar.
25
+ title: The title of the bar chart.
26
+ split_table: Whether the table should be split into a separate section
27
27
  in the W&B UI. If `True`, the table will be displayed in a section named
28
28
  "Custom Chart Tables". Default is `False`.
29
29
 
@@ -32,34 +32,35 @@ def bar(
32
32
  chart, pass it to `wandb.log()`.
33
33
 
34
34
  Example:
35
- ```
36
- import random
37
- import wandb
38
35
 
39
- # Generate random data for the table
40
- data = [
41
- ["car", random.uniform(0, 1)],
42
- ["bus", random.uniform(0, 1)],
43
- ["road", random.uniform(0, 1)],
44
- ["person", random.uniform(0, 1)],
45
- ]
36
+ ```python
37
+ import random
38
+ import wandb
39
+
40
+ # Generate random data for the table
41
+ data = [
42
+ ["car", random.uniform(0, 1)],
43
+ ["bus", random.uniform(0, 1)],
44
+ ["road", random.uniform(0, 1)],
45
+ ["person", random.uniform(0, 1)],
46
+ ]
46
47
 
47
- # Create a table with the data
48
- table = wandb.Table(data=data, columns=["class", "accuracy"])
48
+ # Create a table with the data
49
+ table = wandb.Table(data=data, columns=["class", "accuracy"])
49
50
 
50
- # Initialize a W&B run and log the bar plot
51
- with wandb.init(project="bar_chart") as run:
52
- # Create a bar plot from the table
53
- bar_plot = wandb.plot.bar(
54
- table=table,
55
- label="class",
56
- value="accuracy",
57
- title="Object Classification Accuracy",
58
- )
51
+ # Initialize a W&B run and log the bar plot
52
+ with wandb.init(project="bar_chart") as run:
53
+ # Create a bar plot from the table
54
+ bar_plot = wandb.plot.bar(
55
+ table=table,
56
+ label="class",
57
+ value="accuracy",
58
+ title="Object Classification Accuracy",
59
+ )
59
60
 
60
- # Log the bar chart to W&B
61
- run.log({"bar_plot": bar_plot})
62
- ```
61
+ # Log the bar chart to W&B
62
+ run.log({"bar_plot": bar_plot})
63
+ ```
63
64
  """
64
65
  return plot_table(
65
66
  data_table=table,
@@ -23,16 +23,16 @@ def confusion_matrix(
23
23
  """Constructs a confusion matrix from a sequence of probabilities or predictions.
24
24
 
25
25
  Args:
26
- probs (Sequence[Sequence[float]] | None): A sequence of predicted probabilities for each
26
+ probs: A sequence of predicted probabilities for each
27
27
  class. The sequence shape should be (N, K) where N is the number of samples
28
28
  and K is the number of classes. If provided, `preds` should not be provided.
29
- y_true (Sequence[T] | None): A sequence of true labels.
30
- preds (Sequence[T] | None): A sequence of predicted class labels. If provided,
29
+ y_true: A sequence of true labels.
30
+ preds: A sequence of predicted class labels. If provided,
31
31
  `probs` should not be provided.
32
- class_names (Sequence[str] | None): Sequence of class names. If not
32
+ class_names: Sequence of class names. If not
33
33
  provided, class names will be defined as "Class_1", "Class_2", etc.
34
- title (str): Title of the confusion matrix chart.
35
- split_table (bool): Whether the table should be split into a separate section
34
+ title: Title of the confusion matrix chart.
35
+ split_table: Whether the table should be split into a separate section
36
36
  in the W&B UI. If `True`, the table will be displayed in a section named
37
37
  "Custom Chart Tables". Default is `False`.
38
38
 
@@ -48,75 +48,79 @@ def confusion_matrix(
48
48
  wandb.Error: If numpy is not installed.
49
49
 
50
50
  Examples:
51
- 1. Logging a confusion matrix with random probabilities for wildlife
52
- classification:
53
- ```
54
- import numpy as np
55
- import wandb
56
-
57
- # Define class names for wildlife
58
- wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
59
-
60
- # Generate random true labels (0 to 3 for 10 samples)
61
- wildlife_y_true = np.random.randint(0, 4, size=10)
62
-
63
- # Generate random probabilities for each class (10 samples x 4 classes)
64
- wildlife_probs = np.random.rand(10, 4)
65
- wildlife_probs = np.exp(wildlife_probs) / np.sum(
66
- np.exp(wildlife_probs),
67
- axis=1,
68
- keepdims=True,
51
+ Logging a confusion matrix with random probabilities for wildlife
52
+ classification:
53
+
54
+ ```python
55
+ import numpy as np
56
+ import wandb
57
+
58
+ # Define class names for wildlife
59
+ wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
60
+
61
+ # Generate random true labels (0 to 3 for 10 samples)
62
+ wildlife_y_true = np.random.randint(0, 4, size=10)
63
+
64
+ # Generate random probabilities for each class (10 samples x 4 classes)
65
+ wildlife_probs = np.random.rand(10, 4)
66
+ wildlife_probs = np.exp(wildlife_probs) / np.sum(
67
+ np.exp(wildlife_probs),
68
+ axis=1,
69
+ keepdims=True,
70
+ )
71
+
72
+ # Initialize W&B run and log confusion matrix
73
+ with wandb.init(project="wildlife_classification") as run:
74
+ confusion_matrix = wandb.plot.confusion_matrix(
75
+ probs=wildlife_probs,
76
+ y_true=wildlife_y_true,
77
+ class_names=wildlife_class_names,
78
+ title="Wildlife Classification Confusion Matrix",
69
79
  )
80
+ run.log({"wildlife_confusion_matrix": confusion_matrix})
81
+ ```
82
+
83
+ In this example, random probabilities are used to generate a confusion
84
+ matrix.
85
+
86
+ Logging a confusion matrix with simulated model predictions and 85%
87
+ accuracy:
70
88
 
71
- # Initialize W&B run and log confusion matrix
72
- with wandb.init(project="wildlife_classification") as run:
73
- confusion_matrix = wandb.plot.confusion_matrix(
74
- probs=wildlife_probs,
75
- y_true=wildlife_y_true,
76
- class_names=wildlife_class_names,
77
- title="Wildlife Classification Confusion Matrix",
78
- )
79
- run.log({"wildlife_confusion_matrix": confusion_matrix})
80
- ```
81
- In this example, random probabilities are used to generate a confusion
82
- matrix.
83
-
84
- 2. Logging a confusion matrix with simulated model predictions and 85%
85
- accuracy:
86
- ```
87
- import numpy as np
88
- import wandb
89
-
90
- # Define class names for wildlife
91
- wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
92
-
93
- # Simulate true labels for 200 animal images (imbalanced distribution)
94
- wildlife_y_true = np.random.choice(
95
- [0, 1, 2, 3],
96
- size=200,
97
- p=[0.2, 0.3, 0.25, 0.25],
89
+ ```python
90
+ import numpy as np
91
+ import wandb
92
+
93
+ # Define class names for wildlife
94
+ wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
95
+
96
+ # Simulate true labels for 200 animal images (imbalanced distribution)
97
+ wildlife_y_true = np.random.choice(
98
+ [0, 1, 2, 3],
99
+ size=200,
100
+ p=[0.2, 0.3, 0.25, 0.25],
101
+ )
102
+
103
+ # Simulate model predictions with 85% accuracy
104
+ wildlife_preds = [
105
+ y_t
106
+ if np.random.rand() < 0.85
107
+ else np.random.choice([x for x in range(4) if x != y_t])
108
+ for y_t in wildlife_y_true
109
+ ]
110
+
111
+ # Initialize W&B run and log confusion matrix
112
+ with wandb.init(project="wildlife_classification") as run:
113
+ confusion_matrix = wandb.plot.confusion_matrix(
114
+ preds=wildlife_preds,
115
+ y_true=wildlife_y_true,
116
+ class_names=wildlife_class_names,
117
+ title="Simulated Wildlife Classification Confusion Matrix",
98
118
  )
119
+ run.log({"wildlife_confusion_matrix": confusion_matrix})
120
+ ```
99
121
 
100
- # Simulate model predictions with 85% accuracy
101
- wildlife_preds = [
102
- y_t
103
- if np.random.rand() < 0.85
104
- else np.random.choice([x for x in range(4) if x != y_t])
105
- for y_t in wildlife_y_true
106
- ]
107
-
108
- # Initialize W&B run and log confusion matrix
109
- with wandb.init(project="wildlife_classification") as run:
110
- confusion_matrix = wandb.plot.confusion_matrix(
111
- preds=wildlife_preds,
112
- y_true=wildlife_y_true,
113
- class_names=wildlife_class_names,
114
- title="Simulated Wildlife Classification Confusion Matrix"
115
- )
116
- run.log({"wildlife_confusion_matrix": confusion_matrix})
117
- ```
118
- In this example, predictions are simulated with 85% accuracy to generate a
119
- confusion matrix.
122
+ In this example, predictions are simulated with 85% accuracy to generate a
123
+ confusion matrix.
120
124
  """
121
125
  np = util.get_module(
122
126
  "numpy",
wandb/plot/histogram.py CHANGED
@@ -18,10 +18,10 @@ def histogram(
18
18
  """Constructs a histogram chart from a W&B Table.
19
19
 
20
20
  Args:
21
- table (wandb.Table): The W&B Table containing the data for the histogram.
22
- value (str): The label for the bin axis (x-axis).
23
- title (str): The title of the histogram plot.
24
- split_table (bool): Whether the table should be split into a separate section
21
+ table: The W&B Table containing the data for the histogram.
22
+ value: The label for the bin axis (x-axis).
23
+ title: The title of the histogram plot.
24
+ split_table: Whether the table should be split into a separate section
25
25
  in the W&B UI. If `True`, the table will be displayed in a section named
26
26
  "Custom Chart Tables". Default is `False`.
27
27
 
@@ -30,31 +30,32 @@ def histogram(
30
30
  chart, pass it to `wandb.log()`.
31
31
 
32
32
  Example:
33
- ```
34
- import math
35
- import random
36
- import wandb
37
33
 
38
- # Generate random data
39
- data = [[i, random.random() + math.sin(i / 10)] for i in range(100)]
34
+ ```python
35
+ import math
36
+ import random
37
+ import wandb
38
+
39
+ # Generate random data
40
+ data = [[i, random.random() + math.sin(i / 10)] for i in range(100)]
40
41
 
41
- # Create a W&B Table
42
- table = wandb.Table(
43
- data=data,
44
- columns=["step", "height"],
45
- )
42
+ # Create a W&B Table
43
+ table = wandb.Table(
44
+ data=data,
45
+ columns=["step", "height"],
46
+ )
46
47
 
47
- # Create a histogram plot
48
- histogram = wandb.plot.histogram(
49
- table,
50
- value="height",
51
- title="My Histogram",
52
- )
48
+ # Create a histogram plot
49
+ histogram = wandb.plot.histogram(
50
+ table,
51
+ value="height",
52
+ title="My Histogram",
53
+ )
53
54
 
54
- # Log the histogram plot to W&B
55
- with wandb.init(...) as run:
56
- run.log({"histogram-plot1": histogram})
57
- ```
55
+ # Log the histogram plot to W&B
56
+ with wandb.init(...) as run:
57
+ run.log({"histogram-plot1": histogram})
58
+ ```
58
59
  """
59
60
  return plot_table(
60
61
  data_table=table,
wandb/plot/line.py CHANGED
@@ -20,13 +20,13 @@ def line(
20
20
  """Constructs a customizable line chart.
21
21
 
22
22
  Args:
23
- table (wandb.Table): The table containing data for the chart.
24
- x (str): Column name for the x-axis values.
25
- y (str): Column name for the y-axis values.
26
- stroke (str):Column name to differentiate line strokes (e.g., for
23
+ table: The table containing data for the chart.
24
+ x: Column name for the x-axis values.
25
+ y: Column name for the y-axis values.
26
+ stroke: Column name to differentiate line strokes (e.g., for
27
27
  grouping lines).
28
- title (str):Title of the chart.
29
- split_table (bool): Whether the table should be split into a separate section
28
+ title: Title of the chart.
29
+ split_table: Whether the table should be split into a separate section
30
30
  in the W&B UI. If `True`, the table will be displayed in a section named
31
31
  "Custom Chart Tables". Default is `False`.
32
32
 
@@ -35,35 +35,36 @@ def line(
35
35
  chart, pass it to `wandb.log()`.
36
36
 
37
37
  Example:
38
- ```python
39
- import math
40
- import random
41
- import wandb
42
38
 
43
- # Create multiple series of data with different patterns
44
- data = []
45
- for i in range(100):
46
- # Series 1: Sinusoidal pattern with random noise
47
- data.append([i, math.sin(i / 10) + random.uniform(-0.1, 0.1), "series_1"])
48
- # Series 2: Cosine pattern with random noise
49
- data.append([i, math.cos(i / 10) + random.uniform(-0.1, 0.1), "series_2"])
50
- # Series 3: Linear increase with random noise
51
- data.append([i, i / 10 + random.uniform(-0.5, 0.5), "series_3"])
39
+ ```python
40
+ import math
41
+ import random
42
+ import wandb
43
+
44
+ # Create multiple series of data with different patterns
45
+ data = []
46
+ for i in range(100):
47
+ # Series 1: Sinusoidal pattern with random noise
48
+ data.append([i, math.sin(i / 10) + random.uniform(-0.1, 0.1), "series_1"])
49
+ # Series 2: Cosine pattern with random noise
50
+ data.append([i, math.cos(i / 10) + random.uniform(-0.1, 0.1), "series_2"])
51
+ # Series 3: Linear increase with random noise
52
+ data.append([i, i / 10 + random.uniform(-0.5, 0.5), "series_3"])
52
53
 
53
- # Define the columns for the table
54
- table = wandb.Table(data=data, columns=["step", "value", "series"])
54
+ # Define the columns for the table
55
+ table = wandb.Table(data=data, columns=["step", "value", "series"])
55
56
 
56
- # Initialize wandb run and log the line chart
57
- with wandb.init(project="line_chart_example") as run:
58
- line_chart = wandb.plot.line(
59
- table=table,
60
- x="step",
61
- y="value",
62
- stroke="series", # Group by the "series" column
63
- title="Multi-Series Line Plot",
64
- )
65
- run.log({"line-chart": line_chart})
66
- ```
57
+ # Initialize wandb run and log the line chart
58
+ with wandb.init(project="line_chart_example") as run:
59
+ line_chart = wandb.plot.line(
60
+ table=table,
61
+ x="step",
62
+ y="value",
63
+ stroke="series", # Group by the "series" column
64
+ title="Multi-Series Line Plot",
65
+ )
66
+ run.log({"line-chart": line_chart})
67
+ ```
67
68
  """
68
69
  return plot_table(
69
70
  data_table=table,