Update an artifact

W&B Run 안팎에서 기존 아티팩트 를 업데이트합니다.

원하는 값을 전달하여 아티팩트의 description, metadata, 그리고 alias를 업데이트하세요. W&B 서버에서 아티팩트를 업데이트하려면 save() 메서드를 호출하세요. W&B Run 도중 또는 Run 외부에서 아티팩트를 업데이트할 수 있습니다.

Run 외부에서 아티팩트를 업데이트하려면 W&B Public API(wandb.Api)를 사용하세요. Run 도중에 아티팩트를 업데이트하려면 Artifact API(wandb.Artifact)를 사용하세요.

다음 코드 예제는 wandb.Artifact API를 사용하여 아티팩트의 설명을 업데이트하는 방법을 보여줍니다:

import wandb

run = wandb.init(project="<example>")
artifact = run.use_artifact("<artifact-name>:<alias>")
artifact.description = "<description>"
artifact.save()

다음 코드 예제는 wandb.Api API를 사용하여 아티팩트의 설명을 업데이트하는 방법을 보여줍니다:

import wandb

api = wandb.Api()

artifact = api.artifact("entity/project/artifact:alias")

# Update the description
artifact.description = "My new description"

# Selectively update metadata keys
artifact.metadata["oldKey"] = "new value"

# Replace the metadata entirely
artifact.metadata = {"newKey": "new value"}

# Add an alias
artifact.aliases.append("best")

# Remove an alias
artifact.aliases.remove("latest")

# Completely replace the aliases
artifact.aliases = ["replaced"]

# Persist all artifact modifications
artifact.save()

자세한 내용은 Weights and Biases Artifact API를 참조하십시오.

단일 아티팩트와 같은 방식으로 Artifact 컬렉션을 업데이트할 수도 있습니다:

import wandb
run = wandb.init(project="<example>")
api = wandb.Api()
artifact = api.artifact_collection(type="<type-name>", collection="<collection-name>")
artifact.name = "<new-collection-name>"
artifact.description = "<This is where you'd describe the purpose of your collection.>"
artifact.save()

자세한 내용은 Artifacts Collection 레퍼런스를 참조하십시오.