wandb 0.19.4rc1__py3-none-any.whl → 0.19.6rc4__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 (46) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +1 -8
  3. wandb/_iterutils.py +46 -0
  4. wandb/apis/internal.py +4 -0
  5. wandb/apis/normalize.py +13 -5
  6. wandb/bin/gpu_stats +0 -0
  7. wandb/cli/cli.py +9 -2
  8. wandb/proto/v3/wandb_internal_pb2.py +36 -36
  9. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  10. wandb/proto/v4/wandb_internal_pb2.py +36 -36
  11. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  12. wandb/proto/v5/wandb_internal_pb2.py +36 -36
  13. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  14. wandb/sdk/artifacts/artifact.py +120 -8
  15. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +12 -5
  16. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
  17. wandb/sdk/backend/backend.py +7 -11
  18. wandb/sdk/data_types/base_types/wb_value.py +10 -10
  19. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +2 -2
  20. wandb/sdk/data_types/helper_types/image_mask.py +2 -2
  21. wandb/sdk/data_types/image.py +0 -3
  22. wandb/sdk/data_types/saved_model.py +1 -1
  23. wandb/sdk/data_types/utils.py +2 -6
  24. wandb/sdk/interface/interface.py +26 -12
  25. wandb/sdk/interface/interface_sock.py +7 -11
  26. wandb/sdk/internal/internal_api.py +9 -1
  27. wandb/sdk/internal/sender.py +2 -2
  28. wandb/sdk/internal/system/assets/cpu.py +1 -1
  29. wandb/sdk/lib/apikey.py +7 -19
  30. wandb/sdk/lib/mailbox.py +0 -14
  31. wandb/sdk/lib/retry.py +6 -3
  32. wandb/sdk/lib/run_moment.py +19 -7
  33. wandb/sdk/lib/server.py +20 -0
  34. wandb/sdk/lib/service_connection.py +2 -2
  35. wandb/sdk/wandb_init.py +71 -46
  36. wandb/sdk/wandb_login.py +86 -110
  37. wandb/sdk/wandb_metadata.py +60 -31
  38. wandb/sdk/wandb_run.py +32 -45
  39. wandb/sdk/wandb_settings.py +465 -143
  40. wandb/sdk/wandb_setup.py +10 -22
  41. wandb/util.py +44 -12
  42. {wandb-0.19.4rc1.dist-info → wandb-0.19.6rc4.dist-info}/METADATA +1 -1
  43. {wandb-0.19.4rc1.dist-info → wandb-0.19.6rc4.dist-info}/RECORD +46 -45
  44. {wandb-0.19.4rc1.dist-info → wandb-0.19.6rc4.dist-info}/WHEEL +0 -0
  45. {wandb-0.19.4rc1.dist-info → wandb-0.19.6rc4.dist-info}/entry_points.txt +0 -0
  46. {wandb-0.19.4rc1.dist-info → wandb-0.19.6rc4.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_run.py CHANGED
@@ -47,7 +47,7 @@ from wandb.sdk.lib.import_hooks import (
47
47
  register_post_import_hook,
48
48
  unregister_post_import_hook,
49
49
  )
50
- from wandb.sdk.lib.paths import FilePathStr, LogicalPath, StrPath
50
+ from wandb.sdk.lib.paths import FilePathStr, StrPath
51
51
  from wandb.util import (
52
52
  _is_artifact_object,
53
53
  _is_artifact_string,
@@ -454,7 +454,6 @@ class Run:
454
454
  """A unit of computation logged by wandb. Typically, this is an ML experiment.
455
455
 
456
456
  Create a run with `wandb.init()`:
457
- <!--yeadoc-test:run-object-basic-->
458
457
  ```python
459
458
  import wandb
460
459
 
@@ -463,7 +462,6 @@ class Run:
463
462
 
464
463
  There is only ever at most one active `wandb.Run` in any process,
465
464
  and it is accessible as `wandb.run`:
466
- <!--yeadoc-test:global-run-object-->
467
465
  ```python
468
466
  import wandb
469
467
 
@@ -478,7 +476,6 @@ class Run:
478
476
  If you want to start more runs in the same script or notebook, you'll need to
479
477
  finish the run that is in-flight. Runs can be finished with `wandb.finish` or
480
478
  by using them in a `with` block:
481
- <!--yeadoc-test:run-context-manager-->
482
479
  ```python
483
480
  import wandb
484
481
 
@@ -594,6 +591,10 @@ class Run:
594
591
  self._config._set_artifact_callback(self._config_artifact_callback)
595
592
  self._config._set_settings(self._settings)
596
593
 
594
+ # The _wandb key is always expected on the run config.
595
+ wandb_key = "_wandb"
596
+ self._config._update({wandb_key: dict()})
597
+
597
598
  # TODO: perhaps this should be a property that is a noop on a finished run
598
599
  self.summary = wandb_summary.Summary(
599
600
  self._summary_get_current_summary_callback,
@@ -657,30 +658,12 @@ class Run:
657
658
  process_context="user",
658
659
  )
659
660
 
660
- # Populate config
661
- config = config or dict()
662
- wandb_key = "_wandb"
663
- config.setdefault(wandb_key, dict())
664
661
  self._launch_artifact_mapping: dict[str, Any] = {}
665
662
  self._unique_launch_artifact_sequence_names: dict[str, Any] = {}
666
- if self._settings.save_code and self._settings.program_relpath:
667
- config[wandb_key]["code_path"] = LogicalPath(
668
- os.path.join("code", self._settings.program_relpath)
669
- )
670
-
671
- if self._settings.fork_from is not None:
672
- config[wandb_key]["branch_point"] = {
673
- "run_id": self._settings.fork_from.run,
674
- "step": self._settings.fork_from.value,
675
- }
676
-
677
- if self._settings.resume_from is not None:
678
- config[wandb_key]["branch_point"] = {
679
- "run_id": self._settings.resume_from.run,
680
- "step": self._settings.resume_from.value,
681
- }
682
663
 
683
- self._config._update(config, ignore_locked=True)
664
+ # Populate config
665
+ config = config or dict()
666
+ self._config._update(config, allow_val_change=True, ignore_locked=True)
684
667
 
685
668
  if sweep_config:
686
669
  self._config.merge_locked(
@@ -1315,7 +1298,7 @@ class Run:
1315
1298
  with telemetry.context(run=self) as tel:
1316
1299
  tel.feature.set_summary = True
1317
1300
  if self._backend and self._backend.interface:
1318
- self._backend.interface.publish_summary(summary_record)
1301
+ self._backend.interface.publish_summary(self, summary_record)
1319
1302
 
1320
1303
  def _on_progress_get_summary(self, handle: MailboxProgress) -> None:
1321
1304
  pass
@@ -1745,7 +1728,6 @@ class Run:
1745
1728
  [our guides to logging](https://docs.wandb.com/guides/track/log).
1746
1729
 
1747
1730
  ### Basic usage
1748
- <!--yeadoc-test:init-and-log-basic-->
1749
1731
  ```python
1750
1732
  import wandb
1751
1733
 
@@ -1754,7 +1736,6 @@ class Run:
1754
1736
  ```
1755
1737
 
1756
1738
  ### Incremental logging
1757
- <!--yeadoc-test:init-and-log-incremental-->
1758
1739
  ```python
1759
1740
  import wandb
1760
1741
 
@@ -1765,7 +1746,6 @@ class Run:
1765
1746
  ```
1766
1747
 
1767
1748
  ### Histogram
1768
- <!--yeadoc-test:init-and-log-histogram-->
1769
1749
  ```python
1770
1750
  import numpy as np
1771
1751
  import wandb
@@ -1777,7 +1757,6 @@ class Run:
1777
1757
  ```
1778
1758
 
1779
1759
  ### Image from numpy
1780
- <!--yeadoc-test:init-and-log-image-numpy-->
1781
1760
  ```python
1782
1761
  import numpy as np
1783
1762
  import wandb
@@ -1792,7 +1771,6 @@ class Run:
1792
1771
  ```
1793
1772
 
1794
1773
  ### Image from PIL
1795
- <!--yeadoc-test:init-and-log-image-pillow-->
1796
1774
  ```python
1797
1775
  import numpy as np
1798
1776
  from PIL import Image as PILImage
@@ -1814,7 +1792,6 @@ class Run:
1814
1792
  ```
1815
1793
 
1816
1794
  ### Video from numpy
1817
- <!--yeadoc-test:init-and-log-video-numpy-->
1818
1795
  ```python
1819
1796
  import numpy as np
1820
1797
  import wandb
@@ -1831,7 +1808,6 @@ class Run:
1831
1808
  ```
1832
1809
 
1833
1810
  ### Matplotlib Plot
1834
- <!--yeadoc-test:init-and-log-matplotlib-->
1835
1811
  ```python
1836
1812
  from matplotlib import pyplot as plt
1837
1813
  import numpy as np
@@ -3482,9 +3458,13 @@ class Run:
3482
3458
  path: (str) path to downloaded model artifact file(s).
3483
3459
  """
3484
3460
  artifact = self.use_artifact(artifact_or_name=name)
3485
- assert (
3486
- "model" in str(artifact.type.lower())
3487
- ), "You can only use this method for 'model' artifacts. For an artifact to be a 'model' artifact, its type property must contain the substring 'model'."
3461
+ if "model" not in str(artifact.type.lower()):
3462
+ raise AssertionError(
3463
+ "You can only use this method for 'model' artifacts."
3464
+ " For an artifact to be a 'model' artifact, its type property"
3465
+ " must contain the substring 'model'."
3466
+ )
3467
+
3488
3468
  path = artifact.download()
3489
3469
 
3490
3470
  # If returned directory contains only one file, return path to that file
@@ -3566,18 +3546,25 @@ class Run:
3566
3546
  None
3567
3547
  """
3568
3548
  name_parts = registered_model_name.split("/")
3569
- assert (
3570
- len(name_parts) == 1
3571
- ), "Please provide only the name of the registered model. Do not append the entity or project name."
3549
+ if len(name_parts) != 1:
3550
+ raise AssertionError(
3551
+ "Please provide only the name of the registered model."
3552
+ " Do not append the entity or project name."
3553
+ )
3554
+
3572
3555
  project = "model-registry"
3573
3556
  target_path = self.entity + "/" + project + "/" + registered_model_name
3574
3557
 
3575
3558
  public_api = self._public_api()
3576
3559
  try:
3577
3560
  artifact = public_api._artifact(name=f"{name}:latest")
3578
- assert (
3579
- "model" in str(artifact.type.lower())
3580
- ), "You can only use this method for 'model' artifacts. For an artifact to be a 'model' artifact, its type property must contain the substring 'model'."
3561
+ if "model" not in str(artifact.type.lower()):
3562
+ raise AssertionError(
3563
+ "You can only use this method for 'model' artifacts."
3564
+ " For an artifact to be a 'model' artifact, its type"
3565
+ " property must contain the substring 'model'."
3566
+ )
3567
+
3581
3568
  artifact = self._log_artifact(
3582
3569
  artifact_or_path=path, name=name, type=artifact.type
3583
3570
  )
@@ -3847,14 +3834,14 @@ class Run:
3847
3834
  if not settings.quiet:
3848
3835
  # TODO: add verbosity levels and add this to higher levels
3849
3836
  printer.display(
3850
- f'{printer.emoji("star")} View project at {printer.link(project_url)}'
3837
+ f"{printer.emoji('star')} View project at {printer.link(project_url)}"
3851
3838
  )
3852
3839
  if sweep_url:
3853
3840
  printer.display(
3854
- f'{printer.emoji("broom")} View sweep at {printer.link(sweep_url)}'
3841
+ f"{printer.emoji('broom')} View sweep at {printer.link(sweep_url)}"
3855
3842
  )
3856
3843
  printer.display(
3857
- f'{printer.emoji("rocket")} View run at {printer.link(run_url)}',
3844
+ f"{printer.emoji('rocket')} View run at {printer.link(run_url)}",
3858
3845
  )
3859
3846
 
3860
3847
  if run_name and settings.anonymous in ["allow", "must"]: