wandb 0.21.0__py3-none-win_amd64.whl → 0.21.1__py3-none-win_amd64.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.exe +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 +95 -95
  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
@@ -28,8 +28,6 @@ if TYPE_CHECKING: # pragma: no cover
28
28
 
29
29
  from wandb.sdk.artifacts.artifact import Artifact
30
30
 
31
- from ..wandb_run import Run as LocalRun
32
-
33
31
  ImageDataType = Union[
34
32
  "matplotlib.artist.Artist", "PILImage", "TorchTensorType", "np.ndarray"
35
33
  ]
@@ -101,7 +99,7 @@ def _convert_to_uint8(data: "np.ndarray") -> "np.ndarray":
101
99
  return data.astype(np.uint8)
102
100
 
103
101
 
104
- def _server_accepts_image_filenames(run: "LocalRun") -> bool:
102
+ def _server_accepts_image_filenames(run: "wandb.Run") -> bool:
105
103
  if run.offline:
106
104
  return True
107
105
 
@@ -117,7 +115,7 @@ def _server_accepts_image_filenames(run: "LocalRun") -> bool:
117
115
  return accepts_image_filenames
118
116
 
119
117
 
120
- def _server_accepts_artifact_path(run: "LocalRun") -> bool:
118
+ def _server_accepts_artifact_path(run: "wandb.Run") -> bool:
121
119
  if run.offline:
122
120
  return False
123
121
 
@@ -161,19 +159,18 @@ class Image(BatchableMedia):
161
159
  file_type: Optional[str] = None,
162
160
  normalize: bool = True,
163
161
  ) -> None:
164
- """Initialize a wandb.Image object.
162
+ """Initialize a `wandb.Image` object.
165
163
 
166
164
  Args:
167
- data_or_path: Accepts numpy array/pytorch tensor of image data,
168
- a PIL image object, or a path to an image file.
169
-
170
- If a numpy array or pytorch tensor is provided,
165
+ data_or_path: Accepts NumPy array/pytorch tensor of image data,
166
+ a PIL image object, or a path to an image file. If a NumPy
167
+ array or pytorch tensor is provided,
171
168
  the image data will be saved to the given file type.
172
169
  If the values are not in the range [0, 255] or all values are in the range [0, 1],
173
170
  the image pixel values will be normalized to the range [0, 255]
174
171
  unless `normalize` is set to False.
175
- - pytorch tensor should be in the format (channel, height, width)
176
- - numpy array should be in the format (height, width, channel)
172
+ - pytorch tensor should be in the format (channel, height, width)
173
+ - NumPy array should be in the format (height, width, channel)
177
174
  mode: The PIL mode for an image. Most common are "L", "RGB",
178
175
  "RGBA". Full explanation at https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes
179
176
  caption: Label for display of image.
@@ -190,53 +187,56 @@ class Image(BatchableMedia):
190
187
  Normalize is only applied if data_or_path is a numpy array or pytorch tensor.
191
188
 
192
189
  Examples:
