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/sdk/wandb_setup.py CHANGED
@@ -21,7 +21,7 @@ import wandb
21
21
  from wandb.sdk.lib import import_hooks
22
22
 
23
23
  from . import wandb_settings
24
- from .lib import config_util, server, tracelog
24
+ from .lib import config_util, server
25
25
 
26
26
  Settings = Union["wandb.sdk.wandb_settings.Settings", Dict[str, Any]]
27
27
 
@@ -114,10 +114,6 @@ class _WandbSetup__WandbSetup: # noqa: N801
114
114
  self._check()
115
115
  self._setup()
116
116
 
117
- tracelog_mode = self._settings._tracelog
118
- if tracelog_mode:
119
- tracelog.enable(tracelog_mode)
120
-
121
117
  def _settings_setup(
122
118
  self,
123
119
  settings: Optional[Settings] = None,
wandb/sdk/wandb_sync.py CHANGED
@@ -1,7 +1,8 @@
1
1
  import pathlib
2
2
  from typing import TYPE_CHECKING, Optional
3
3
 
4
- from ..errors.term import termerror, termlog
4
+ from wandb.errors.term import termerror, termlog
5
+
5
6
  from . import wandb_setup
6
7
  from .backend.backend import Backend
7
8
  from .lib.mailbox import Mailbox
wandb/util.py CHANGED
@@ -84,7 +84,6 @@ _not_importable = set()
84
84
 
85
85
  MAX_LINE_BYTES = (10 << 20) - (100 << 10) # imposed by back end
86
86
  IS_GIT = os.path.exists(os.path.join(os.path.dirname(__file__), "..", ".git"))
87
- RE_WINFNAMES = re.compile(r'[<>:"\\?*]')
88
87
 
89
88
  # From https://docs.docker.com/engine/reference/commandline/tag/
90
89
  # "Name components may contain lowercase letters, digits and separators.
@@ -881,6 +880,23 @@ def no_retry_4xx(e: Exception) -> bool:
881
880
  raise UsageError(body["errors"][0]["message"])
882
881
 
883
882
 
883
+ def parse_backend_error_messages(response: requests.Response) -> List[str]:
884
+ errors: List[str] = []
885
+ try:
886
+ data = response.json()
887
+ except ValueError:
888
+ return errors
889
+
890
+ if "errors" in data and isinstance(data["errors"], list):
891
+ for error in data["errors"]:
892
+ # Our tests and potentially some api endpoints return a string error?
893
+ if isinstance(error, str):
894
+ error = {"message": error}
895
+ if "message" in error:
896
+ errors.append(error["message"])
897
+ return errors
898
+
899
+
884
900
  def no_retry_auth(e: Any) -> bool:
885
901
  if hasattr(e, "exception"):
886
902
  e = e.exception
@@ -894,7 +910,9 @@ def no_retry_auth(e: Any) -> bool:
894
910
  # Retry all non-forbidden/unauthorized/not-found errors.
895
911
  if e.response.status_code not in (401, 403, 404):
896
912
  return True
897
- # Crash w/message on forbidden/unauthorized errors.
913
+
914
+ # Crash with more informational message on forbidden/unauthorized errors.
915
+ # UnauthorizedError
898
916
  if e.response.status_code == 401:
899
917
  raise AuthenticationError(
900
918
  "The API key you provided is either invalid or missing. "
@@ -904,15 +922,29 @@ def no_retry_auth(e: Any) -> bool:
904
922
  "If you're not sure, you can try logging in again using the 'wandb login --relogin --host [hostname]' command."
905
923
  f"(Error {e.response.status_code}: {e.response.reason})"
906
924
  )
907
- elif wandb.run:
908
- raise CommError(f"Permission denied to access {wandb.run.path}")
909
- else:
910
- raise CommError(
911
- "It appears that you do not have permission to access the requested resource. "
912
- "Please reach out to the project owner to grant you access. "
913
- "If you have the correct permissions, verify that there are no issues with your networking setup."
914
- f"(Error {e.response.status_code}: {e.response.reason})"
915
- )
925
+ # ForbiddenError
926
+ if e.response.status_code == 403:
927
+ if wandb.run:
928
+ raise CommError(f"Permission denied to access {wandb.run.path}")
929
+ else:
930
+ raise CommError(
931
+ "It appears that you do not have permission to access the requested resource. "
932
+ "Please reach out to the project owner to grant you access. "
933
+ "If you have the correct permissions, verify that there are no issues with your networking setup."
934
+ f"(Error {e.response.status_code}: {e.response.reason})"
935
+ )
936
+
937
+ # NotFoundError
938
+ if e.response.status_code == 404:
939
+ # If error message is empty, raise a more generic NotFoundError message.
940
+ if parse_backend_error_messages(e.response):
941
+ return False
942
+ else:
943
+ raise LookupError(
944
+ f"Failed to find resource. Please make sure you have the correct resource path. "
945
+ f"(Error {e.response.status_code}: {e.response.reason})"
946
+ )
947
+ return False
916
948
 
917
949
 
918
950
  def check_retry_conflict(e: Any) -> Optional[bool]:
@@ -956,7 +988,7 @@ def make_check_retry_fn(
956
988
  ) -> CheckRetryFnType:
957
989
  """Return a check_retry_fn which can be used by lib.Retry().
958
990
 
959
- Arguments:
991
+ Args:
960
992
  fallback_fn: Use this function if check_fn didn't decide if a retry should happen.
961
993
  check_fn: Function which returns bool if retry should happen or None if unsure.
962
994
  check_timedelta: Optional retry timeout if we check_fn matches the exception
@@ -978,7 +1010,7 @@ def make_check_retry_fn(
978
1010
  def find_runner(program: str) -> Union[None, list, List[str]]:
979
1011
  """Return a command that will run program.
980
1012
 
981
- Arguments:
1013
+ Args:
982
1014
  program: The string name of the program to try to run.
983
1015
 
984
1016
  Returns:
@@ -1283,7 +1315,7 @@ def prompt_choices(
1283
1315
  def guess_data_type(shape: Sequence[int], risky: bool = False) -> Optional[str]:
1284
1316
  """Infer the type of data based on the shape of the tensors.
1285
1317
 
1286
- Arguments:
1318
+ Args:
1287
1319
  shape (Sequence[int]): The shape of the data
1288
1320
  risky(bool): some guesses are more likely to be wrong.
1289
1321
  """
@@ -1563,10 +1595,6 @@ def _is_py_requirements_or_dockerfile(path: str) -> bool:
1563
1595
  )
1564
1596
 
1565
1597
 
1566
- def check_windows_valid_filename(path: Union[int, str]) -> bool:
1567
- return not bool(re.search(RE_WINFNAMES, path)) # type: ignore
1568
-
1569
-
1570
1598
  def artifact_to_json(artifact: "Artifact") -> Dict[str, Any]:
1571
1599
  return {
1572
1600
  "_type": "artifactVersion",
@@ -1943,9 +1971,9 @@ def get_core_path() -> str:
1943
1971
  bin_path = pathlib.Path(__file__).parent / "bin" / "wandb-core"
1944
1972
  if not bin_path.exists():
1945
1973
  raise WandbCoreNotAvailableError(
1946
- f"Looks like wandb-core is not compiled for your system ({platform.platform()}):"
1947
- " Please contact support at support@wandb.com to request `wandb-core`"
1948
- " support for your system."
1974
+ f"File not found: {bin_path}."
1975
+ "Please contact support at support@wandb.com."
1976
+ f"Your platform is: {platform.platform()}."
1949
1977
  )
1950
1978
 
1951
1979
  return str(bin_path)
wandb/wandb_agent.py CHANGED
@@ -19,6 +19,7 @@ from wandb import util, wandb_lib, wandb_sdk
19
19
  from wandb.agents.pyagent import pyagent
20
20
  from wandb.apis import InternalApi
21
21
  from wandb.sdk.launch.sweeps import utils as sweep_utils
22
+ from wandb.sdk.lib import ipython
22
23
 
23
24
  logger = logging.getLogger(__name__)
24
25
 
@@ -546,7 +547,7 @@ def agent(
546
547
  is a part of, what function to execute, and (optionally) how
547
548
  many agents to run.
548
549
 
549
- Arguments:
550
+ Args:
550
551
  sweep_id: The unique identifier for a sweep. A sweep ID
551
552
  is generated by W&B CLI or Python SDK.
552
553
  function: A function to call instead of the "program"
@@ -568,11 +569,10 @@ def agent(
568
569
  wandb_sdk.wandb_login._login(_silent=True)
569
570
  if function:
570
571
  return pyagent(sweep_id, function, entity, project, count)
571
- in_jupyter = wandb.wandb_sdk.lib.ipython._get_python_type() != "python"
572
572
  return run_agent(
573
573
  sweep_id,
574
574
  function=function,
575
- in_jupyter=in_jupyter,
575
+ in_jupyter=ipython.in_jupyter(),
576
576
  entity=entity,
577
577
  project=project,
578
578
  count=count,
wandb/wandb_controller.py CHANGED
@@ -88,8 +88,6 @@ def _id_generator(size=10, chars=string.ascii_lowercase + string.digits):
88
88
  class ControllerError(Exception):
89
89
  """Base class for sweep errors."""
90
90
 
91
- pass
92
-
93
91
 
94
92
  class _WandbController:
95
93
  """Sweep controller class.
@@ -309,6 +307,8 @@ class _WandbController:
309
307
  self._create["parameters"][name]["value"] = value
310
308
  if values is not None:
311
309
  self._create["parameters"][name]["values"] = values
310
+ if distribution is not None:
311
+ self._create["parameters"][name]["distribution"] = distribution
312
312
  if min is not None:
313
313
  self._create["parameters"][name]["min"] = min
314
314
  if max is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wandb
3
- Version: 0.18.5
3
+ Version: 0.18.7
4
4
  Summary: A CLI and library for interacting with the Weights & Biases API.
5
5
  Project-URL: Source, https://github.com/wandb/wandb
6
6
  Project-URL: Bug Reports, https://github.com/wandb/wandb/issues
@@ -27,7 +27,6 @@ License: MIT License
27
27
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
28
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
29
  SOFTWARE.
30
- License-File: LICENSE
31
30
  Classifier: Development Status :: 5 - Production/Stable
32
31
  Classifier: Intended Audience :: Developers
33
32
  Classifier: Intended Audience :: Science/Research