Skip to content

Commit 7a217ab

Browse files
authored
Artifacts: When to use save() vs .log() (#1557)
Description ----------- Adds quick blurb on "best practice"/recommendation by Eng on when to use which. Related issues ----------- - Fixes https://wandb.atlassian.net/jira/software/projects/DOCS/boards/28?selectedIssue=DOCS-1087
1 parent dd415c8 commit 7a217ab

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

content/en/guides/core/artifacts/construct-an-artifact.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ run = wandb.init(project="artifacts-example", job_type="job-type")
6969
run.log_artifact(artifact)
7070
```
7171

72-
You can optionally construct an artifact outside of a W&B run. For more information, see [Track external files]({{< relref "./track-external-files.md" >}}).
72+
{{% alert title="When to use Artifact.save() or wandb.Run.log_artifact()" %}}
73+
- Use `Artifact.save()` to update an existing artifact without creating a new run.
74+
- Use `wandb.Run.log_artifact()` to create a new artifact and associate it with a specific run.
75+
{{% /alert %}}
7376

7477
{{% alert color="secondary" %}}
7578
Calls to `log_artifact` are performed asynchronously for performant uploads. This can cause surprising behavior when logging artifacts in a loop. For example:

content/en/guides/core/artifacts/update-an-artifact.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ weight: 4
1010

1111
Pass desired values to update the `description`, `metadata`, and `alias` of an artifact. Call the `save()` method to update the artifact on the W&B servers. You can update an artifact during a W&B Run or outside of a Run.
1212

13+
{{% alert title="When to use Artifact.save() or wandb.Run.log_artifact()" %}}
14+
- Use `Artifact.save()` to update an existing artifact without creating a new run.
15+
- Use `wandb.Run.log_artifact()` to create a new artifact and associate it with a specific run.
16+
{{% /alert %}}
17+
1318
Use the W&B Public API ([`wandb.Api`]({{< relref "/ref/python/public-api/api.md" >}})) to update an artifact outside of a run. Use the Artifact API ([`wandb.Artifact`]({{< relref "/ref/python/sdk/classes/artifact.md" >}})) to update an artifact during a run.
1419

1520
{{% alert color="secondary" %}}

0 commit comments

Comments
 (0)