193
- ### Create a wandb.Image from a numpy array
194
- ```python
195
- import numpy as np
196
- import wandb
197
-
198
- with wandb.init() as run:
199
- examples = []
200
- for i in range(3):
201
- pixels = np.random.randint(low=0, high=256, size=(100, 100, 3))
202
- image = wandb.Image(pixels, caption=f"random field {i}")
203
- examples.append(image)
204
- run.log({"examples": examples})
205
- ```
206
-
207
- ### Create a wandb.Image from a PILImage
208
- ```python
209
- import numpy as np
210
- from PIL import Image as PILImage
211
- import wandb
212
-
213
- with wandb.init() as run:
214
- examples = []
215
- for i in range(3):
216
- pixels = np.random.randint(
217
- low=0, high=256, size=(100, 100, 3), dtype=np.uint8
218
- )
219
- pil_image = PILImage.fromarray(pixels, mode="RGB")
220
- image = wandb.Image(pil_image, caption=f"random field {i}")
221
- examples.append(image)
222
- run.log({"examples": examples})
223
- ```
224
-
225
- ### log .jpg rather than .png (default)
226
- ```python
227
- import numpy as np
228
- import wandb
229
-
230
- with wandb.init() as run:
231
- examples = []
232
- for i in range(3):
233
- pixels = np.random.randint(low=0, high=256, size=(100, 100, 3))
234
- image = wandb.Image(
235
- pixels, caption=f"random field {i}", file_type="jpg"
236
- )
237
- examples.append(image)
238
- run.log({"examples": examples})
239
- ```
190
+ Create a wandb.Image from a numpy array
191
+
192
+ ```python
193
+ import numpy as np
194
+ import wandb
195
+
196
+ with wandb.init() as run:
197
+ examples = []
198
+ for i in range(3):
199
+ pixels = np.random.randint(low=0, high=256, size=(100, 100, 3))
200
+ image = wandb.Image(pixels, caption=f"random field {i}")
201
+ examples.append(image)
202
+ run.log({"examples": examples})
203
+ ```
204
+
205
+ Create a wandb.Image from a PILImage
206
+
207
+ ```python
208
+ import numpy as np
209
+ from PIL import Image as PILImage
210
+ import wandb
211
+
212
+ with wandb.init() as run:
213
+ examples = []
214
+ for i in range(3):
215
+ pixels = np.random.randint(
216
+ low=0, high=256, size=(100, 100, 3), dtype=np.uint8
217
+ )
218
+ pil_image = PILImage.fromarray(pixels, mode="RGB")
219
+ image = wandb.Image(pil_image, caption=f"random field {i}")
220
+ examples.append(image)
221
+ run.log({"examples": examples})
222
+ ```
223
+
224
+ Log .jpg rather than .png (default)
225
+
226
+ ```python
227
+ import numpy as np
228
+ import wandb
229
+
230
+ with wandb.init() as run:
231
+ examples = []
232
+ for i in range(3):
233
+ pixels = np.random.randint(low=0, high=256, size=(100, 100, 3))
234
+ image = wandb.Image(
235
+ pixels, caption=f"random field {i}", file_type="jpg"
236
+ )
237
+ examples.append(image)
238
+ run.log({"examples": examples})
239
+ ```
240
240
  """
241
241
  super().__init__(caption=caption)
242
242
  # TODO: We should remove grouping, it's a terrible name and I don't
@@ -442,6 +442,10 @@ class Image(BatchableMedia):
442
442
  def from_json(
443
443
  cls: Type["Image"], json_obj: dict, source_artifact: "Artifact"
444
444
  ) -> "Image":
445
+ """Factory method to create an Audio object from a JSON object.
446
+
447
+ "<!-- lazydoc-ignore-classmethod: internal -->
448
+ """
445
449
  classes: Optional[Classes] = None
446
450
  if json_obj.get("classes") is not None:
447
451
  value = source_artifact.get(json_obj["classes"]["path"])
@@ -476,16 +480,24 @@ class Image(BatchableMedia):
476
480
 
477
481
  @classmethod
478
482
  def get_media_subdir(cls: Type["Image"]) -> str:
483
+ """Get media subdirectory.
484
+
485
+ "<!-- lazydoc-ignore-classmethod: internal -->
486
+ """
479
487
  return os.path.join("media", "images")
480
488
 
481
489
  def bind_to_run(
482
490
  self,
483
- run: "LocalRun",
491
+ run: "wandb.Run",
484
492
  key: Union[int, str],
485
493
  step: Union[int, str],
486
494
  id_: Optional[Union[int, str]] = None,
487
495
  ignore_copy_err: Optional[bool] = None,
488
496
  ) -> None:
497
+ """Bind this object to a run.
498
+
499
+ <!-- lazydoc-ignore: internal -->
500
+ """
489
501
  # For Images, we are going to avoid copying the image file to the run.
490
502
  # We should make this common functionality for all media types, but that
491
503
  # requires a broader UI refactor. This model can easily be moved to the
@@ -519,9 +531,11 @@ class Image(BatchableMedia):
519
531
  run, key, step, id_, ignore_copy_err=ignore_copy_err
520
532
  )
521
533
 
522
- def to_json(self, run_or_artifact: Union["LocalRun", "Artifact"]) -> dict:
523
- from wandb.sdk.wandb_run import Run
534
+ def to_json(self, run_or_artifact: Union["wandb.Run", "Artifact"]) -> dict:
535
+ """Returns the JSON representation expected by the backend.
524
536
 
