wandb 0.18.5__py3-none-any.whl → 0.18.7__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. wandb/__init__.py +2 -2
  2. wandb/__init__.pyi +22 -20
  3. wandb/agents/pyagent.py +1 -1
  4. wandb/apis/importers/wandb.py +1 -1
  5. wandb/apis/normalize.py +2 -18
  6. wandb/apis/public/api.py +126 -62
  7. wandb/apis/public/artifacts.py +8 -3
  8. wandb/apis/public/files.py +17 -2
  9. wandb/apis/public/jobs.py +2 -2
  10. wandb/apis/public/query_generator.py +1 -1
  11. wandb/apis/public/runs.py +8 -8
  12. wandb/apis/public/teams.py +3 -3
  13. wandb/apis/public/users.py +1 -1
  14. wandb/apis/public/utils.py +68 -0
  15. wandb/bin/gpu_stats +0 -0
  16. wandb/cli/cli.py +12 -3
  17. wandb/data_types.py +1 -1
  18. wandb/docker/__init__.py +2 -1
  19. wandb/docker/auth.py +2 -3
  20. wandb/errors/links.py +73 -0
  21. wandb/errors/term.py +7 -6
  22. wandb/filesync/step_prepare.py +1 -1
  23. wandb/filesync/upload_job.py +1 -1
  24. wandb/integration/catboost/catboost.py +2 -2
  25. wandb/integration/diffusers/pipeline_resolver.py +1 -1
  26. wandb/integration/diffusers/resolvers/multimodal.py +6 -6
  27. wandb/integration/diffusers/resolvers/utils.py +1 -1
  28. wandb/integration/fastai/__init__.py +3 -2
  29. wandb/integration/keras/callbacks/metrics_logger.py +1 -1
  30. wandb/integration/keras/callbacks/model_checkpoint.py +1 -1
  31. wandb/integration/keras/keras.py +1 -1
  32. wandb/integration/kfp/kfp_patch.py +1 -1
  33. wandb/integration/lightgbm/__init__.py +2 -2
  34. wandb/integration/magic.py +2 -2
  35. wandb/integration/metaflow/metaflow.py +1 -1
  36. wandb/integration/sacred/__init__.py +1 -1
  37. wandb/integration/sagemaker/auth.py +1 -1
  38. wandb/integration/sklearn/plot/classifier.py +7 -7
  39. wandb/integration/sklearn/plot/clusterer.py +3 -3
  40. wandb/integration/sklearn/plot/regressor.py +3 -3
  41. wandb/integration/sklearn/plot/shared.py +2 -2
  42. wandb/integration/tensorboard/log.py +2 -2
  43. wandb/integration/ultralytics/callback.py +2 -2
  44. wandb/integration/xgboost/xgboost.py +1 -1
  45. wandb/jupyter.py +0 -1
  46. wandb/plot/__init__.py +17 -8
  47. wandb/plot/bar.py +53 -27
  48. wandb/plot/confusion_matrix.py +151 -70
  49. wandb/plot/custom_chart.py +124 -0
  50. wandb/plot/histogram.py +46 -20
  51. wandb/plot/line.py +57 -26
  52. wandb/plot/line_series.py +148 -60
  53. wandb/plot/pr_curve.py +89 -44
  54. wandb/plot/roc_curve.py +82 -37
  55. wandb/plot/scatter.py +53 -20
  56. wandb/plot/viz.py +20 -102
  57. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  58. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  59. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  60. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  61. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  62. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  63. wandb/proto/wandb_deprecated.py +2 -0
  64. wandb/sdk/artifacts/artifact.py +281 -329
  65. wandb/sdk/artifacts/artifact_manifest.py +10 -9
  66. wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
  67. wandb/sdk/artifacts/storage_handlers/azure_handler.py +9 -4
  68. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +1 -3
  69. wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
  70. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +2 -2
  71. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
  72. wandb/sdk/backend/backend.py +0 -1
  73. wandb/sdk/data_types/audio.py +1 -1
  74. wandb/sdk/data_types/base_types/media.py +66 -5
  75. wandb/sdk/data_types/base_types/wb_value.py +20 -10
  76. wandb/sdk/data_types/bokeh.py +1 -1
  77. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -1
  78. wandb/sdk/data_types/helper_types/image_mask.py +2 -2
  79. wandb/sdk/data_types/histogram.py +1 -1
  80. wandb/sdk/data_types/html.py +1 -1
  81. wandb/sdk/data_types/image.py +1 -1
  82. wandb/sdk/data_types/molecule.py +3 -3
  83. wandb/sdk/data_types/object_3d.py +4 -4
  84. wandb/sdk/data_types/plotly.py +1 -1
  85. wandb/sdk/data_types/saved_model.py +0 -1
  86. wandb/sdk/data_types/table.py +7 -7
  87. wandb/sdk/data_types/trace_tree.py +1 -1
  88. wandb/sdk/data_types/video.py +4 -3
  89. wandb/sdk/interface/interface_queue.py +0 -6
  90. wandb/sdk/interface/router.py +1 -4
  91. wandb/sdk/interface/router_queue.py +0 -3
  92. wandb/sdk/interface/router_relay.py +0 -2
  93. wandb/sdk/internal/datastore.py +1 -1
  94. wandb/sdk/internal/file_pusher.py +1 -1
  95. wandb/sdk/internal/file_stream.py +4 -4
  96. wandb/sdk/internal/handler.py +3 -4
  97. wandb/sdk/internal/internal.py +1 -15
  98. wandb/sdk/internal/internal_api.py +178 -63
  99. wandb/sdk/internal/internal_util.py +0 -3
  100. wandb/sdk/internal/job_builder.py +4 -3
  101. wandb/sdk/internal/sender.py +0 -2
  102. wandb/sdk/internal/system/assets/__init__.py +0 -2
  103. wandb/sdk/internal/tb_watcher.py +11 -10
  104. wandb/sdk/internal/writer.py +1 -3
  105. wandb/sdk/launch/__init__.py +2 -1
  106. wandb/sdk/launch/_launch.py +4 -3
  107. wandb/sdk/launch/_launch_add.py +2 -2
  108. wandb/sdk/launch/builder/kaniko_builder.py +0 -1
  109. wandb/sdk/launch/create_job.py +1 -0
  110. wandb/sdk/launch/environment/local_environment.py +0 -1
  111. wandb/sdk/launch/errors.py +0 -6
  112. wandb/sdk/launch/registry/local_registry.py +0 -2
  113. wandb/sdk/launch/runner/abstract.py +0 -5
  114. wandb/sdk/launch/sweeps/__init__.py +0 -2
  115. wandb/sdk/launch/sweeps/scheduler.py +0 -2
  116. wandb/sdk/launch/sweeps/scheduler_sweep.py +0 -1
  117. wandb/sdk/lib/_settings_toposort_generated.py +1 -0
  118. wandb/sdk/lib/apikey.py +3 -3
  119. wandb/sdk/lib/file_stream_utils.py +1 -1
  120. wandb/sdk/lib/filesystem.py +1 -1
  121. wandb/sdk/lib/ipython.py +16 -9
  122. wandb/sdk/lib/mailbox.py +0 -4
  123. wandb/sdk/lib/printer.py +44 -8
  124. wandb/sdk/lib/retry.py +1 -1
  125. wandb/sdk/lib/sock_client.py +0 -5
  126. wandb/sdk/service/server.py +2 -11
  127. wandb/sdk/service/server_sock.py +0 -2
  128. wandb/sdk/service/service.py +3 -3
  129. wandb/sdk/service/streams.py +2 -4
  130. wandb/sdk/wandb_init.py +20 -20
  131. wandb/sdk/wandb_login.py +1 -1
  132. wandb/sdk/wandb_require.py +1 -4
  133. wandb/sdk/wandb_run.py +97 -115
  134. wandb/sdk/wandb_settings.py +23 -6
  135. wandb/sdk/wandb_setup.py +1 -5
  136. wandb/sdk/wandb_sync.py +2 -1
  137. wandb/util.py +49 -21
  138. wandb/wandb_agent.py +3 -3
  139. wandb/wandb_controller.py +2 -2
  140. {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/METADATA +1 -2
  141. {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/RECORD +144 -146
  142. {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/WHEEL +1 -1
  143. wandb/sdk/internal/system/assets/gpu_apple.py +0 -177
  144. wandb/sdk/lib/_wburls_generate.py +0 -25
  145. wandb/sdk/lib/_wburls_generated.py +0 -22
  146. wandb/sdk/lib/tracelog.py +0 -255
  147. wandb/sdk/lib/wburls.py +0 -46
  148. {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/entry_points.txt +0 -0
  149. {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/licenses/LICENSE +0 -0
wandb/__init__.py CHANGED
@@ -10,7 +10,7 @@ For reference documentation, see https://docs.wandb.com/ref/python.
10
10
  """
11
11
  from __future__ import annotations
12
12
 
13
- __version__ = "0.18.5"
13
+ __version__ = "0.18.7"
14
14
 
15
15
 
16
16
  from wandb.errors import Error
@@ -75,7 +75,7 @@ from wandb.data_types import JoinedTable
75
75
 
76
76
  from wandb.wandb_agent import agent
77
77
 
78
- from wandb.plot.viz import visualize
78
+ from wandb.plot import visualize
79
79
  from wandb.integration.sagemaker import sagemaker_auth
80
80
  from wandb.sdk.internal import profiler
81
81
 
wandb/__init__.pyi CHANGED
@@ -53,6 +53,7 @@ __all__ = (
53
53
  "teardown",
54
54
  "watch",
55
55
  "unwatch",
56
+ "plot",
56
57
  )
57
58
 
58
59
  import os
@@ -68,6 +69,7 @@ from typing import (
68
69
  Union,
69
70
  )
70
71
 
72
+ import wandb.plot as plot
71
73
  from wandb.analytics import Sentry
72
74
  from wandb.apis import InternalApi, PublicApi
73
75
  from wandb.data_types import (
@@ -96,9 +98,9 @@ from wandb.wandb_controller import _WandbController
96
98
  if TYPE_CHECKING:
97
99
  import torch # type: ignore [import-not-found]
98
100
 
99
- from wandb.plot.viz import CustomChart
101
+ from wandb.plot import CustomChart
100
102
 
101
- __version__: str = "0.18.5"
103
+ __version__: str = "0.18.7"
102
104
 
103
105
  run: Run | None
104
106
  config: wandb_config.Config
@@ -249,7 +251,7 @@ def init(
249
251
  For more on using `wandb.init()`, including detailed examples, check out our
250
252
  [guide and FAQs](https://docs.wandb.ai/guides/track/launch).
251
253
 
252
- Arguments:
254
+ Args:
253
255
  project: (str, optional) The name of the project where you're sending
254
256
  the new run. If the project is not specified, we will try to infer
255
257
  the project name from git root or the current program file. If we
@@ -372,11 +374,11 @@ def init(
372
374
  for saving hyperparameters to compare across runs. The ID cannot
373
375
  contain the following special characters: `/\#?%:`.
374
376
  See [our guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
375
- fork_from: (str, optional) A string with the format {run_id}?_step={step} describing
377
+ fork_from: (str, optional) A string with the format `{run_id}?_step={step}` describing
376
378
  a moment in a previous run to fork a new run from. Creates a new run that picks up
377
379
  logging history from the specified run at the specified moment. The target run must
378
380
  be in the current project. Example: `fork_from="my-run-id?_step=1234"`.
379
- resume_from: (str, optional) A string with the format {run_id}?_step={step} describing
381
+ resume_from: (str, optional) A string with the format `{run_id}?_step={step}` describing
380
382
  a moment in a previous run to resume a run from. This allows users to truncate
381
383
  the history logged to a run at an intermediate step and resume logging from that step.
382
384
  It uses run forking under the hood. The target run must be in the
@@ -429,9 +431,9 @@ def finish(exit_code: int | None = None, quiet: bool | None = None) -> None:
429
431
  This is used when creating multiple runs in the same process.
430
432
  We automatically call this method when your script exits.
431
433
 
432
- Arguments:
434
+ Args:
433
435
  exit_code: Set to something other than 0 to mark a run as failed
434
- quiet: Set to true to minimize log output
436
+ quiet: Deprecated, use `wandb.Settings(quiet=...)` to set this instead.
435
437
  """
436
438
  ...
437
439
 
@@ -450,7 +452,7 @@ def login(
450
452
  verifying them with the W&B server. To verify credentials, pass
451
453
  `verify=True`.
452
454
 
453
- Arguments:
455
+ Args:
454
456
  anonymous: (string, optional) Can be "must", "allow", or "never".
455
457
  If set to "must", always log a user in anonymously. If set to
456
458
  "allow", only create an anonymous user if the user
@@ -503,7 +505,7 @@ def log(
503
505
  [guides to logging](https://docs.wandb.ai/guides/track/log) for examples,
504
506
  from 3D molecular structures and segmentation masks to PR curves and histograms.
505
507
  You can use `wandb.Table` to log structured data. See our
506
- [guide to logging tables](https://docs.wandb.ai/guides/data-vis/log-tables)
508
+ [guide to logging tables](https://docs.wandb.ai/guides/tables/tables-walkthrough)
507
509
  for details.
508
510
 
509
511
  The W&B UI organizes metrics with a forward slash (`/`) in their name
@@ -566,7 +568,7 @@ def log(
566
568
  run.log({"accuracy": 0.9}, step=current_step)
567
569
  ```
568
570
 
569
- Arguments:
571
+ Args:
570
572
  data: A `dict` with `str` keys and values that are serializable
571
573
  Python objects including: `int`, `float` and `string`;
572
574
  any of the `wandb.data_types`; lists, tuples and NumPy arrays
@@ -745,7 +747,7 @@ def save(
745
747
  Note: when given an absolute path or glob and no `base_path`, one
746
748
  directory level is preserved as in the example above.
747
749
 
748
- Arguments:
750
+ Args:
749
751
  glob_str: A relative or absolute path or Unix glob.
750
752
  base_path: A path to use to infer a directory structure; see examples.
751
753
  policy: One of `live`, `now`, or `end`.
@@ -830,7 +832,7 @@ def agent(
830
832
  is a part of, what function to execute, and (optionally) how
831
833
  many agents to run.
832
834
 
833
- Arguments:
835
+ Args:
834
836
  sweep_id: The unique identifier for a sweep. A sweep ID
835
837
  is generated by W&B CLI or Python SDK.
836
838
  function: A function to call instead of the "program"
@@ -858,7 +860,7 @@ def define_metric(
858
860
  ) -> wandb_metric.Metric:
859
861
  """Customize metrics logged with `wandb.log()`.
860
862
 
861
- Arguments:
863
+ Args:
862
864
  name: The name of the metric to customize.
863
865
  step_metric: The name of another metric to serve as the X-axis
864
866
  for this metric in automatically generated charts.
@@ -893,7 +895,7 @@ def log_artifact(
893
895
  ) -> Artifact:
894
896
  """Declare an artifact as an output of a run.
895
897
 
896
- Arguments:
898
+ Args:
897
899
  artifact_or_path: (str or Artifact) A path to the contents of this artifact,
898
900
  can be in the following forms:
899
901
  - `/local/directory`
@@ -927,7 +929,7 @@ def use_artifact(
927
929
 
928
930
  Call `download` or `file` on the returned object to get the contents locally.
929
931
 
930
- Arguments:
932
+ Args:
931
933
  artifact_or_name: (str or Artifact) An artifact name.
932
934
  May be prefixed with project/ or entity/project/.
933
935
  If no entity is specified in the name, the Run or API setting's entity is used.
@@ -952,7 +954,7 @@ def log_model(
952
954
  ) -> None:
953
955
  """Logs a model artifact containing the contents inside the 'path' to a run and marks it as an output to this run.
954
956
 
955
- Arguments:
957
+ Args:
956
958
  path: (str) A path to the contents of this model,
957
959
  can be in the following forms:
958
960
  - `/local/directory`
@@ -994,7 +996,7 @@ def log_model(
994
996
  def use_model(name: str) -> FilePathStr:
995
997
  """Download the files logged in a model artifact 'name'.
996
998
 
997
- Arguments:
999
+ Args:
998
1000
  name: (str) A model artifact name. 'name' must match the name of an existing logged
999
1001
  model artifact.
1000
1002
  May be prefixed with entity/project/. Valid names
@@ -1051,7 +1053,7 @@ def link_model(
1051
1053
  - Link version of model artifact 'name' to registered model, 'registered_model_name'.
1052
1054
  - Attach aliases from 'aliases' list to the newly linked model artifact version.
1053
1055
 
1054
- Arguments:
1056
+ Args:
1055
1057
  path: (str) A path to the contents of this model,
1056
1058
  can be in the following forms:
1057
1059
  - `/local/directory`
@@ -1108,11 +1110,11 @@ def plot_table(
1108
1110
  data_table: Table,
1109
1111
  fields: dict[str, Any],
1110
1112
  string_fields: dict[str, Any] | None = None,
1111
- split_table: bool | None = False,
1113
+ split_table: bool = False,
1112
1114
  ) -> CustomChart:
1113
1115
  """Create a custom plot on a table.
1114
1116
 
1115
- Arguments:
1117
+ Args:
1116
1118
  vega_spec_name: the name of the spec for the plot
1117
1119
  data_table: a wandb.Table object containing the data to
1118
1120
  be used on the visualization
wandb/agents/pyagent.py CHANGED
@@ -337,7 +337,7 @@ class Agent:
337
337
  def pyagent(sweep_id, function, entity=None, project=None, count=None):
338
338
  """Generic agent entrypoint, used for CLI or jupyter.
339
339
 
340
- Arguments:
340
+ Args:
341
341
  sweep_id (dict): Sweep ID generated by CLI or sweep API
342
342
  function (func, optional): A function to call instead of the "program"
343
343
  entity (str, optional): W&B Entity
@@ -573,7 +573,7 @@ class WandbImporter:
573
573
  project = coalesce(project, src_art.project)
574
574
  name = src_art.name
575
575
 
576
- return self.dst_api.artifact(f"{entity}/{project}/{name}")
576
+ return self.dst_api._artifact(f"{entity}/{project}/{name}")
577
577
 
578
578
  def _get_run_problems(
579
579
  self, src_run: Run, dst_run: Run, force_retry: bool = False
wandb/apis/normalize.py CHANGED
@@ -3,34 +3,18 @@
3
3
  import ast
4
4
  import sys
5
5
  from functools import wraps
6
- from typing import Callable, List, TypeVar
6
+ from typing import Callable, TypeVar
7
7
 
8
8
  import requests
9
9
  from wandb_gql.client import RetryError
10
10
 
11
11
  from wandb import env
12
12
  from wandb.errors import CommError, Error
13
+ from wandb.util import parse_backend_error_messages
13
14
 
14
15
  _F = TypeVar("_F", bound=Callable)
15
16
 
16
17
 
17
- def parse_backend_error_messages(response: requests.Response) -> List[str]:
18
- errors = []
19
- try:
20
- data = response.json()
21
- except ValueError:
22
- return errors
23
-
24
- if "errors" in data and isinstance(data["errors"], list):
25
- for error in data["errors"]:
26
- # Our tests and potentially some api endpoints return a string error?
27
- if isinstance(error, str):
28
- error = {"message": error}
29
- if "message" in error:
30
- errors.append(error["message"])
31
- return errors
32
-
33
-
34
18
  def normalize_exceptions(func: _F) -> _F:
35
19
  """Function decorator for catching common errors and re-raising as wandb.Error."""
36
20