wandb 0.16.5__py3-none-any.whl → 0.17.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package_readme.md +95 -0
  2. wandb/__init__.py +2 -3
  3. wandb/agents/pyagent.py +0 -1
  4. wandb/analytics/sentry.py +2 -1
  5. wandb/apis/importers/internals/internal.py +0 -1
  6. wandb/apis/importers/internals/protocols.py +30 -56
  7. wandb/apis/importers/mlflow.py +13 -26
  8. wandb/apis/importers/wandb.py +8 -14
  9. wandb/apis/internal.py +0 -3
  10. wandb/apis/public/api.py +55 -3
  11. wandb/apis/public/artifacts.py +1 -0
  12. wandb/apis/public/files.py +1 -0
  13. wandb/apis/public/history.py +1 -0
  14. wandb/apis/public/jobs.py +17 -4
  15. wandb/apis/public/projects.py +1 -0
  16. wandb/apis/public/reports.py +1 -0
  17. wandb/apis/public/runs.py +15 -17
  18. wandb/apis/public/sweeps.py +1 -0
  19. wandb/apis/public/teams.py +1 -0
  20. wandb/apis/public/users.py +1 -0
  21. wandb/apis/reports/v1/_blocks.py +3 -7
  22. wandb/apis/reports/v2/gql.py +1 -0
  23. wandb/apis/reports/v2/interface.py +3 -4
  24. wandb/apis/reports/v2/internal.py +5 -8
  25. wandb/cli/cli.py +95 -22
  26. wandb/data_types.py +9 -6
  27. wandb/docker/__init__.py +1 -1
  28. wandb/env.py +38 -8
  29. wandb/errors/__init__.py +5 -0
  30. wandb/errors/term.py +10 -2
  31. wandb/filesync/step_checksum.py +1 -4
  32. wandb/filesync/step_prepare.py +4 -24
  33. wandb/filesync/step_upload.py +4 -106
  34. wandb/filesync/upload_job.py +0 -76
  35. wandb/integration/catboost/catboost.py +1 -1
  36. wandb/integration/fastai/__init__.py +1 -0
  37. wandb/integration/huggingface/resolver.py +2 -2
  38. wandb/integration/keras/__init__.py +1 -0
  39. wandb/integration/keras/callbacks/metrics_logger.py +1 -1
  40. wandb/integration/keras/keras.py +7 -7
  41. wandb/integration/langchain/wandb_tracer.py +1 -0
  42. wandb/integration/lightning/fabric/logger.py +1 -3
  43. wandb/integration/metaflow/metaflow.py +41 -6
  44. wandb/integration/openai/fine_tuning.py +77 -40
  45. wandb/integration/prodigy/prodigy.py +1 -1
  46. wandb/old/summary.py +1 -1
  47. wandb/plot/confusion_matrix.py +1 -1
  48. wandb/plot/pr_curve.py +2 -1
  49. wandb/plot/roc_curve.py +2 -1
  50. wandb/{plots → plot}/utils.py +13 -25
  51. wandb/proto/v3/wandb_internal_pb2.py +364 -332
  52. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  53. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  54. wandb/proto/v4/wandb_internal_pb2.py +322 -316
  55. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  56. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  57. wandb/proto/wandb_deprecated.py +7 -1
  58. wandb/proto/wandb_internal_codegen.py +3 -29
  59. wandb/sdk/artifacts/artifact.py +51 -20
  60. wandb/sdk/artifacts/artifact_download_logger.py +1 -0
  61. wandb/sdk/artifacts/artifact_file_cache.py +18 -4
  62. wandb/sdk/artifacts/artifact_instance_cache.py +1 -0
  63. wandb/sdk/artifacts/artifact_manifest.py +1 -0
  64. wandb/sdk/artifacts/artifact_manifest_entry.py +7 -3
  65. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -0
  66. wandb/sdk/artifacts/artifact_saver.py +18 -27
  67. wandb/sdk/artifacts/artifact_state.py +1 -0
  68. wandb/sdk/artifacts/artifact_ttl.py +1 -0
  69. wandb/sdk/artifacts/exceptions.py +1 -0
  70. wandb/sdk/artifacts/storage_handlers/azure_handler.py +1 -0
  71. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +13 -18
  72. wandb/sdk/artifacts/storage_handlers/http_handler.py +1 -0
  73. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +1 -0
  74. wandb/sdk/artifacts/storage_handlers/multi_handler.py +1 -0
  75. wandb/sdk/artifacts/storage_handlers/s3_handler.py +5 -3
  76. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +1 -0
  77. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +1 -0
  78. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -0
  79. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +3 -42
  80. wandb/sdk/artifacts/storage_policy.py +2 -12
  81. wandb/sdk/data_types/_dtypes.py +8 -8
  82. wandb/sdk/data_types/base_types/media.py +3 -6
  83. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +3 -1
  84. wandb/sdk/data_types/image.py +1 -1
  85. wandb/sdk/data_types/video.py +1 -1
  86. wandb/sdk/integration_utils/auto_logging.py +5 -6
  87. wandb/sdk/integration_utils/data_logging.py +10 -6
  88. wandb/sdk/interface/interface.py +86 -38
  89. wandb/sdk/interface/interface_shared.py +7 -13
  90. wandb/sdk/internal/datastore.py +1 -1
  91. wandb/sdk/internal/file_pusher.py +2 -5
  92. wandb/sdk/internal/file_stream.py +5 -18
  93. wandb/sdk/internal/handler.py +18 -2
  94. wandb/sdk/internal/internal.py +0 -1
  95. wandb/sdk/internal/internal_api.py +1 -129
  96. wandb/sdk/internal/internal_util.py +0 -1
  97. wandb/sdk/internal/job_builder.py +159 -45
  98. wandb/sdk/internal/profiler.py +1 -0
  99. wandb/sdk/internal/progress.py +0 -28
  100. wandb/sdk/internal/run.py +1 -0
  101. wandb/sdk/internal/sender.py +1 -2
  102. wandb/sdk/internal/system/assets/gpu_amd.py +44 -44
  103. wandb/sdk/internal/system/assets/gpu_apple.py +56 -11
  104. wandb/sdk/internal/system/assets/interfaces.py +6 -8
  105. wandb/sdk/internal/system/assets/open_metrics.py +2 -2
  106. wandb/sdk/internal/system/assets/trainium.py +1 -3
  107. wandb/sdk/launch/__init__.py +9 -1
  108. wandb/sdk/launch/_launch.py +9 -24
  109. wandb/sdk/launch/_launch_add.py +1 -3
  110. wandb/sdk/launch/_project_spec.py +188 -241
  111. wandb/sdk/launch/agent/agent.py +115 -48
  112. wandb/sdk/launch/agent/config.py +80 -14
  113. wandb/sdk/launch/builder/abstract.py +69 -1
  114. wandb/sdk/launch/builder/build.py +156 -555
  115. wandb/sdk/launch/builder/context_manager.py +235 -0
  116. wandb/sdk/launch/builder/docker_builder.py +8 -23
  117. wandb/sdk/launch/builder/kaniko_builder.py +161 -159
  118. wandb/sdk/launch/builder/noop.py +1 -0
  119. wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
  120. wandb/sdk/launch/create_job.py +68 -63
  121. wandb/sdk/launch/environment/abstract.py +1 -0
  122. wandb/sdk/launch/environment/gcp_environment.py +1 -0
  123. wandb/sdk/launch/environment/local_environment.py +1 -0
  124. wandb/sdk/launch/inputs/files.py +148 -0
  125. wandb/sdk/launch/inputs/internal.py +217 -0
  126. wandb/sdk/launch/inputs/manage.py +95 -0
  127. wandb/sdk/launch/loader.py +1 -0
  128. wandb/sdk/launch/registry/abstract.py +1 -0
  129. wandb/sdk/launch/registry/azure_container_registry.py +1 -0
  130. wandb/sdk/launch/registry/elastic_container_registry.py +1 -0
  131. wandb/sdk/launch/registry/google_artifact_registry.py +2 -1
  132. wandb/sdk/launch/registry/local_registry.py +1 -0
  133. wandb/sdk/launch/runner/abstract.py +1 -0
  134. wandb/sdk/launch/runner/kubernetes_monitor.py +4 -1
  135. wandb/sdk/launch/runner/kubernetes_runner.py +9 -10
  136. wandb/sdk/launch/runner/local_container.py +2 -3
  137. wandb/sdk/launch/runner/local_process.py +8 -29
  138. wandb/sdk/launch/runner/sagemaker_runner.py +21 -20
  139. wandb/sdk/launch/runner/vertex_runner.py +8 -7
  140. wandb/sdk/launch/sweeps/scheduler.py +7 -4
  141. wandb/sdk/launch/sweeps/scheduler_sweep.py +2 -1
  142. wandb/sdk/launch/sweeps/utils.py +3 -3
  143. wandb/sdk/launch/utils.py +33 -140
  144. wandb/sdk/lib/_settings_toposort_generated.py +1 -5
  145. wandb/sdk/lib/fsm.py +8 -12
  146. wandb/sdk/lib/gitlib.py +4 -4
  147. wandb/sdk/lib/import_hooks.py +1 -1
  148. wandb/sdk/lib/lazyloader.py +0 -1
  149. wandb/sdk/lib/proto_util.py +23 -2
  150. wandb/sdk/lib/redirect.py +19 -14
  151. wandb/sdk/lib/retry.py +3 -2
  152. wandb/sdk/lib/run_moment.py +7 -1
  153. wandb/sdk/lib/tracelog.py +1 -1
  154. wandb/sdk/service/service.py +19 -16
  155. wandb/sdk/verify/verify.py +2 -1
  156. wandb/sdk/wandb_init.py +16 -63
  157. wandb/sdk/wandb_manager.py +2 -2
  158. wandb/sdk/wandb_require.py +5 -0
  159. wandb/sdk/wandb_run.py +164 -90
  160. wandb/sdk/wandb_settings.py +2 -48
  161. wandb/sdk/wandb_setup.py +1 -1
  162. wandb/sklearn/__init__.py +1 -0
  163. wandb/sklearn/plot/__init__.py +1 -0
  164. wandb/sklearn/plot/classifier.py +11 -12
  165. wandb/sklearn/plot/clusterer.py +2 -1
  166. wandb/sklearn/plot/regressor.py +1 -0
  167. wandb/sklearn/plot/shared.py +1 -0
  168. wandb/sklearn/utils.py +1 -0
  169. wandb/testing/relay.py +4 -4
  170. wandb/trigger.py +1 -0
  171. wandb/util.py +67 -54
  172. wandb/wandb_controller.py +2 -3
  173. wandb/wandb_torch.py +1 -2
  174. {wandb-0.16.5.dist-info → wandb-0.17.0.dist-info}/METADATA +67 -70
  175. {wandb-0.16.5.dist-info → wandb-0.17.0.dist-info}/RECORD +178 -188
  176. {wandb-0.16.5.dist-info → wandb-0.17.0.dist-info}/WHEEL +1 -2
  177. wandb/bin/apple_gpu_stats +0 -0
  178. wandb/catboost/__init__.py +0 -9
  179. wandb/fastai/__init__.py +0 -9
  180. wandb/keras/__init__.py +0 -18
  181. wandb/lightgbm/__init__.py +0 -9
  182. wandb/plots/__init__.py +0 -6
  183. wandb/plots/explain_text.py +0 -36
  184. wandb/plots/heatmap.py +0 -81
  185. wandb/plots/named_entity.py +0 -43
  186. wandb/plots/part_of_speech.py +0 -50
  187. wandb/plots/plot_definitions.py +0 -768
  188. wandb/plots/precision_recall.py +0 -121
  189. wandb/plots/roc.py +0 -103
  190. wandb/sacred/__init__.py +0 -3
  191. wandb/xgboost/__init__.py +0 -9
  192. wandb-0.16.5.dist-info/top_level.txt +0 -1
  193. {wandb-0.16.5.dist-info → wandb-0.17.0.dist-info}/entry_points.txt +0 -0
  194. {wandb-0.16.5.dist-info → wandb-0.17.0.dist-info/licenses}/LICENSE +0 -0
package_readme.md ADDED
@@ -0,0 +1,95 @@
1
+ <div align="center">
2
+ <img src="https://i.imgur.com/RUtiVzH.png" width="600" /><br><br>
3
+ </div>
4
+
5
+ # Weights and Biases [![PyPI](https://img.shields.io/pypi/v/wandb)](https://pypi.python.org/pypi/wandb) [![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/wandb)](https://anaconda.org/conda-forge/wandb) [![CircleCI](https://img.shields.io/circleci/build/github/wandb/wandb/main)](https://circleci.com/gh/wandb/wandb) [![Codecov](https://img.shields.io/codecov/c/gh/wandb/wandb)](https://codecov.io/gh/wandb/wandb)
6
+
7
+ Use W&B to build better models faster. Track and visualize all the pieces of your machine learning pipeline, from datasets to production models.
8
+
9
+ - Quickly identify model regressions. Use W&B to visualize results in real time, all in a central dashboard.
10
+ - Focus on the interesting ML. Spend less time manually tracking results in spreadsheets and text files.
11
+ - Capture dataset versions with W&B Artifacts to identify how changing data affects your resulting models.
12
+ - Reproduce any model, with saved code, hyperparameters, launch commands, input data, and resulting model weights.
13
+
14
+ [Sign up for a free account →](https://wandb.ai/login?signup=true)
15
+
16
+ ## Features
17
+
18
+ - Store hyper-parameters used in a training run
19
+ - Search, compare, and visualize training runs
20
+ - Analyze system usage metrics alongside runs
21
+ - Collaborate with team members
22
+ - Replicate historic results
23
+ - Run parameter sweeps
24
+ - Keep records of experiments available forever
25
+
26
+ [Documentation →](https://docs.wandb.com)
27
+
28
+ ## Quickstart
29
+
30
+ ```shell
31
+ pip install wandb
32
+ ```
33
+
34
+ In your training script:
35
+
36
+ ```python
37
+ import wandb
38
+
39
+ # Your custom arguments defined here
40
+ args = ...
41
+
42
+ wandb.init(config=args, project="my-project")
43
+ wandb.config["more"] = "custom"
44
+
45
+
46
+ def training_loop():
47
+ while True:
48
+ # Do some machine learning
49
+ epoch, loss, val_loss = ...
50
+ # Framework agnostic / custom metrics
51
+ wandb.log({"epoch": epoch, "loss": loss, "val_loss": val_loss})
52
+ ```
53
+
54
+ If you're already using Tensorboard or [TensorboardX](https://github.com/lanpa/tensorboardX), you can integrate with one line:
55
+
56
+ ```python
57
+ wandb.init(sync_tensorboard=True)
58
+ ```
59
+
60
+ ## Running your script
61
+
62
+ Run `wandb login` from your terminal to signup or authenticate your machine (we store your api key in ~/.netrc). You can also set the `WANDB_API_KEY` environment variable with a key from your [settings](https://app.wandb.ai/settings).
63
+
64
+ Run your script with `python my_script.py` and all metadata will be synced to the cloud. You will see a url in your terminal logs when your script starts and finishes. Data is staged locally in a directory named _wandb_ relative to your script. If you want to test your script without syncing to the cloud you can set the environment variable `WANDB_MODE=dryrun`.
65
+
66
+ If you are using [docker](https://docker.com) to run your code, we provide a wrapper command `wandb docker` that mounts your current directory, sets environment variables, and ensures the wandb library is installed. Training your models in docker gives you the ability to restore the exact code and environment with the `wandb restore` command.
67
+
68
+ ## Web Interface
69
+
70
+ [Sign up for a free account →](https://wandb.com)
71
+ [![Watch the video](https://i.imgur.com/PW0Ejlc.png)](https://youtu.be/EeqhOSvNX-A)
72
+ [Introduction video →](https://youtu.be/EeqhOSvNX-A)
73
+
74
+ ## Detailed Usage
75
+
76
+ Framework specific and detailed usage can be found in our [documentation](http://docs.wandb.com/).
77
+
78
+ ## Testing
79
+
80
+ To run basic test use `make test`. More detailed information can be found at CONTRIBUTING.md.
81
+
82
+ We use [circleci](https://circleci.com) for CI.
83
+
84
+ # Academic Researchers
85
+ If you'd like a free academic account for your research group, [reach out to us →](https://www.wandb.com/academic)
86
+
87
+ We make it easy to cite W&B in your published paper. [Learn more →](https://www.wandb.com/academic)
88
+ [![](https://i.imgur.com/loKLiez.png)](https://www.wandb.com/academic)
89
+
90
+ ## Community
91
+ Got questions, feedback or want to join a community of ML engineers working on exciting projects?
92
+
93
+ <a href="https://bit.ly/wb-slack"><img src="https://svgshare.com/i/M93.svg" alt="slack" width="55"/></a> Join our [slack](https://bit.ly/wb-slack) community.
94
+
95
+ [![Twitter](https://img.shields.io/twitter/follow/weights_biases?style=social)](https://twitter.com/weights_biases) Follow us on [Twitter](https://twitter.com/weights_biases).
wandb/__init__.py CHANGED
@@ -11,8 +11,8 @@ For scripts and interactive notebooks, see https://github.com/wandb/examples.
11
11
 
12
12
  For reference documentation, see https://docs.wandb.com/ref/python.
13
13
  """
14
- __version__ = "0.16.5"
15
- _minimum_core_version = "0.17.0b10"
14
+ __version__ = "0.17.0"
15
+
16
16
 
17
17
  # Used with pypi checks and other messages related to pip
18
18
  _wandb_module = "wandb"
@@ -85,7 +85,6 @@ from wandb.wandb_agent import agent
85
85
  # from wandb.core import *
86
86
  from wandb.viz import visualize
87
87
  from wandb import plot
88
- from wandb import plots # deprecating this
89
88
  from wandb.integration.sagemaker import sagemaker_auth
90
89
  from wandb.sdk.internal import profiler
91
90
 
wandb/agents/pyagent.py CHANGED
@@ -4,7 +4,6 @@ Manage wandb agent.
4
4
 
5
5
  """
6
6
 
7
-
8
7
  import ctypes
9
8
  import logging
10
9
  import os
wandb/analytics/sentry.py CHANGED
@@ -137,7 +137,8 @@ class Sentry:
137
137
  self.mark_session(status=status)
138
138
 
139
139
  client, _ = self.hub._stack[-1] # type: ignore
140
- client.flush()
140
+ if client is not None:
141
+ client.flush()
141
142
 
142
143
  return None
143
144
 
@@ -323,7 +323,6 @@ def _make_settings(
323
323
  "_sync": True,
324
324
  "_live_policy_rate_limit": 15, # matches dir_watcher
325
325
  "_live_policy_wait_time": 600, # matches dir_watcher
326
- "_async_upload_concurrency_limit": None,
327
326
  "_file_stream_timeout_seconds": 60,
328
327
  }
329
328
 
@@ -17,20 +17,15 @@ Policy = Literal["now", "end", "live"]
17
17
 
18
18
  @runtime_checkable
19
19
  class ImporterRun(Protocol):
20
- def run_id(self) -> str:
21
- ... # pragma: no cover
20
+ def run_id(self) -> str: ... # pragma: no cover
22
21
 
23
- def entity(self) -> str:
24
- ... # pragma: no cover
22
+ def entity(self) -> str: ... # pragma: no cover
25
23
 
26
- def project(self) -> str:
27
- ... # pragma: no cover
24
+ def project(self) -> str: ... # pragma: no cover
28
25
 
29
- def config(self) -> Dict[str, Any]:
30
- ... # pragma: no cover
26
+ def config(self) -> Dict[str, Any]: ... # pragma: no cover
31
27
 
32
- def summary(self) -> Dict[str, float]:
33
- ... # pragma: no cover
28
+ def summary(self) -> Dict[str, float]: ... # pragma: no cover
34
29
 
35
30
  def metrics(self) -> Iterable[Dict[str, float]]:
36
31
  """Metrics for the run.
@@ -55,71 +50,50 @@ class ImporterRun(Protocol):
55
50
  """
56
51
  ... # pragma: no cover
57
52
 
58
- def run_group(self) -> Optional[str]:
59
- ... # pragma: no cover
53
+ def run_group(self) -> Optional[str]: ... # pragma: no cover
60
54
 
61
- def job_type(self) -> Optional[str]:
62
- ... # pragma: no cover
55
+ def job_type(self) -> Optional[str]: ... # pragma: no cover
63
56
 
64
- def display_name(self) -> str:
65
- ... # pragma: no cover
57
+ def display_name(self) -> str: ... # pragma: no cover
66
58
 
67
- def notes(self) -> Optional[str]:
68
- ... # pragma: no cover
59
+ def notes(self) -> Optional[str]: ... # pragma: no cover
69
60
 
70
- def tags(self) -> Optional[List[str]]:
71
- ... # pragma: no cover
61
+ def tags(self) -> Optional[List[str]]: ... # pragma: no cover
72
62
 
73
- def artifacts(self) -> Optional[Iterable[Artifact]]:
74
- ... # pragma: no cover
63
+ def artifacts(self) -> Optional[Iterable[Artifact]]: ... # pragma: no cover
75
64
 
76
- def used_artifacts(self) -> Optional[Iterable[Artifact]]:
77
- ... # pragma: no cover
65
+ def used_artifacts(self) -> Optional[Iterable[Artifact]]: ... # pragma: no cover
78
66
 
79
- def os_version(self) -> Optional[str]:
80
- ... # pragma: no cover
67
+ def os_version(self) -> Optional[str]: ... # pragma: no cover
81
68
 
82
- def python_version(self) -> Optional[str]:
83
- ... # pragma: no cover
69
+ def python_version(self) -> Optional[str]: ... # pragma: no cover
84
70
 
85
- def cuda_version(self) -> Optional[str]:
86
- ... # pragma: no cover
71
+ def cuda_version(self) -> Optional[str]: ... # pragma: no cover
87
72
 
88
- def program(self) -> Optional[str]:
89
- ... # pragma: no cover
73
+ def program(self) -> Optional[str]: ... # pragma: no cover
90
74
 
91
- def host(self) -> Optional[str]:
92
- ... # pragma: no cover
75
+ def host(self) -> Optional[str]: ... # pragma: no cover
93
76
 
94
- def username(self) -> Optional[str]:
95
- ... # pragma: no cover
77
+ def username(self) -> Optional[str]: ... # pragma: no cover
96
78
 
97
- def executable(self) -> Optional[str]:
98
- ... # pragma: no cover
79
+ def executable(self) -> Optional[str]: ... # pragma: no cover
99
80
 
100
- def gpus_used(self) -> Optional[str]:
101
- ... # pragma: no cover
81
+ def gpus_used(self) -> Optional[str]: ... # pragma: no cover
102
82
 
103
- def cpus_used(self) -> Optional[int]:
104
- ... # pragma: no cover
83
+ def cpus_used(self) -> Optional[int]: ... # pragma: no cover
105
84
 
106
- def memory_used(self) -> Optional[int]:
107
- ... # pragma: no cover
85
+ def memory_used(self) -> Optional[int]: ... # pragma: no cover
108
86
 
109
- def runtime(self) -> Optional[int]:
110
- ... # pragma: no cover
87
+ def runtime(self) -> Optional[int]: ... # pragma: no cover
111
88
 
112
- def start_time(self) -> Optional[int]:
113
- ... # pragma: no cover
89
+ def start_time(self) -> Optional[int]: ... # pragma: no cover
114
90
 
115
- def code_path(self) -> Optional[str]:
116
- ... # pragma: no cover
91
+ def code_path(self) -> Optional[str]: ... # pragma: no cover
117
92
 
118
- def cli_version(self) -> Optional[str]:
119
- ... # pragma: no cover
93
+ def cli_version(self) -> Optional[str]: ... # pragma: no cover
120
94
 
121
- def files(self) -> Optional[Iterable[Tuple[PathStr, Policy]]]:
122
- ... # pragma: no cover
95
+ def files(
96
+ self,
97
+ ) -> Optional[Iterable[Tuple[PathStr, Policy]]]: ... # pragma: no cover
123
98
 
124
- def logs(self) -> Optional[Iterable[str]]:
125
- ... # pragma: no cover
99
+ def logs(self) -> Optional[Iterable[str]]: ... # pragma: no cover
@@ -96,35 +96,26 @@ class MlflowRun:
96
96
  def used_artifacts(self) -> Optional[Iterable[Artifact]]: # type: ignore
97
97
  ... # pragma: no cover
98
98
 
99
- def os_version(self) -> Optional[str]:
100
- ... # pragma: no cover
99
+ def os_version(self) -> Optional[str]: ... # pragma: no cover
101
100
 
102
- def python_version(self) -> Optional[str]:
103
- ... # pragma: no cover
101
+ def python_version(self) -> Optional[str]: ... # pragma: no cover
104
102
 
105
- def cuda_version(self) -> Optional[str]:
106
- ... # pragma: no cover
103
+ def cuda_version(self) -> Optional[str]: ... # pragma: no cover
107
104
 
108
- def program(self) -> Optional[str]:
109
- ... # pragma: no cover
105
+ def program(self) -> Optional[str]: ... # pragma: no cover
110
106
 
111
- def host(self) -> Optional[str]:
112
- ... # pragma: no cover
107
+ def host(self) -> Optional[str]: ... # pragma: no cover
113
108
 
114
- def username(self) -> Optional[str]:
115
- ... # pragma: no cover
109
+ def username(self) -> Optional[str]: ... # pragma: no cover
116
110
 
117
- def executable(self) -> Optional[str]:
118
- ... # pragma: no cover
111
+ def executable(self) -> Optional[str]: ... # pragma: no cover
119
112
 
120
- def gpus_used(self) -> Optional[str]:
121
- ... # pragma: no cover
113
+ def gpus_used(self) -> Optional[str]: ... # pragma: no cover
122
114
 
123
115
  def cpus_used(self) -> Optional[int]: # can we get the model?
124
116
  ... # pragma: no cover
125
117
 
126
- def memory_used(self) -> Optional[int]:
127
- ... # pragma: no cover
118
+ def memory_used(self) -> Optional[int]: ... # pragma: no cover
128
119
 
129
120
  def runtime(self) -> Optional[int]:
130
121
  end_time = (
@@ -137,17 +128,13 @@ class MlflowRun:
137
128
  def start_time(self) -> Optional[int]:
138
129
  return self.run.info.start_time // 1000
139
130
 
140
- def code_path(self) -> Optional[str]:
141
- ... # pragma: no cover
131
+ def code_path(self) -> Optional[str]: ... # pragma: no cover
142
132
 
143
- def cli_version(self) -> Optional[str]:
144
- ... # pragma: no cover
133
+ def cli_version(self) -> Optional[str]: ... # pragma: no cover
145
134
 
146
- def files(self) -> Optional[Iterable[Tuple[str, str]]]:
147
- ... # pragma: no cover
135
+ def files(self) -> Optional[Iterable[Tuple[str, str]]]: ... # pragma: no cover
148
136
 
149
- def logs(self) -> Optional[Iterable[str]]:
150
- ... # pragma: no cover
137
+ def logs(self) -> Optional[Iterable[str]]: ... # pragma: no cover
151
138
 
152
139
  @staticmethod
153
140
  def _handle_incompatible_strings(s: str) -> str:
@@ -1,4 +1,5 @@
1
1
  """Tooling for the W&B Importer."""
2
+
2
3
  import itertools
3
4
  import json
4
5
  import logging
@@ -201,35 +202,28 @@ class WandbRun:
201
202
 
202
203
  yield from self._used_artifacts
203
204
 
204
- def os_version(self) -> Optional[str]:
205
- ... # pragma: no cover
205
+ def os_version(self) -> Optional[str]: ... # pragma: no cover
206
206
 
207
207
  def python_version(self) -> Optional[str]:
208
208
  return self._metadata_file().get("python")
209
209
 
210
- def cuda_version(self) -> Optional[str]:
211
- ... # pragma: no cover
210
+ def cuda_version(self) -> Optional[str]: ... # pragma: no cover
212
211
 
213
- def program(self) -> Optional[str]:
214
- ... # pragma: no cover
212
+ def program(self) -> Optional[str]: ... # pragma: no cover
215
213
 
216
214
  def host(self) -> Optional[str]:
217
215
  return self._metadata_file().get("host")
218
216
 
219
- def username(self) -> Optional[str]:
220
- ... # pragma: no cover
217
+ def username(self) -> Optional[str]: ... # pragma: no cover
221
218
 
222
- def executable(self) -> Optional[str]:
223
- ... # pragma: no cover
219
+ def executable(self) -> Optional[str]: ... # pragma: no cover
224
220
 
225
- def gpus_used(self) -> Optional[str]:
226
- ... # pragma: no cover
221
+ def gpus_used(self) -> Optional[str]: ... # pragma: no cover
227
222
 
228
223
  def cpus_used(self) -> Optional[int]: # can we get the model?
229
224
  ... # pragma: no cover
230
225
 
231
- def memory_used(self) -> Optional[int]:
232
- ... # pragma: no cover
226
+ def memory_used(self) -> Optional[int]: ... # pragma: no cover
233
227
 
234
228
  def runtime(self) -> Optional[int]:
235
229
  wandb_runtime = self.run.summary.get("_wandb", {}).get("runtime")
wandb/apis/internal.py CHANGED
@@ -170,9 +170,6 @@ class Api:
170
170
  def upload_multipart_file_chunk_retry(self, *args, **kwargs):
171
171
  return self.api.upload_multipart_file_chunk_retry(*args, **kwargs)
172
172
 
173
- async def upload_file_retry_async(self, *args, **kwargs):
174
- return await self.api.upload_file_retry_async(*args, **kwargs)
175
-
176
173
  def get_run_info(self, *args, **kwargs):
177
174
  return self.api.get_run_info(*args, **kwargs)
178
175
 
wandb/apis/public/api.py CHANGED
@@ -10,6 +10,7 @@ You might use the Public API to
10
10
 
11
11
  For more on using the Public API, check out [our guide](https://docs.wandb.com/guides/track/public-api-guide).
12
12
  """
13
+
13
14
  import json
14
15
  import logging
15
16
  import os
@@ -29,6 +30,7 @@ from wandb.apis.public.const import RETRY_TIMEDELTA
29
30
  from wandb.sdk.internal.thread_local_settings import _thread_local_api_settings
30
31
  from wandb.sdk.launch.utils import LAUNCH_DEFAULT_PROJECT
31
32
  from wandb.sdk.lib import retry, runid
33
+ from wandb.sdk.lib.deprecate import Deprecated, deprecate
32
34
  from wandb.sdk.lib.gql_request import GraphQLSession
33
35
 
34
36
  if TYPE_CHECKING:
@@ -109,6 +111,17 @@ class Api:
109
111
  """
110
112
 
111
113
  _HTTP_TIMEOUT = env.get_http_timeout(19)
114
+ DEFAULT_ENTITY_QUERY = gql(
115
+ """
116
+ query Viewer{
117
+ viewer {
118
+ id
119
+ entity
120
+ }
121
+ }
122
+ """
123
+ )
124
+
112
125
  VIEWER_QUERY = gql(
113
126
  """
114
127
  query Viewer{
@@ -488,7 +501,7 @@ class Api:
488
501
  @property
489
502
  def default_entity(self):
490
503
  if self._default_entity is None:
491
- res = self._client.execute(self.VIEWER_QUERY)
504
+ res = self._client.execute(self.DEFAULT_ENTITY_QUERY)
492
505
  self._default_entity = (res.get("viewer") or {}).get("entity")
493
506
  return self._default_entity
494
507
 
@@ -926,8 +939,12 @@ class Api:
926
939
  @normalize_exceptions
927
940
  def artifact_versions(self, type_name, name, per_page=50):
928
941
  """Deprecated, use artifacts(type_name, name) instead."""
929
- wandb.termwarn(
930
- "Api.artifact_versions(type_name, name) is deprecated, use Api.artifacts(type_name, name) instead."
942
+ deprecate(
943
+ field_name=Deprecated.api__artifact_versions,
944
+ warning_message=(
945
+ "Api.artifact_versions(type_name, name) is deprecated, "
946
+ "use Api.artifacts(type_name, name) instead."
947
+ ),
931
948
  )
932
949
  return self.artifacts(type_name, name, per_page=per_page)
933
950
 
@@ -1042,3 +1059,38 @@ class Api:
1042
1059
  return [x["node"]["artifacts"] for x in artifacts]
1043
1060
  except requests.exceptions.HTTPError:
1044
1061
  return False
1062
+
1063
+ @normalize_exceptions
1064
+ def artifact_exists(self, name: str, type: Optional[str] = None):
1065
+ """Return whether an artifact version exists within a specified project and entity.
1066
+
1067
+ Arguments:
1068
+ name: (str) An artifact name. May be prefixed with entity/project.
1069
+ If entity or project is not specified, it will be inferred from the override params if populated.
1070
+ Otherwise, entity will be pulled from the user settings and project will default to "uncategorized".
1071
+ Valid names can be in the following forms:
1072
+ name:version
1073
+ name:alias
1074
+ type: (str, optional) The type of artifact
1075
+ """
1076
+ try:
1077
+ self.artifact(name, type)
1078
+ return True
1079
+ except wandb.errors.CommError:
1080
+ return False
1081
+
1082
+ @normalize_exceptions
1083
+ def artifact_collection_exists(self, name: str, type: str):
1084
+ """Return whether an artifact collection exists within a specified project and entity.
1085
+
1086
+ Arguments:
1087
+ name: (str) An artifact collection name. May be prefixed with entity/project.
1088
+ If entity or project is not specified, it will be inferred from the override params if populated.
1089
+ Otherwise, entity will be pulled from the user settings and project will default to "uncategorized".
1090
+ type: (str) The type of artifact collection
1091
+ """
1092
+ try:
1093
+ self.artifact_collection(type, name)
1094
+ return True
1095
+ except wandb.errors.CommError:
1096
+ return False
@@ -1,4 +1,5 @@
1
1
  """Public API: artifacts."""
2
+
2
3
  import json
3
4
  from typing import TYPE_CHECKING, Any, Mapping, Optional, Sequence
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Public API: files."""
2
+
2
3
  import io
3
4
  import os
4
5
  from typing import Optional
@@ -1,4 +1,5 @@
1
1
  """Public API: history."""
2
+
2
3
  import json
3
4
 
4
5
  import requests
wandb/apis/public/jobs.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Public API: jobs."""
2
+
2
3
  import json
3
4
  import os
4
5
  import shutil
@@ -62,6 +63,8 @@ class Job:
62
63
  # only use notebook job if entrypoint not set and notebook is set
63
64
  self._notebook_job = source_info.get("notebook", False)
64
65
  self._entrypoint = source_info.get("entrypoint")
66
+ self._dockerfile = source_info.get("dockerfile")
67
+ self._build_context = source_info.get("build_context")
65
68
  self._args = source_info.get("args")
66
69
  self._partial = self._job_info.get("_partial", False)
67
70
  self._requirements_file = os.path.join(self._fpath, "requirements.frozen.txt")
@@ -105,7 +108,7 @@ class Job:
105
108
  )
106
109
  new_entrypoint = self._entrypoint
107
110
  new_entrypoint[-1] = new_fname
108
- launch_project.set_entry_point(new_entrypoint)
111
+ launch_project.set_job_entry_point(new_entrypoint)
109
112
 
110
113
  def _configure_launch_project_repo(self, launch_project):
111
114
  git_info = self._job_info.get("source", {}).get("git", {})
@@ -122,7 +125,12 @@ class Job:
122
125
  if self._notebook_job:
123
126
  self._configure_launch_project_notebook(launch_project)
124
127
  else:
125
- launch_project.set_entry_point(self._entrypoint)
128
+ launch_project.set_job_entry_point(self._entrypoint)
129
+
130
+ if self._dockerfile:
131
+ launch_project.set_job_dockerfile(self._dockerfile)
132
+ if self._build_context:
133
+ launch_project.set_job_build_context(self._build_context)
126
134
 
127
135
  def _configure_launch_project_artifact(self, launch_project):
128
136
  artifact_string = self._job_info.get("source", {}).get("artifact")
@@ -138,7 +146,12 @@ class Job:
138
146
  if self._notebook_job:
139
147
  self._configure_launch_project_notebook(launch_project)
140
148
  else:
141
- launch_project.set_entry_point(self._entrypoint)
149
+ launch_project.set_job_entry_point(self._entrypoint)
150
+
151
+ if self._dockerfile:
152
+ launch_project.set_job_dockerfile(self._dockerfile)
153
+ if self._build_context:
154
+ launch_project.set_job_build_context(self._build_context)
142
155
 
143
156
  def _configure_launch_project_container(self, launch_project):
144
157
  launch_project.docker_image = self._job_info.get("source", {}).get("image")
@@ -147,7 +160,7 @@ class Job:
147
160
  "Job had malformed source dictionary without an image key"
148
161
  )
149
162
  if self._entrypoint:
150
- launch_project.set_entry_point(self._entrypoint)
163
+ launch_project.set_job_entry_point(self._entrypoint)
151
164
 
152
165
  def set_entrypoint(self, entrypoint: List[str]):
153
166
  self._entrypoint = entrypoint
@@ -1,4 +1,5 @@
1
1
  """Public API: projects."""
2
+
2
3
  from wandb_gql import gql
3
4
 
4
5
  from wandb.apis import public
@@ -1,4 +1,5 @@
1
1
  """Public API: reports."""
2
+
2
3
  import ast
3
4
  import json
4
5
  import sys
wandb/apis/public/runs.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Public API: runs."""
2
+
2
3
  import json
3
4
  import os
4
5
  import tempfile
@@ -706,27 +707,24 @@ class Run(Attrs):
706
707
  )
707
708
  api.set_current_run_id(self.id)
708
709
 
709
- if isinstance(artifact, wandb.Artifact) and not artifact.is_draft():
710
- if (
711
- self.entity != artifact.source_entity
712
- or self.project != artifact.source_project
713
- ):
714
- raise ValueError("A run can't log an artifact to a different project.")
715
- artifact_collection_name = artifact.source_name.split(":")[0]
716
- api.create_artifact(
717
- artifact.type,
718
- artifact_collection_name,
719
- artifact.digest,
720
- aliases=aliases,
721
- )
722
- return artifact
723
- elif isinstance(artifact, wandb.Artifact) and artifact.is_draft():
710
+ if not isinstance(artifact, wandb.Artifact):
711
+ raise ValueError("You must pass a wandb.Api().artifact() to use_artifact")
712
+ if artifact.is_draft():
724
713
  raise ValueError(
725
714
  "Only existing artifacts are accepted by this api. "
726
715
  "Manually create one with `wandb artifact put`"
727
716
  )
728
- else:
729
- raise ValueError("You must pass a wandb.Api().artifact() to use_artifact")
717
+ if (
718
+ self.entity != artifact.source_entity
719
+ or self.project != artifact.source_project
720
+ ):
721
+ raise ValueError("A run can't log an artifact to a different project.")
722
+
723
+ artifact_collection_name = artifact.source_name.split(":")[0]
724
+ api.create_artifact(
725
+ artifact.type, artifact_collection_name, artifact.digest, aliases=aliases
726
+ )
727
+ return artifact
730
728
 
731
729
  @property
732
730
  def summary(self):
@@ -1,4 +1,5 @@
1
1
  """Public API: sweeps."""
2
+
2
3
  import urllib
3
4
  from typing import Optional
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Public API: teams."""
2
+
2
3
  import requests
3
4
  from wandb_gql import gql
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Public API: users."""
2
+
2
3
  import requests
3
4
  from wandb_gql import gql
4
5