537
+ <!-- lazydoc-ignore: internal -->
538
+ """
525
539
  json_dict = super().to_json(run_or_artifact)
526
540
  json_dict["_type"] = Image._log_type
527
541
  json_dict["format"] = self.format
@@ -558,8 +572,8 @@ class Image(BatchableMedia):
558
572
  "digest": classes_entry.digest,
559
573
  }
560
574
 
561
- elif not isinstance(run_or_artifact, Run):
562
- raise TypeError("to_json accepts wandb_run.Run or wandb_artifact.Artifact")
575
+ elif not isinstance(run_or_artifact, wandb.Run):
576
+ raise TypeError("to_json accepts wandb.Run or wandb_artifact.Artifact")
563
577
 
564
578
  if self._boxes:
565
579
  json_dict["boxes"] = {
@@ -576,7 +590,10 @@ class Image(BatchableMedia):
576
590
  data: Union["np.ndarray", "torch.Tensor"],
577
591
  file_type: Optional[str] = None,
578
592
  ) -> str:
579
- """Guess what type of image the np.array is representing."""
593
+ """Guess what type of image the np.array is representing.
594
+
595
+ <!-- lazydoc-ignore: internal -->
596
+ """
580
597
  # TODO: do we want to support dimensions being at the beginning of the array?
581
598
  ndims = data.ndim
582
599
  if util.is_pytorch_tensor_typename(util.get_full_typename(data)):
@@ -608,11 +625,14 @@ class Image(BatchableMedia):
608
625
  def seq_to_json(
609
626
  cls: Type["Image"],
610
627
  seq: Sequence["BatchableMedia"],
611
- run: "LocalRun",
628
+ run: "wandb.Run",
612
629
  key: str,
613
630
  step: Union[int, str],
614
631
  ) -> dict:
615
- """Combine a list of images into a meta dictionary object describing the child images."""
632
+ """Convert a sequence of Image objects to a JSON representation.
633
+
634
+ "<!-- lazydoc-ignore-classmethod: internal -->
635
+ """
616
636
  if TYPE_CHECKING:
617
637
  seq = cast(Sequence["Image"], seq)
618
638
 
@@ -682,10 +702,14 @@ class Image(BatchableMedia):
682
702
  def all_masks(
683
703
  cls: Type["Image"],
684
704
  images: Sequence["Image"],
685
- run: "LocalRun",
705
+ run: "wandb.Run",
686
706
  run_key: str,
687
707
  step: Union[int, str],
688
708
  ) -> Union[List[Optional[dict]], bool]:
709
+ """Collect all masks from a list of images.
710
+
711
+ "<!-- lazydoc-ignore-classmethod: internal -->
712
+ """
689
713
  all_mask_groups: List[Optional[dict]] = []
690
714
  for image in images:
691
715
  if image._masks:
@@ -705,10 +729,14 @@ class Image(BatchableMedia):
705
729
  def all_boxes(
706
730
  cls: Type["Image"],
707
731
  images: Sequence["Image"],
708
- run: "LocalRun",
732
+ run: "wandb.Run",
709
733
  run_key: str,
710
734
  step: Union[int, str],
711
735
  ) -> Union[List[Optional[dict]], bool]:
736
+ """Collect all boxes from a list of images.
737
+
738
+ "<!-- lazydoc-ignore-classmethod: internal -->
739
+ """
712
740
  all_box_groups: List[Optional[dict]] = []
713
741
  for image in images:
714
742
  if image._boxes:
@@ -728,6 +756,10 @@ class Image(BatchableMedia):
728
756
  def all_captions(
729
757
  cls: Type["Image"], images: Sequence["Media"]
730
758
  ) -> Union[bool, Sequence[Optional[str]]]:
759
+ """Get captions from a list of images.
760
+
761
+ "<!-- lazydoc-ignore-classmethod: internal -->
762
+ """
731
763
  return cls.captions(images)
732
764
 
733
765
  def __ne__(self, other: object) -> bool:
@@ -758,6 +790,10 @@ class Image(BatchableMedia):
758
790
  )
759
791
 
760
792
  def to_data_array(self) -> List[Any]:
793
+ """Convert to data array.
794
+
795
+ <!-- lazydoc-ignore: internal -->
796
+ """
761
797
  res = []
762
798
  if self.image is not None:
763
799
  data = list(self.image.getdata())
@@ -23,14 +23,7 @@ if TYPE_CHECKING: # pragma: no cover
23
23
 
24
24
 
25
25
  class Molecule(BatchableMedia):
26
- """Wandb class for 3D Molecular data.
27
-
28
- Args:
29
- data_or_path: (pathlib.Path, string, io)
30
- Molecule can be initialized from a file name or an io object.
31
- caption: (string)
32
- Caption associated with the molecule for display.
33
- """
26
+ """W&B class for 3D Molecular data."""
34
27
 
35
28
  SUPPORTED_TYPES = {
36
29
  "pdb",
@@ -53,6 +46,12 @@ class Molecule(BatchableMedia):
53
46
  caption: Optional[str] = None,
54
47
  **kwargs: str,
55
48
  ) -> None:
49
+ """Initialize a Molecule object.
50
+
51
+ Args:
52
+ data_or_path: Molecule can be initialized from a file name or an io object.
53
+ caption: Caption associated with the molecule for display.
54
+ """
56
55
  super().__init__(caption=caption)
57
56
 
58
57
  if hasattr(data_or_path, "name"):
@@ -116,6 +115,8 @@ class Molecule(BatchableMedia):
116
115
  This is an expensive operation that may take a long time for complicated molecules.
117
116
  mmff_optimize_molecule_max_iterations: (int)
118
117
  Number of iterations to use in rdkit.Chem.AllChem.MMFFOptimizeMolecule
118
+
119
+ <!-- lazydoc-ignore-classmethod: internal -->
119
120
  """
