원하는 값을 전달해 아티팩트의 description, metadata, alias를 업데이트하세요. W&B Public API(wandb.Api)를 사용해 이전에 W&B에 로깅된 아티팩트를 업데이트할 수 있습니다. 아티팩트가 처음 초기화된 뒤 아직 활성 상태인 경우에는 wandb.Run.save()를 사용해 아티팩트를 업데이트하세요.
wandb.Artifact.save() 또는 wandb.Run.log_artifact()를 사용해야 하는 경우
- 새 run을 시작하지 않고 기존 아티팩트를 업데이트하려면
Artifact.save()를 사용하세요.
- 새 아티팩트를 만들고 특정 run에 연결하려면
wandb.Run.log_artifact()를 사용하세요.
아티팩트를 업데이트하려면 W&B Public API(wandb.Api)를 사용하세요. run이 활성 상태인 동안에는 wandb.Artifact 클래스를 사용하세요.
Model Registry의 모델에 연결된 아티팩트의 별칭은 업데이트할 수 없습니다.
다음 코드 예제는 wandb.Artifact API를 사용해 아티팩트의 설명을 업데이트하는 방법을 보여줍니다:import wandb
with wandb.init(project="<example>") as run:
artifact = run.use_artifact("<artifact-name>:<alias>")
artifact.description = "<description>"
artifact.save()
다음 예제는 wandb.Api를 사용해 아티팩트를 업데이트합니다:import wandb
api = wandb.Api()
artifact = api.artifact("entity/project/artifact:alias")
# 설명 업데이트
artifact.description = "My new description"
# 메타데이터 키를 선택적으로 업데이트
artifact.metadata["oldKey"] = "new value"
# 메타데이터를 완전히 교체
artifact.metadata = {"newKey": "new value"}
# 별칭 추가
artifact.aliases.append("best")
# 별칭 제거
artifact.aliases.remove("latest")
# 별칭을 완전히 교체
artifact.aliases = ["replaced"]
# 모든 아티팩트 변경 사항 저장
artifact.save()
자세한 내용은 Weights and Biases의 Artifact API를 참조하세요. 개별 아티팩트와 같은 방식으로 Artifact 컬렉션도 업데이트할 수 있습니다:import wandb
with wandb.init(project="<example>") as run:
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 레퍼런스를 참조하세요.