wandb 0.16.6__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 (193) 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 +92 -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 +3 -3
  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 +26 -11
  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 +2 -8
  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 +68 -32
  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 +4 -24
  109. wandb/sdk/launch/_launch_add.py +1 -3
  110. wandb/sdk/launch/_project_spec.py +186 -224
  111. wandb/sdk/launch/agent/agent.py +37 -13
  112. wandb/sdk/launch/agent/config.py +72 -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 +12 -25
  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 +47 -37
  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 +1 -0
  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 +4 -3
  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 +15 -140
  144. wandb/sdk/lib/_settings_toposort_generated.py +0 -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/tracelog.py +1 -1
  153. wandb/sdk/service/service.py +19 -16
  154. wandb/sdk/verify/verify.py +2 -1
  155. wandb/sdk/wandb_init.py +14 -55
  156. wandb/sdk/wandb_manager.py +2 -2
  157. wandb/sdk/wandb_require.py +5 -0
  158. wandb/sdk/wandb_run.py +114 -56
  159. wandb/sdk/wandb_settings.py +0 -48
  160. wandb/sdk/wandb_setup.py +1 -1
  161. wandb/sklearn/__init__.py +1 -0
  162. wandb/sklearn/plot/__init__.py +1 -0
  163. wandb/sklearn/plot/classifier.py +11 -12
  164. wandb/sklearn/plot/clusterer.py +2 -1
  165. wandb/sklearn/plot/regressor.py +1 -0
  166. wandb/sklearn/plot/shared.py +1 -0
  167. wandb/sklearn/utils.py +1 -0
  168. wandb/testing/relay.py +4 -4
  169. wandb/trigger.py +1 -0
  170. wandb/util.py +67 -54
  171. wandb/wandb_controller.py +2 -3
  172. wandb/wandb_torch.py +1 -2
  173. {wandb-0.16.6.dist-info → wandb-0.17.0.dist-info}/METADATA +67 -70
  174. {wandb-0.16.6.dist-info → wandb-0.17.0.dist-info}/RECORD +177 -187
  175. {wandb-0.16.6.dist-info → wandb-0.17.0.dist-info}/WHEEL +1 -2
  176. wandb/bin/apple_gpu_stats +0 -0
  177. wandb/catboost/__init__.py +0 -9
  178. wandb/fastai/__init__.py +0 -9
  179. wandb/keras/__init__.py +0 -18
  180. wandb/lightgbm/__init__.py +0 -9
  181. wandb/plots/__init__.py +0 -6
  182. wandb/plots/explain_text.py +0 -36
  183. wandb/plots/heatmap.py +0 -81
  184. wandb/plots/named_entity.py +0 -43
  185. wandb/plots/part_of_speech.py +0 -50
  186. wandb/plots/plot_definitions.py +0 -768
  187. wandb/plots/precision_recall.py +0 -121
  188. wandb/plots/roc.py +0 -103
  189. wandb/sacred/__init__.py +0 -3
  190. wandb/xgboost/__init__.py +0 -9
  191. wandb-0.16.6.dist-info/top_level.txt +0 -1
  192. {wandb-0.16.6.dist-info → wandb-0.17.0.dist-info}/entry_points.txt +0 -0
  193. {wandb-0.16.6.dist-info → wandb-0.17.0.dist-info/licenses}/LICENSE +0 -0
@@ -80,17 +80,7 @@ class RegistryConfig(BaseModel):
80
80
  @validator("uri") # type: ignore
81
81
  @classmethod
82
82
  def validate_uri(cls, uri: str) -> str:
83
- for regex in [
84
- GCP_ARTIFACT_REGISTRY_URI_REGEX,
85
- AZURE_CONTAINER_REGISTRY_URI_REGEX,
86
- ELASTIC_CONTAINER_REGISTRY_URI_REGEX,
87
- ]:
88
- if regex.match(uri):
89
- return uri
90
- raise ValueError(
91
- "Invalid uri. URI must be a repository URI for an "
92
- "ECR, ACR, or GCP Artifact Registry."
93
- )
83
+ return validate_registry_uri(uri)
94
84
 
95
85
 
96
86
  class EnvironmentConfig(BaseModel):