120
121
  rdkit_chem = util.get_module(
121
122
  "rdkit.Chem",
@@ -172,17 +173,17 @@ class Molecule(BatchableMedia):
172
173
  """Convert SMILES string to wandb.Molecule.
173
174
 
174
175
  Args:
175
- data: (string)
176
- SMILES string.
177
- caption: (string)
178
- Caption associated with the molecule for display
179
- sanitize: (bool)
180
- Check if the molecule is chemically reasonable by the RDKit's definition.
181
- convert_to_3d_and_optimize: (bool)
182
- Convert to rdkit.Chem.rdchem.Mol with 3D coordinates.
183
- This is an expensive operation that may take a long time for complicated molecules.
184
- mmff_optimize_molecule_max_iterations: (int)
185
- Number of iterations to use in rdkit.Chem.AllChem.MMFFOptimizeMolecule
176
+ data: SMILES string.
177
+ caption: Caption associated with the molecule for display.
178
+ sanitize: Check if the molecule is chemically reasonable by
179
+ the RDKit's definition.
180
+ convert_to_3d_and_optimize: Convert to rdkit.Chem.rdchem.Mol
181
+ with 3D coordinates. This is a computationally intensive
182
+ operation that may take a long time for complicated molecules.
183
+ mmff_optimize_molecule_max_iterations: Number of iterations to
184
+ use in rdkit.Chem.AllChem.MMFFOptimizeMolecule.
185
+
186
+ <!-- lazydoc-ignore-classmethod: internal -->
186
187
  """
187
188
  rdkit_chem = util.get_module(
188
189
  "rdkit.Chem",
@@ -201,9 +202,17 @@ class Molecule(BatchableMedia):
201
202
 
202
203
  @classmethod
203
204
  def get_media_subdir(cls: Type["Molecule"]) -> str:
205
+ """Get media subdirectory.
206
+
207
+ <!-- lazydoc-ignore-classmethod: internal -->
208
+ """
204
209
  return os.path.join("media", "molecule")
205
210
 
206
211
  def to_json(self, run_or_artifact: Union["LocalRun", "Artifact"]) -> dict:
212
+ """Returns the JSON representation expected by the backend.
213
+
214
+ <!-- lazydoc-ignore: internal -->
215
+ """
207
216
  json_dict = super().to_json(run_or_artifact)
208
217
  json_dict["_type"] = self._log_type
209
218
  return json_dict
@@ -216,6 +225,10 @@ class Molecule(BatchableMedia):
216
225
  key: str,
217
226
  step: Union[int, str],
218
227
  ) -> dict:
228
+ """Convert a sequence of Molecule objects to a JSON representation.
229
+
230
+ <!-- lazydoc-ignore-classmethod: internal -->
231
+ """
219
232
  seq = list(seq)
220
233
 
221
234
  jsons = [obj.to_json(run) for obj in seq]
@@ -185,22 +185,7 @@ def box3d(
185
185
 
186
186
 
187
187
  class Object3D(BatchableMedia):
188
- """Wandb class for 3D point clouds.
189
-
190
- Args:
191
- data_or_path: (numpy array, pathlib.Path, string, io)
192
- Object3D can be initialized from a file or a numpy array.
193
-
194
- You can pass a path to a file or an io object and a file_type
195
- which must be one of SUPPORTED_TYPES
196
-
197
- The shape of the numpy array must be one of either:
198
- ```
199
- [[x y z], ...] nx3
200
- [[x y z c], ...] nx4 where c is a category with supported range [1, 14]
201
- [[x y z r g b], ...] nx6 where is rgb is color
202
- ```
203
- """
188
+ """W&B class for 3D point clouds."""
204
189
 
205
190
  SUPPORTED_TYPES: ClassVar[Set[str]] = {
206
191
  "obj",
@@ -219,6 +204,21 @@ class Object3D(BatchableMedia):
219
204
  caption: Optional[str] = None,
220
205
  **kwargs: Optional[Union[str, "FileFormat3D"]],
221
206
  ) -> None:
207
+ """Creates a W&B Object3D object.
208
+
209
+ Args:
210
+ data_or_path: Object3D can be initialized from a file or a numpy array.
211
+ caption: Caption associated with the object for display.
212
+
213
+ Examples:
214
+ The shape of the numpy array must be one of either
215
+
216
+ ```text
217
+ [[x y z], ...] nx3
218
+ [[x y z c], ...] nx4 where c is a category with supported range [1, 14]
219
+ [[x y z r g b], ...] nx6 where is rgb is color
220
+ ```
221
+ """
222
222
  super().__init__(caption=caption)
223
223
 
224
224
  if hasattr(data_or_path, "name") and not isinstance(data_or_path, pathlib.Path):
@@ -347,6 +347,8 @@ class Object3D(BatchableMedia):
347
347
  data_or_path (Union["TextIO", str]): A path to a file or a `TextIO` stream.
348
348
  file_type (str): Specifies the data format passed to `data_or_path`. Required when `data_or_path` is a
349
349
  `TextIO` stream. This parameter is ignored if a file path is provided. The type is taken from the file extension.
350
+
351
+ <!-- lazydoc-ignore-classmethod: internal -->
350
352
  """
351
353
  # if file_type is not None and file_type not in cls.SUPPORTED_TYPES:
352
354
  # raise ValueError(
@@ -364,11 +366,14 @@ class Object3D(BatchableMedia):
364
366
 
365
367
 
366
368
  The shape of the numpy array must be one of either:
367
- ```
369
+
370
+ ```text
368
371
  [[x y z], ...] # nx3.
369
372
  [[x y z c], ...] # nx4 where c is a category with supported range [1, 14].
370
373
  [[x y z r g b], ...] # nx6 where is rgb is color.
371
374
  ```
375
+
376
+ <!-- lazydoc-ignore-classmethod: internal -->
372
377
  """
373
378
  if not util.is_numpy_array(data):
374
379
  raise ValueError("`data` must be a numpy array")
@@ -403,6 +408,8 @@ class Object3D(BatchableMedia):
403
408
  vectors (Optional[Sequence["Vector3D"]]): Each vector is displayed in the point cloud
404
409
  visualization. Can be used to indicate directionality of bounding boxes. Defaults to None.
405
410
  point_cloud_type ("lidar/beta"): At this time, only the "lidar/beta" type is supported. Defaults to "lidar/beta".
411
+
412
+ <!-- lazydoc-ignore-classmethod: internal -->
406
413
  """
407
414
  if point_cloud_type not in cls.SUPPORTED_POINT_CLOUD_TYPES:
408
415
  raise ValueError("Point cloud type not supported")
@@ -423,9 +430,17 @@ class Object3D(BatchableMedia):
423
430
 
424
431
  @classmethod
425
432
  def get_media_subdir(cls: Type["Object3D"]) -> str:
433
+ """Get media subdirectory.
434
+
435
+ <!-- lazydoc-ignore-classmethod: internal -->
436
+ """
426
437
  return os.path.join("media", "object3D")
427
438
 
428
439
  def to_json(self, run_or_artifact: Union["LocalRun", "Artifact"]) -> dict:
440
+ """Returns the JSON representation expected by the backend.
441
+
442
+ <!-- lazydoc-ignore: internal -->
443
+ """
429
444
  json_dict = super().to_json(run_or_artifact)
430
445
  json_dict["_type"] = Object3D._log_type
431
446
 
@@ -445,6 +460,10 @@ class Object3D(BatchableMedia):
445
460
  key: str,
446
461
  step: Union[int, str],
447
462
  ) -> dict:
463
+ """Convert a sequence of Audio objects to a JSON representation.
464
+
465
+ <!-- lazydoc-ignore-classmethod: internal -->
466
+ """
448
467
  seq = list(seq)
449
468
 
450
469
  jsons = [obj.to_json(run) for obj in seq]
@@ -31,11 +31,7 @@ if TYPE_CHECKING: # pragma: no cover
31
31
 
32
32
 
33
33
  class Plotly(Media):
34
- """Wandb class for plotly plots.
35
-
36
- Args:
37
- val: matplotlib or plotly figure
38
- """
34
+ """W&B class for Plotly plots."""
39
35
 
40
36
  _log_type = "plotly-file"
41
37
 
@@ -43,6 +39,10 @@ class Plotly(Media):
43
39
  def make_plot_media(
44
40
  cls: Type["Plotly"], val: Union["plotly.Figure", "matplotlib.artist.Artist"]
45
41
  ) -> Union[Image, "Plotly"]:
42
+ """Create a Plotly object from a Plotly figure or a matplotlib artist.
43
+
44
+ <!-- lazydoc-ignore-classmethod: internal -->
45
+ """
46
46
  if util.is_matplotlib_typename(util.get_full_typename(val)):
47
47
  if util.matplotlib_contains_images(val):
48
48
  return Image(val)
@@ -50,6 +50,11 @@ class Plotly(Media):
50
50
  return cls(val)
51
51
 
52
52
  def __init__(self, val: Union["plotly.Figure", "matplotlib.artist.Artist"]):
53
+ """Initialize a Plotly object.
54
+
55
+ Args:
56
+ val: Matplotlib or Plotly figure.
57
+ """
53
58
  super().__init__()
54
59
  # First, check to see if the incoming `val` object is a plotfly figure
55
60
  if not util.is_plotly_figure_typename(util.get_full_typename(val)):
@@ -74,9 +79,17 @@ class Plotly(Media):
74
79
 
75
80
  @classmethod
76
81
  def get_media_subdir(cls: Type["Plotly"]) -> str:
82
+ """Returns the media subdirectory for Plotly plots.
83
+
84
+ <!-- lazydoc-ignore-classmethod: internal -->
85
+ """
77
86
  return os.path.join("media", "plotly")
78
87
 
79
88
  def to_json(self, run_or_artifact: Union["LocalRun", "Artifact"]) -> dict:
89
+ """Convert the Plotly object to a JSON representation.
90
+
91
+ <!-- lazydoc-ignore: internal -->
92
+ """
80
93
  json_dict = super().to_json(run_or_artifact)
81
94
  json_dict["_type"] = self._log_type
82
95
  return json_dict
@@ -23,7 +23,6 @@ if TYPE_CHECKING:
23
23
  from typing_extensions import Self
24
24
 
25
25
  from wandb.sdk.artifacts.artifact import Artifact
26
- from wandb.sdk.wandb_run import Run as LocalRun
27
26
 
28
27
 
29
28
  DEBUG_MODE = False
@@ -137,15 +136,14 @@ class _SavedModel(WBValue, Generic[SavedModelObjType]):
137
136
  # and specified adapter.
138
137
  return cls(dl_path)
139
138
 
140
- def to_json(self, run_or_artifact: LocalRun | Artifact) -> dict:
139
+ def to_json(self, run_or_artifact: wandb.Run | Artifact) -> dict:
141
140
  # Unlike other data types, we do not allow adding to a Run directly. There is a
142
141
  # bit of tech debt in the other data types which requires the input to `to_json`
143
142
  # to accept a Run or Artifact. However, Run additions should be deprecated in the future.
144
143
  # This check helps ensure we do not add to the debt.
145
- from wandb.sdk.wandb_run import Run
146
-
147
- if isinstance(run_or_artifact, Run):
144
+ if isinstance(run_or_artifact, wandb.Run):
148
145
  raise TypeError("SavedModel cannot be added to run - must use artifact")
146
+
149
147
  artifact = run_or_artifact
150
148
  json_obj = {
151
149
  "type": self._log_type,
@@ -329,7 +327,7 @@ class _PicklingSavedModel(_SavedModel[SavedModelObjType]):
329
327
 
330
328
  return inst # type: ignore
331
329
 
332
- def to_json(self, run_or_artifact: LocalRun | Artifact) -> dict:
330
+ def to_json(self, run_or_artifact: wandb.Run | Artifact) -> dict:
333
331
  json_obj = super().to_json(run_or_artifact)
334
332
  assert isinstance(run_or_artifact, wandb.Artifact)
335
333
  if self._dep_py_files_path is not None: