wandb 0.15.3__py3-none-any.whl → 0.15.5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +1 -1
- wandb/analytics/sentry.py +1 -0
- wandb/apis/importers/base.py +20 -5
- wandb/apis/importers/mlflow.py +7 -1
- wandb/apis/internal.py +12 -0
- wandb/apis/public.py +247 -1387
- wandb/apis/reports/_panels.py +58 -35
- wandb/beta/workflows.py +6 -7
- wandb/cli/cli.py +130 -60
- wandb/data_types.py +3 -1
- wandb/filesync/dir_watcher.py +21 -27
- wandb/filesync/step_checksum.py +8 -8
- wandb/filesync/step_prepare.py +23 -10
- wandb/filesync/step_upload.py +13 -13
- wandb/filesync/upload_job.py +4 -8
- wandb/integration/cohere/__init__.py +3 -0
- wandb/integration/cohere/cohere.py +21 -0
- wandb/integration/cohere/resolver.py +347 -0
- wandb/integration/gym/__init__.py +4 -6
- wandb/integration/huggingface/__init__.py +3 -0
- wandb/integration/huggingface/huggingface.py +18 -0
- wandb/integration/huggingface/resolver.py +213 -0
- wandb/integration/langchain/wandb_tracer.py +16 -179
- wandb/integration/openai/__init__.py +1 -3
- wandb/integration/openai/openai.py +11 -143
- wandb/integration/openai/resolver.py +111 -38
- wandb/integration/sagemaker/config.py +2 -2
- wandb/integration/tensorboard/log.py +4 -4
- wandb/old/settings.py +24 -7
- wandb/proto/v3/wandb_telemetry_pb2.py +12 -12
- wandb/proto/v4/wandb_telemetry_pb2.py +12 -12
- wandb/proto/wandb_deprecated.py +3 -1
- wandb/sdk/__init__.py +1 -1
- wandb/sdk/artifacts/__init__.py +0 -0
- wandb/sdk/artifacts/artifact.py +2101 -0
- wandb/sdk/artifacts/artifact_download_logger.py +42 -0
- wandb/sdk/artifacts/artifact_manifest.py +67 -0
- wandb/sdk/artifacts/artifact_manifest_entry.py +159 -0
- wandb/sdk/artifacts/artifact_manifests/__init__.py +0 -0
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +91 -0
- wandb/sdk/{internal → artifacts}/artifact_saver.py +6 -5
- wandb/sdk/artifacts/artifact_state.py +10 -0
- wandb/sdk/{interface/artifacts/artifact_cache.py → artifacts/artifacts_cache.py} +22 -12
- wandb/sdk/artifacts/exceptions.py +55 -0
- wandb/sdk/artifacts/storage_handler.py +59 -0
- wandb/sdk/artifacts/storage_handlers/__init__.py +0 -0
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +192 -0
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +224 -0
- wandb/sdk/artifacts/storage_handlers/http_handler.py +112 -0
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +134 -0
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +53 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +301 -0
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +67 -0
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +132 -0
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +72 -0
- wandb/sdk/artifacts/storage_layout.py +6 -0
- wandb/sdk/artifacts/storage_policies/__init__.py +0 -0
- wandb/sdk/artifacts/storage_policies/s3_bucket_policy.py +61 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +386 -0
- wandb/sdk/{interface/artifacts/artifact_storage.py → artifacts/storage_policy.py} +5 -57
- wandb/sdk/data_types/_dtypes.py +7 -12
- wandb/sdk/data_types/base_types/json_metadata.py +3 -2
- wandb/sdk/data_types/base_types/media.py +8 -8
- wandb/sdk/data_types/base_types/wb_value.py +12 -13
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +5 -6
- wandb/sdk/data_types/helper_types/classes.py +6 -8
- wandb/sdk/data_types/helper_types/image_mask.py +5 -6
- wandb/sdk/data_types/histogram.py +4 -3
- wandb/sdk/data_types/html.py +3 -4
- wandb/sdk/data_types/image.py +11 -9
- wandb/sdk/data_types/molecule.py +5 -3
- wandb/sdk/data_types/object_3d.py +7 -5
- wandb/sdk/data_types/plotly.py +3 -2
- wandb/sdk/data_types/saved_model.py +11 -11
- wandb/sdk/data_types/trace_tree.py +5 -4
- wandb/sdk/data_types/utils.py +3 -5
- wandb/sdk/data_types/video.py +5 -4
- wandb/sdk/integration_utils/auto_logging.py +215 -0
- wandb/sdk/interface/interface.py +15 -15
- wandb/sdk/internal/file_pusher.py +8 -16
- wandb/sdk/internal/file_stream.py +5 -11
- wandb/sdk/internal/handler.py +13 -1
- wandb/sdk/internal/internal_api.py +287 -13
- wandb/sdk/internal/job_builder.py +119 -30
- wandb/sdk/internal/sender.py +6 -26
- wandb/sdk/internal/settings_static.py +2 -0
- wandb/sdk/internal/system/assets/__init__.py +2 -0
- wandb/sdk/internal/system/assets/gpu.py +42 -0
- wandb/sdk/internal/system/assets/gpu_amd.py +216 -0
- wandb/sdk/internal/system/env_probe_helpers.py +13 -0
- wandb/sdk/internal/system/system_info.py +3 -3
- wandb/sdk/internal/tb_watcher.py +32 -22
- wandb/sdk/internal/thread_local_settings.py +18 -0
- wandb/sdk/launch/_project_spec.py +57 -11
- wandb/sdk/launch/agent/agent.py +147 -65
- wandb/sdk/launch/agent/job_status_tracker.py +34 -0
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +45 -0
- wandb/sdk/launch/builder/abstract.py +5 -1
- wandb/sdk/launch/builder/build.py +21 -18
- wandb/sdk/launch/builder/docker_builder.py +10 -4
- wandb/sdk/launch/builder/kaniko_builder.py +113 -23
- wandb/sdk/launch/builder/noop.py +6 -3
- wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +46 -14
- wandb/sdk/launch/environment/aws_environment.py +3 -2
- wandb/sdk/launch/environment/azure_environment.py +124 -0
- wandb/sdk/launch/environment/gcp_environment.py +2 -4
- wandb/sdk/launch/environment/local_environment.py +1 -1
- wandb/sdk/launch/errors.py +19 -0
- wandb/sdk/launch/github_reference.py +32 -19
- wandb/sdk/launch/launch.py +3 -8
- wandb/sdk/launch/launch_add.py +6 -2
- wandb/sdk/launch/loader.py +21 -2
- wandb/sdk/launch/registry/azure_container_registry.py +132 -0
- wandb/sdk/launch/registry/elastic_container_registry.py +39 -5
- wandb/sdk/launch/registry/google_artifact_registry.py +68 -26
- wandb/sdk/launch/registry/local_registry.py +2 -1
- wandb/sdk/launch/runner/abstract.py +24 -3
- wandb/sdk/launch/runner/kubernetes_runner.py +479 -26
- wandb/sdk/launch/runner/local_container.py +103 -51
- wandb/sdk/launch/runner/local_process.py +1 -1
- wandb/sdk/launch/runner/sagemaker_runner.py +60 -10
- wandb/sdk/launch/runner/vertex_runner.py +10 -5
- wandb/sdk/launch/sweeps/__init__.py +7 -9
- wandb/sdk/launch/sweeps/scheduler.py +307 -77
- wandb/sdk/launch/sweeps/scheduler_sweep.py +2 -1
- wandb/sdk/launch/sweeps/utils.py +82 -35
- wandb/sdk/launch/utils.py +89 -75
- wandb/sdk/lib/_settings_toposort_generated.py +7 -0
- wandb/sdk/lib/capped_dict.py +26 -0
- wandb/sdk/lib/{git.py → gitlib.py} +76 -59
- wandb/sdk/lib/hashutil.py +12 -4
- wandb/sdk/lib/paths.py +96 -8
- wandb/sdk/lib/sock_client.py +2 -2
- wandb/sdk/lib/timer.py +1 -0
- wandb/sdk/service/server.py +22 -9
- wandb/sdk/service/server_sock.py +1 -1
- wandb/sdk/service/service.py +27 -8
- wandb/sdk/verify/verify.py +4 -7
- wandb/sdk/wandb_config.py +2 -6
- wandb/sdk/wandb_init.py +57 -53
- wandb/sdk/wandb_require.py +7 -0
- wandb/sdk/wandb_run.py +61 -223
- wandb/sdk/wandb_settings.py +28 -4
- wandb/testing/relay.py +15 -2
- wandb/util.py +74 -36
- {wandb-0.15.3.dist-info → wandb-0.15.5.dist-info}/METADATA +15 -9
- {wandb-0.15.3.dist-info → wandb-0.15.5.dist-info}/RECORD +151 -116
- {wandb-0.15.3.dist-info → wandb-0.15.5.dist-info}/entry_points.txt +1 -0
- wandb/integration/langchain/util.py +0 -191
- wandb/sdk/interface/artifacts/__init__.py +0 -33
- wandb/sdk/interface/artifacts/artifact.py +0 -615
- wandb/sdk/interface/artifacts/artifact_manifest.py +0 -131
- wandb/sdk/wandb_artifacts.py +0 -2226
- {wandb-0.15.3.dist-info → wandb-0.15.5.dist-info}/LICENSE +0 -0
- {wandb-0.15.3.dist-info → wandb-0.15.5.dist-info}/WHEEL +0 -0
- {wandb-0.15.3.dist-info → wandb-0.15.5.dist-info}/top_level.txt +0 -0
@@ -1,615 +0,0 @@
|
|
1
|
-
from typing import IO, TYPE_CHECKING, ContextManager, List, Optional, Sequence, Union
|
2
|
-
|
3
|
-
import wandb
|
4
|
-
from wandb.data_types import WBValue
|
5
|
-
from wandb.sdk.lib.paths import FilePathStr
|
6
|
-
|
7
|
-
if TYPE_CHECKING:
|
8
|
-
import wandb.apis.public
|
9
|
-
from wandb.sdk.interface.artifacts import ArtifactManifest, ArtifactManifestEntry
|
10
|
-
|
11
|
-
|
12
|
-
class ArtifactStatusError(AttributeError):
|
13
|
-
"""Raised when an artifact is in an invalid state for the requested operation."""
|
14
|
-
|
15
|
-
def __init__(
|
16
|
-
self,
|
17
|
-
artifact: Optional["Artifact"] = None,
|
18
|
-
attr: Optional[str] = None,
|
19
|
-
msg: str = "Artifact is in an invalid state for the requested operation.",
|
20
|
-
):
|
21
|
-
object_name = artifact.__class__.__name__ if artifact else "Artifact"
|
22
|
-
method_id = f"{object_name}.{attr}" if attr else object_name
|
23
|
-
super().__init__(msg.format(artifact=artifact, attr=attr, method_id=method_id))
|
24
|
-
# Follow the same pattern as AttributeError.
|
25
|
-
self.obj = artifact
|
26
|
-
self.name = attr or ""
|
27
|
-
|
28
|
-
|
29
|
-
class ArtifactNotLoggedError(ArtifactStatusError):
|
30
|
-
"""Raised for Artifact methods or attributes only available after logging."""
|
31
|
-
|
32
|
-
def __init__(
|
33
|
-
self, artifact: Optional["Artifact"] = None, attr: Optional[str] = None
|
34
|
-
):
|
35
|
-
super().__init__(
|
36
|
-
artifact,
|
37
|
-
attr,
|
38
|
-
"'{method_id}' used prior to logging artifact or while in offline mode. "
|
39
|
-
"Call wait() before accessing logged artifact properties.",
|
40
|
-
)
|
41
|
-
|
42
|
-
|
43
|
-
class ArtifactFinalizedError(ArtifactStatusError):
|
44
|
-
"""Raised for Artifact methods or attributes that can't be changed after logging."""
|
45
|
-
|
46
|
-
def __init__(
|
47
|
-
self, artifact: Optional["Artifact"] = None, attr: Optional[str] = None
|
48
|
-
):
|
49
|
-
super().__init__(
|
50
|
-
artifact,
|
51
|
-
attr,
|
52
|
-
"'{method_id}' used on logged artifact. Can't add to finalized artifact.",
|
53
|
-
)
|
54
|
-
|
55
|
-
|
56
|
-
class Artifact:
|
57
|
-
@property
|
58
|
-
def id(self) -> Optional[str]:
|
59
|
-
"""The artifact's ID."""
|
60
|
-
raise NotImplementedError
|
61
|
-
|
62
|
-
@property
|
63
|
-
def version(self) -> str:
|
64
|
-
"""The version of this artifact.
|
65
|
-
|
66
|
-
For example, if this is the first version of an artifact, its `version` will be
|
67
|
-
'v0'.
|
68
|
-
"""
|
69
|
-
raise NotImplementedError
|
70
|
-
|
71
|
-
@property
|
72
|
-
def source_version(self) -> Optional[str]:
|
73
|
-
"""The artifact's version index under its parent artifact collection.
|
74
|
-
|
75
|
-
A string with the format "v{number}".
|
76
|
-
"""
|
77
|
-
raise NotImplementedError
|
78
|
-
|
79
|
-
@property
|
80
|
-
def name(self) -> str:
|
81
|
-
"""The artifact's name."""
|
82
|
-
raise NotImplementedError
|
83
|
-
|
84
|
-
@property
|
85
|
-
def full_name(self) -> str:
|
86
|
-
"""The artifact's full name."""
|
87
|
-
return f"{self.entity}/{self.project}/{self.name}"
|
88
|
-
|
89
|
-
@property
|
90
|
-
def type(self) -> str:
|
91
|
-
"""The artifact's type."""
|
92
|
-
raise NotImplementedError
|
93
|
-
|
94
|
-
@property
|
95
|
-
def entity(self) -> str:
|
96
|
-
"""The name of the entity this artifact belongs to."""
|
97
|
-
raise NotImplementedError
|
98
|
-
|
99
|
-
@property
|
100
|
-
def project(self) -> str:
|
101
|
-
"""The name of the project this artifact belongs to."""
|
102
|
-
raise NotImplementedError
|
103
|
-
|
104
|
-
@property
|
105
|
-
def manifest(self) -> "ArtifactManifest":
|
106
|
-
"""The artifact's manifest.
|
107
|
-
|
108
|
-
The manifest lists all of its contents, and can't be changed once the artifact
|
109
|
-
has been logged.
|
110
|
-
"""
|
111
|
-
raise NotImplementedError
|
112
|
-
|
113
|
-
@property
|
114
|
-
def digest(self) -> str:
|
115
|
-
"""The logical digest of the artifact.
|
116
|
-
|
117
|
-
The digest is the checksum of the artifact's contents. If an artifact has the
|
118
|
-
same digest as the current `latest` version, then `log_artifact` is a no-op.
|
119
|
-
"""
|
120
|
-
raise NotImplementedError
|
121
|
-
|
122
|
-
@property
|
123
|
-
def state(self) -> str:
|
124
|
-
"""The status of the artifact. One of: "PENDING", "COMMITTED", or "DELETED"."""
|
125
|
-
raise NotImplementedError
|
126
|
-
|
127
|
-
@property
|
128
|
-
def size(self) -> int:
|
129
|
-
"""The total size of the artifact in bytes.
|
130
|
-
|
131
|
-
Returns:
|
132
|
-
(int): The size in bytes of the artifact. Includes any references tracked by
|
133
|
-
this artifact.
|
134
|
-
"""
|
135
|
-
raise NotImplementedError
|
136
|
-
|
137
|
-
@property
|
138
|
-
def commit_hash(self) -> str:
|
139
|
-
"""The hash returned when this artifact was committed.
|
140
|
-
|
141
|
-
Returns:
|
142
|
-
(str): The artifact's commit hash which is used in http URLs.
|
143
|
-
"""
|
144
|
-
raise NotImplementedError
|
145
|
-
|
146
|
-
@property
|
147
|
-
def description(self) -> Optional[str]:
|
148
|
-
"""The artifact description.
|
149
|
-
|
150
|
-
Returns:
|
151
|
-
(str): Free text that offers a user-set description of the artifact.
|
152
|
-
"""
|
153
|
-
raise NotImplementedError
|
154
|
-
|
155
|
-
@description.setter
|
156
|
-
def description(self, desc: Optional[str]) -> None:
|
157
|
-
"""Set the description of the artifact.
|
158
|
-
|
159
|
-
The description is markdown rendered in the UI, so this is a good place to put
|
160
|
-
links, etc.
|
161
|
-
|
162
|
-
Arguments:
|
163
|
-
desc: Free text that offers a description of the artifact.
|
164
|
-
"""
|
165
|
-
raise NotImplementedError
|
166
|
-
|
167
|
-
@property
|
168
|
-
def metadata(self) -> dict:
|
169
|
-
"""User-defined artifact metadata.
|
170
|
-
|
171
|
-
Returns:
|
172
|
-
(dict): Structured data associated with the artifact.
|
173
|
-
"""
|
174
|
-
raise NotImplementedError
|
175
|
-
|
176
|
-
@metadata.setter
|
177
|
-
def metadata(self, metadata: dict) -> None:
|
178
|
-
"""User-defined artifact metadata.
|
179
|
-
|
180
|
-
Metadata set this way will eventually be queryable and plottable in the UI; e.g.
|
181
|
-
the class distribution of a dataset.
|
182
|
-
|
183
|
-
Note: There is currently a limit of 100 total keys.
|
184
|
-
|
185
|
-
Arguments:
|
186
|
-
metadata: (dict) Structured data associated with the artifact.
|
187
|
-
"""
|
188
|
-
raise NotImplementedError
|
189
|
-
|
190
|
-
@property
|
191
|
-
def aliases(self) -> List[str]:
|
192
|
-
"""The aliases associated with this artifact.
|
193
|
-
|
194
|
-
The list is mutable and calling `save()` will persist all alias changes.
|
195
|
-
"""
|
196
|
-
raise NotImplementedError
|
197
|
-
|
198
|
-
@aliases.setter
|
199
|
-
def aliases(self, aliases: List[str]) -> None:
|
200
|
-
"""Set the aliases associated with this artifact."""
|
201
|
-
raise NotImplementedError
|
202
|
-
|
203
|
-
def used_by(self) -> List["wandb.apis.public.Run"]:
|
204
|
-
"""Get a list of the runs that have used this artifact."""
|
205
|
-
raise NotImplementedError
|
206
|
-
|
207
|
-
def logged_by(self) -> "wandb.apis.public.Run":
|
208
|
-
"""Get the run that first logged this artifact."""
|
209
|
-
raise NotImplementedError
|
210
|
-
|
211
|
-
def new_file(
|
212
|
-
self, name: str, mode: str = "w", encoding: Optional[str] = None
|
213
|
-
) -> ContextManager[IO]:
|
214
|
-
"""Open a new temporary file that will be automatically added to the artifact.
|
215
|
-
|
216
|
-
Arguments:
|
217
|
-
name: (str) The name of the new file being added to the artifact.
|
218
|
-
mode: (str, optional) The mode in which to open the new file.
|
219
|
-
encoding: (str, optional) The encoding in which to open the new file.
|
220
|
-
|
221
|
-
Examples:
|
222
|
-
```
|
223
|
-
artifact = wandb.Artifact('my_data', type='dataset')
|
224
|
-
with artifact.new_file('hello.txt') as f:
|
225
|
-
f.write('hello!')
|
226
|
-
wandb.log_artifact(artifact)
|
227
|
-
```
|
228
|
-
|
229
|
-
Returns:
|
230
|
-
(file): A new file object that can be written to. Upon closing,
|
231
|
-
the file will be automatically added to the artifact.
|
232
|
-
|
233
|
-
Raises:
|
234
|
-
ArtifactFinalizedError: if the artifact has already been finalized.
|
235
|
-
"""
|
236
|
-
raise NotImplementedError
|
237
|
-
|
238
|
-
def add_file(
|
239
|
-
self,
|
240
|
-
local_path: str,
|
241
|
-
name: Optional[str] = None,
|
242
|
-
is_tmp: Optional[bool] = False,
|
243
|
-
) -> "ArtifactManifestEntry":
|
244
|
-
"""Add a local file to the artifact.
|
245
|
-
|
246
|
-
Arguments:
|
247
|
-
local_path: (str) The path to the file being added.
|
248
|
-
name: (str, optional) The path within the artifact to use for the file being
|
249
|
-
added. Defaults to the basename of the file.
|
250
|
-
is_tmp: (bool, optional) If true, then the file is renamed deterministically
|
251
|
-
to avoid collisions. (default: False)
|
252
|
-
|
253
|
-
Examples:
|
254
|
-
Add a file without an explicit name:
|
255
|
-
```
|
256
|
-
# Add as `file.txt'
|
257
|
-
artifact.add_file('path/to/file.txt')
|
258
|
-
```
|
259
|
-
|
260
|
-
Add a file with an explicit name:
|
261
|
-
```
|
262
|
-
# Add as 'new/path/file.txt'
|
263
|
-
artifact.add_file('path/to/file.txt', name='new/path/file.txt')
|
264
|
-
```
|
265
|
-
|
266
|
-
Raises:
|
267
|
-
ArtifactFinalizedError: if the artifact has already been finalized.
|
268
|
-
|
269
|
-
Returns:
|
270
|
-
ArtifactManifestEntry: the added manifest entry
|
271
|
-
|
272
|
-
"""
|
273
|
-
raise NotImplementedError
|
274
|
-
|
275
|
-
def add_dir(self, local_path: str, name: Optional[str] = None) -> None:
|
276
|
-
"""Add a local directory to the artifact.
|
277
|
-
|
278
|
-
Arguments:
|
279
|
-
local_path: (str) The path to the directory being added.
|
280
|
-
name: (str, optional) The path within the artifact to use for the directory
|
281
|
-
being added. Defaults to the root of the artifact.
|
282
|
-
|
283
|
-
Examples:
|
284
|
-
Add a directory without an explicit name:
|
285
|
-
```
|
286
|
-
# All files in `my_dir/` are added at the root of the artifact.
|
287
|
-
artifact.add_dir('my_dir/')
|
288
|
-
```
|
289
|
-
|
290
|
-
Add a directory and name it explicitly:
|
291
|
-
```
|
292
|
-
# All files in `my_dir/` are added under `destination/`.
|
293
|
-
artifact.add_dir('my_dir/', name='destination')
|
294
|
-
```
|
295
|
-
|
296
|
-
Raises:
|
297
|
-
ArtifactFinalizedError: if the artifact has already been finalized.
|
298
|
-
|
299
|
-
Returns:
|
300
|
-
None
|
301
|
-
"""
|
302
|
-
raise NotImplementedError
|
303
|
-
|
304
|
-
def add_reference(
|
305
|
-
self,
|
306
|
-
uri: Union["ArtifactManifestEntry", str],
|
307
|
-
name: Optional[str] = None,
|
308
|
-
checksum: bool = True,
|
309
|
-
max_objects: Optional[int] = None,
|
310
|
-
) -> Sequence["ArtifactManifestEntry"]:
|
311
|
-
"""Add a reference denoted by a URI to the artifact.
|
312
|
-
|
313
|
-
Unlike adding files or directories, references are NOT uploaded to W&B. However,
|
314
|
-
artifact methods such as `download()` can be used regardless of whether the
|
315
|
-
artifact contains references or uploaded files.
|
316
|
-
|
317
|
-
By default, W&B offers special handling for the following schemes:
|
318
|
-
|
319
|
-
- http(s): The size and digest of the file will be inferred by the
|
320
|
-
`Content-Length` and the `ETag` response headers returned by the server.
|
321
|
-
- s3: The checksum and size will be pulled from the object metadata. If bucket
|
322
|
-
versioning is enabled, then the version ID is also tracked.
|
323
|
-
- gs: The checksum and size will be pulled from the object metadata. If bucket
|
324
|
-
versioning is enabled, then the version ID is also tracked.
|
325
|
-
- https, domain matching *.blob.core.windows.net (Azure): The checksum and size
|
326
|
-
will be pulled from the blob metadata. If storage account versioning is
|
327
|
-
enabled, then the version ID is also tracked.
|
328
|
-
- file: The checksum and size will be pulled from the file system. This scheme
|
329
|
-
is useful if you have an NFS share or other externally mounted volume
|
330
|
-
containing files you wish to track but not necessarily upload.
|
331
|
-
|
332
|
-
For any other scheme, the digest is just a hash of the URI and the size is left
|
333
|
-
blank.
|
334
|
-
|
335
|
-
Arguments:
|
336
|
-
uri: (str) The URI path of the reference to add. Can be an object returned
|
337
|
-
from Artifact.get_path to store a reference to another artifact's entry.
|
338
|
-
name: (str) The path within the artifact to place the contents of this
|
339
|
-
reference
|
340
|
-
checksum: (bool, optional) Whether or not to checksum the resource(s)
|
341
|
-
located at the reference URI. Checksumming is strongly recommended as it
|
342
|
-
enables automatic integrity validation, however it can be disabled to
|
343
|
-
speed up artifact creation. (default: True)
|
344
|
-
max_objects: (int, optional) The maximum number of objects to consider when
|
345
|
-
adding a reference that points to directory or bucket store prefix. For
|
346
|
-
S3 and GCS, this limit is 10,000 by default but is uncapped for other
|
347
|
-
URI schemes. (default: None)
|
348
|
-
|
349
|
-
Raises:
|
350
|
-
ArtifactFinalizedError: if the artifact has already been finalized.
|
351
|
-
|
352
|
-
Returns:
|
353
|
-
List["ArtifactManifestEntry"]: The added manifest entries.
|
354
|
-
|
355
|
-
Examples:
|
356
|
-
Add an HTTP link:
|
357
|
-
```python
|
358
|
-
# Adds `file.txt` to the root of the artifact as a reference.
|
359
|
-
artifact.add_reference("http://myserver.com/file.txt")
|
360
|
-
```
|
361
|
-
|
362
|
-
Add an S3 prefix without an explicit name:
|
363
|
-
```python
|
364
|
-
# All objects under `prefix/` will be added at the root of the artifact.
|
365
|
-
artifact.add_reference("s3://mybucket/prefix")
|
366
|
-
```
|
367
|
-
|
368
|
-
Add a GCS prefix with an explicit name:
|
369
|
-
```python
|
370
|
-
# All objects under `prefix/` will be added under `path/` at the artifact root.
|
371
|
-
artifact.add_reference("gs://mybucket/prefix", name="path")
|
372
|
-
```
|
373
|
-
"""
|
374
|
-
raise NotImplementedError
|
375
|
-
|
376
|
-
def add(self, obj: WBValue, name: str) -> "ArtifactManifestEntry":
|
377
|
-
"""Add wandb.WBValue `obj` to the artifact.
|
378
|
-
|
379
|
-
```
|
380
|
-
obj = artifact.get(name)
|
381
|
-
```
|
382
|
-
|
383
|
-
Arguments:
|
384
|
-
obj: (wandb.WBValue) The object to add. Currently support one of
|
385
|
-
Bokeh, JoinedTable, PartitionedTable, Table, Classes, ImageMask,
|
386
|
-
BoundingBoxes2D, Audio, Image, Video, Html, Object3D
|
387
|
-
name: (str) The path within the artifact to add the object.
|
388
|
-
|
389
|
-
Returns:
|
390
|
-
ArtifactManifestEntry: the added manifest entry
|
391
|
-
|
392
|
-
Raises:
|
393
|
-
ArtifactFinalizedError: if the artifact has already been finalized.
|
394
|
-
|
395
|
-
Examples:
|
396
|
-
Basic usage
|
397
|
-
```
|
398
|
-
artifact = wandb.Artifact('my_table', 'dataset')
|
399
|
-
table = wandb.Table(columns=["a", "b", "c"], data=[[i, i*2, 2**i]])
|
400
|
-
artifact.add(table, "my_table")
|
401
|
-
|
402
|
-
wandb.log_artifact(artifact)
|
403
|
-
```
|
404
|
-
|
405
|
-
Retrieve an object:
|
406
|
-
```
|
407
|
-
artifact = wandb.use_artifact('my_table:latest')
|
408
|
-
table = artifact.get("my_table")
|
409
|
-
```
|
410
|
-
"""
|
411
|
-
raise NotImplementedError
|
412
|
-
|
413
|
-
def get_path(self, name: str) -> "ArtifactManifestEntry":
|
414
|
-
"""Get the path to the file located at the artifact relative `name`.
|
415
|
-
|
416
|
-
Arguments:
|
417
|
-
name: (str) The artifact relative name to get
|
418
|
-
|
419
|
-
Raises:
|
420
|
-
ArtifactNotLoggedError: if the artifact isn't logged or the run is offline
|
421
|
-
|
422
|
-
Examples:
|
423
|
-
Basic usage
|
424
|
-
```
|
425
|
-
# Run logging the artifact
|
426
|
-
with wandb.init() as r:
|
427
|
-
artifact = wandb.Artifact('my_dataset', type='dataset')
|
428
|
-
artifact.add_file('path/to/file.txt')
|
429
|
-
wandb.log_artifact(artifact)
|
430
|
-
|
431
|
-
# Run using the artifact
|
432
|
-
with wandb.init() as r:
|
433
|
-
artifact = r.use_artifact('my_dataset:latest')
|
434
|
-
path = artifact.get_path('file.txt')
|
435
|
-
|
436
|
-
# Can now download 'file.txt' directly:
|
437
|
-
path.download()
|
438
|
-
```
|
439
|
-
"""
|
440
|
-
raise NotImplementedError
|
441
|
-
|
442
|
-
def get(self, name: str) -> WBValue:
|
443
|
-
"""Get the WBValue object located at the artifact relative `name`.
|
444
|
-
|
445
|
-
Arguments:
|
446
|
-
name: (str) The artifact relative name to get
|
447
|
-
|
448
|
-
Raises:
|
449
|
-
ArtifactNotLoggedError: if the artifact isn't logged or the run is offline
|
450
|
-
|
451
|
-
Examples:
|
452
|
-
Basic usage
|
453
|
-
```
|
454
|
-
# Run logging the artifact
|
455
|
-
with wandb.init() as r:
|
456
|
-
artifact = wandb.Artifact('my_dataset', type='dataset')
|
457
|
-
table = wandb.Table(columns=["a", "b", "c"], data=[[i, i*2, 2**i]])
|
458
|
-
artifact.add(table, "my_table")
|
459
|
-
wandb.log_artifact(artifact)
|
460
|
-
|
461
|
-
# Run using the artifact
|
462
|
-
with wandb.init() as r:
|
463
|
-
artifact = r.use_artifact('my_dataset:latest')
|
464
|
-
table = r.get('my_table')
|
465
|
-
```
|
466
|
-
"""
|
467
|
-
raise NotImplementedError
|
468
|
-
|
469
|
-
def download(
|
470
|
-
self, root: Optional[str] = None, recursive: bool = False
|
471
|
-
) -> FilePathStr:
|
472
|
-
"""Download the contents of the artifact to the specified root directory.
|
473
|
-
|
474
|
-
NOTE: Any existing files at `root` are left untouched. Explicitly delete
|
475
|
-
root before calling `download` if you want the contents of `root` to exactly
|
476
|
-
match the artifact.
|
477
|
-
|
478
|
-
Arguments:
|
479
|
-
root: (str, optional) The directory in which to download this artifact's files.
|
480
|
-
recursive: (bool, optional) If true, then all dependent artifacts are eagerly
|
481
|
-
downloaded. Otherwise, the dependent artifacts are downloaded as needed.
|
482
|
-
|
483
|
-
Returns:
|
484
|
-
(str): The path to the downloaded contents.
|
485
|
-
"""
|
486
|
-
raise NotImplementedError
|
487
|
-
|
488
|
-
def checkout(self, root: Optional[str] = None) -> str:
|
489
|
-
"""Replace the specified root directory with the contents of the artifact.
|
490
|
-
|
491
|
-
WARNING: This will DELETE all files in `root` that are not included in the
|
492
|
-
artifact.
|
493
|
-
|
494
|
-
Arguments:
|
495
|
-
root: (str, optional) The directory to replace with this artifact's files.
|
496
|
-
|
497
|
-
Returns:
|
498
|
-
(str): The path to the checked out contents.
|
499
|
-
"""
|
500
|
-
raise NotImplementedError
|
501
|
-
|
502
|
-
def verify(self, root: Optional[str] = None) -> bool:
|
503
|
-
"""Verify that the actual contents of an artifact match the manifest.
|
504
|
-
|
505
|
-
All files in the directory are checksummed and the checksums are then
|
506
|
-
cross-referenced against the artifact's manifest.
|
507
|
-
|
508
|
-
NOTE: References are not verified.
|
509
|
-
|
510
|
-
Arguments:
|
511
|
-
root: (str, optional) The directory to verify. If None
|
512
|
-
artifact will be downloaded to './artifacts/self.name/'
|
513
|
-
|
514
|
-
Raises:
|
515
|
-
(ValueError): If the verification fails.
|
516
|
-
"""
|
517
|
-
raise NotImplementedError
|
518
|
-
|
519
|
-
def save(self) -> None:
|
520
|
-
"""Persist any changes made to the artifact.
|
521
|
-
|
522
|
-
Returns:
|
523
|
-
None
|
524
|
-
"""
|
525
|
-
raise NotImplementedError
|
526
|
-
|
527
|
-
def link(self, target_path: str, aliases: Optional[List[str]] = None) -> None:
|
528
|
-
"""Link this artifact to a portfolio (a promoted collection of artifacts), with aliases.
|
529
|
-
|
530
|
-
Arguments:
|
531
|
-
target_path: (str) The path to the portfolio. It must take the form
|
532
|
-
{portfolio}, {project}/{portfolio} or {entity}/{project}/{portfolio}.
|
533
|
-
aliases: (Optional[List[str]]) A list of strings which uniquely
|
534
|
-
identifies the artifact inside the specified portfolio.
|
535
|
-
|
536
|
-
Returns:
|
537
|
-
None
|
538
|
-
"""
|
539
|
-
raise NotImplementedError
|
540
|
-
|
541
|
-
def delete(self) -> None:
|
542
|
-
"""Delete this artifact, cleaning up all files associated with it.
|
543
|
-
|
544
|
-
NOTE: Deletion is permanent and CANNOT be undone.
|
545
|
-
|
546
|
-
Returns:
|
547
|
-
None
|
548
|
-
"""
|
549
|
-
raise NotImplementedError
|
550
|
-
|
551
|
-
def wait(self) -> "Artifact":
|
552
|
-
"""Wait for this artifact to finish logging, if needed.
|
553
|
-
|
554
|
-
Returns:
|
555
|
-
Artifact
|
556
|
-
"""
|
557
|
-
raise NotImplementedError
|
558
|
-
|
559
|
-
def __getitem__(self, name: str) -> Optional[WBValue]:
|
560
|
-
"""Get the WBValue object located at the artifact relative `name`.
|
561
|
-
|
562
|
-
Arguments:
|
563
|
-
name: (str) The artifact relative name to get
|
564
|
-
|
565
|
-
Raises:
|
566
|
-
ArtifactNotLoggedError: if the artifact isn't logged or the run is offline
|
567
|
-
|
568
|
-
Examples:
|
569
|
-
Basic usage
|
570
|
-
```
|
571
|
-
artifact = wandb.Artifact('my_table', 'dataset')
|
572
|
-
table = wandb.Table(columns=["a", "b", "c"], data=[[i, i*2, 2**i]])
|
573
|
-
artifact["my_table"] = table
|
574
|
-
|
575
|
-
wandb.log_artifact(artifact)
|
576
|
-
```
|
577
|
-
|
578
|
-
Retrieving an object:
|
579
|
-
```
|
580
|
-
artifact = wandb.use_artifact('my_table:latest')
|
581
|
-
table = artifact["my_table"]
|
582
|
-
```
|
583
|
-
"""
|
584
|
-
return self.get(name)
|
585
|
-
|
586
|
-
def __setitem__(self, name: str, item: WBValue) -> "ArtifactManifestEntry":
|
587
|
-
"""Add `item` to the artifact at path `name`.
|
588
|
-
|
589
|
-
Arguments:
|
590
|
-
name: (str) The path within the artifact to add the object.
|
591
|
-
item: (wandb.WBValue) The object to add.
|
592
|
-
|
593
|
-
Returns:
|
594
|
-
ArtifactManifestEntry: the added manifest entry
|
595
|
-
|
596
|
-
Raises:
|
597
|
-
ArtifactFinalizedError: if the artifact has already been finalized.
|
598
|
-
|
599
|
-
Examples:
|
600
|
-
Basic usage
|
601
|
-
```
|
602
|
-
artifact = wandb.Artifact('my_table', 'dataset')
|
603
|
-
table = wandb.Table(columns=["a", "b", "c"], data=[[i, i*2, 2**i]])
|
604
|
-
artifact["my_table"] = table
|
605
|
-
|
606
|
-
wandb.log_artifact(artifact)
|
607
|
-
```
|
608
|
-
|
609
|
-
Retrieving an object:
|
610
|
-
```
|
611
|
-
artifact = wandb.use_artifact('my_table:latest')
|
612
|
-
table = artifact["my_table"]
|
613
|
-
```
|
614
|
-
"""
|
615
|
-
return self.add(item, name)
|