@@ -186,6 +176,14 @@ class BuilderConfig(BaseModel):
186
176
  """Right now there are no required fields for docker builds."""
187
177
  return values
188
178
 
179
+ @validator("destination") # type: ignore
180
+ @classmethod
181
+ def validate_destination(cls, destination: Optional[str]) -> Optional[str]:
182
+ """Validate that the destination is a valid container registry URI."""
183
+ if destination is None:
184
+ return None
185
+ return validate_registry_uri(destination)
186
+
189
187
 
190
188
  class AgentConfig(BaseModel):
191
189
  """Configuration for the Launch agent."""
@@ -194,9 +192,6 @@ class AgentConfig(BaseModel):
194
192
  default=[],
195
193
  description="The queues to use for this agent.",
196
194
  )
197
- project: Optional[str] = Field(
198
- description="The W&B project to use for this agent.",
199
- )
200
195
  entity: Optional[str] = Field(
201
196
  description="The W&B entity to use for this agent.",
202
197
  )
@@ -236,3 +231,66 @@ class AgentConfig(BaseModel):
236
231
 
237
232
  class Config:
238
233
  extra = "forbid"
234
+
235
+
236
+ def validate_registry_uri(uri: str) -> str:
237
+ """Validate that the registry URI is a valid container registry URI.
238
+
239
+ The URI should resolve to an image name in a container registry. The recognized
240
+ formats are for ECR, ACR, and GCP Artifact Registry. If the URI does not match
241
+ any of these formats, a warning is printed indicating the registry type is not
242
+ recognized and the agent can't guarantee that images can be pushed.
243
+
244
+ If the format is recognized but does not resolve to an image name, an
245
+ error is raised. For example, if the URI is an ECR URI but does not include
246
+ an image name or includes a tag as well as an image name, an error is raised.
247
+ """
248
+ tag_msg = (
249
+ "Destination for built images may not include a tag, but the URI provided "
250
+ "includes the suffix '{tag}'. Please remove the tag and try again. The agent "
251
+ "will automatically tag each image with a unique hash of the source code."
252
+ )
253
+ if uri.startswith("https://"):
254
+ uri = uri[8:]
255
+
256
+ match = GCP_ARTIFACT_REGISTRY_URI_REGEX.match(uri)
257
+ if match:
258
+ if match.group("tag"):
259
+ raise ValueError(tag_msg.format(tag=match.group("tag")))
260
+ if not match.group("image_name"):
261
+ raise ValueError(
262
+ "An image name must be specified in the URI for a GCP Artifact Registry. "
263
+ "Please provide a uri with the format "
264
+ "'https://<region>-docker.pkg.dev/<project>/<repository>/<image>'."
265
+ )
266
+ return uri
267
+
268
+ match = AZURE_CONTAINER_REGISTRY_URI_REGEX.match(uri)
269
+ if match:
270
+ if match.group("tag"):
271
+ raise ValueError(tag_msg.format(tag=match.group("tag")))
272
+ if not match.group("repository"):
273
+ raise ValueError(
274
+ "A repository name must be specified in the URI for an "
275
+ "Azure Container Registry. Please provide a uri with the format "
276
+ "'https://<registry-name>.azurecr.io/<repository>'."
277
+ )
278
+ return uri
279
+
280
+ match = ELASTIC_CONTAINER_REGISTRY_URI_REGEX.match(uri)
281
+ if match:
282
+ if match.group("tag"):
283
+ raise ValueError(tag_msg.format(tag=match.group("tag")))
284
+ if not match.group("repository"):
285
+ raise ValueError(
286
+ "A repository name must be specified in the URI for an "
287
+ "Elastic Container Registry. Please provide a uri with the format "
288
+ "'https://<account-id>.dkr.ecr.<region>.amazonaws.com/<repository>'."
289
+ )
290
+ return uri
291
+
292
+ wandb.termwarn(
293
+ f"Unable to recognize registry type in URI {uri}. You are responsible "
294
+ "for ensuring the agent can push images to this registry."
295
+ )
296
+ return uri
@@ -1,4 +1,5 @@
1
1
  """Abstract plugin class defining the interface needed to build container images for W&B Launch."""
2
+
2
3
  from abc import ABC, abstractmethod
3
4
  from typing import TYPE_CHECKING, Any, Dict, Optional
4
5
 
@@ -6,6 +7,12 @@ from wandb.sdk.launch.environment.abstract import AbstractEnvironment
6
7
  from wandb.sdk.launch.registry.abstract import AbstractRegistry
7
8
 
8
9
  from .._project_spec import EntryPoint, LaunchProject
10
+ from ..registry.anon import AnonynmousRegistry
11
+ from ..utils import (
12
+ AZURE_CONTAINER_REGISTRY_URI_REGEX,
13
+ ELASTIC_CONTAINER_REGISTRY_URI_REGEX,
14
+ GCP_ARTIFACT_REGISTRY_URI_REGEX,
15
+ )
9
16
 
10
17
  if TYPE_CHECKING:
11
18
  from wandb.sdk.launch.agent.job_status_tracker import JobAndRunStatusTracker
@@ -34,7 +41,7 @@ class AbstractBuilder(ABC):
34
41
  verify: Whether to verify the functionality of the builder.
35
42
 
36
43
  Raises:
37
- LaunchError: If the builder cannot be intialized or verified.
44
+ LaunchError: If the builder cannot be initialized or verified.
38
45
  """
39
46
  raise NotImplementedError
40
47
 
@@ -86,3 +93,64 @@ class AbstractBuilder(ABC):
86
93
  LaunchError: If the builder cannot be used to build images.
87
94
  """
88
95
  raise NotImplementedError
96
+
97
+
98
+ def registry_from_uri(uri: str) -> AbstractRegistry:
99
+ """Create a registry helper object from a uri.
100
+
101
+ This function parses the URI and determines which supported registry it
102
+ belongs to. It then creates a registry helper object for that registry.
103
+ The supported remote registry types are:
104
+ - Azure Container Registry
105
+ - Google Container Registry
106
+ - AWS Elastic Container Registry
107
+
108
+ The format of the URI is as follows:
109
+ - Azure Container Registry: <registry-name>.azurecr.io/<repo-name>/<image-name>
110
+ - Google Container Registry: <location>-docker.pkg.dev/<project-id>/<repo-name>/<image-name>
111
+ - AWS Elastic Container Registry: <account-id>.dkr.ecr.<region>.amazonaws.com/<repo-name>/<image-name>
112
+
113
+ Our classification of the registry is based on the domain name. For example,
114
+ if the uri contains `.azurecr.io`, we classify it as an Azure
115
+ Container Registry. If the uri contains `.dkr.ecr`, we classify
116
+ it as an AWS Elastic Container Registry. If the uri contains
117
+ `-docker.pkg.dev`, we classify it as a Google Artifact Registry.
118
+
119
+ This function will attempt to load the approriate cloud helpers for the
120
+
121
+ `https://` prefix is optional for all of the above.
122
+
123
+ Arguments:
124
+ uri: The uri to create a registry from.
125
+
126
+ Returns:
127
+ The registry.
128
+
129
+ Raises:
130
+ LaunchError: If the registry helper cannot be loaded for the given URI.
131
+ """
132
+ if uri.startswith("https://"):
133
+ uri = uri[len("https://") :]
134
+
135
+ if AZURE_CONTAINER_REGISTRY_URI_REGEX.match(uri) is not None:
136
+ from wandb.sdk.launch.registry.azure_container_registry import (
137
+ AzureContainerRegistry,
138
+ )
139
+
140
+ return AzureContainerRegistry(uri=uri)
141
+
142
+ elif GCP_ARTIFACT_REGISTRY_URI_REGEX.match(uri) is not None:
143
+ from wandb.sdk.launch.registry.google_artifact_registry import (
144
+ GoogleArtifactRegistry,
145
+ )
146
+
147
+ return GoogleArtifactRegistry(uri=uri)
148
+
149
+ elif ELASTIC_CONTAINER_REGISTRY_URI_REGEX.match(uri) is not None:
150
+ from wandb.sdk.launch.registry.elastic_container_registry import (
151
+ ElasticContainerRegistry,
152
+ )
153
+
154
+ return ElasticContainerRegistry(uri=uri)
155
+
156
+ return AnonynmousRegistry(uri=uri)