레지스트리 컬렉션에 설명 추가하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Add an description to a collection in a registry.
"""
import wandb
# Define registry and collection details
collection_type = "<collection_type>"
registry_name = "<registry_name>"
collection_name = "<collection_name>"
# Construct the full registry path
registry_path = f"wandb-registry-{registry_name}/{collection_name}"
# Initialize W&B API
api = wandb.Api()
# Retrieve the artifact collection
collection = api.artifact_collection(
type_name = collection_type,
name = registry_path
)
# Add description annotation to the collection object
collection.description = "<description>"
# Save the updated collection
collection.save()
새 레지스트리 생성하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Create a new registry in W&B. If the registry does not exist, W&B creates it.
"""
import wandb
# Initialize W&B API
api = wandb.Api()
# Create a new registry
registry = api.create_registry(
name="<registry_name>",
visibility="<visibility>", # e.g., "public" or "private"
)
레지스트리 삭제하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Delete a registry from W&B.
"""
import wandb
# Define registry and collection details
registry_name = "<registry_name>"
collection_name = "<collection_name>"
# Construct the full registry path
registry_path = f"wandb-registry-{registry_name}/{collection_name}"
# Initialize the W&B API
api = wandb.Api()
# Fetch the registry you want to delete
fetched_registry = api.registry("<registry_name>")
# Deleting a registry
fetched_registry.delete()
아티팩트 생성 및 레지스트리 컬렉션에 링크하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Create a W&B artifact and link it to a collection in a registry. If the
collection does not exist, W&B creates it.
"""
import wandb
# Create an artifact object
artifact = wandb.Artifact(name = "<artifact_name>", type = "<artifact_type>")
# Define registry and collection names
registry_name = "<registry_name>"
collection_name = "<collection_name>"
target_path = f"wandb-registry-{registry_name}/{collection_name}"
# Initialize a run
with wandb.init(entity = "<entity>", project = "<project>") as run:
# Link the artifact to a collection. If the collection does not exist, W&B creates it.
run.link_artifact(artifact = artifact, target_path = target_path)
레지스트리 컬렉션에서 특정 버전의 아티팩트 가져오기
잘못된 코드 신고
복사
AI에게 묻기
"""
Retrieve a specific version of an artifact from a registry collection.
"""
import wandb
# Define registry, collection, and artifact version details
registry = "<registry_name>"
collection = "<collection_name>"
version = "<version>"
# Construct the full artifact name with version
artifact_name = f"wandb-registry-{registry}/{collection}:{version}"
# Initialize W&B API
api = wandb.Api()
# Retrieve the artifact from the specified registry collection and version
artifact = api.artifact(name = artifact_name)
레지스트리 컬렉션 생성 및 아티팩트 링크하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Ceates a W&B registry collection and links an artifact to it.
"""
import wandb
# Create an artifact object
artifact = wandb.Artifact(name = "<artifact_name>", type = "<artifact_type>")
registry_name = "<registry_name>"
collection_name = "<collection_name>"
registry_path = f"wandb-registry-{registry_name}/{collection_name}"
# Initialize a run
with wandb.init(entity = "<entity>", project = "<project>") as run:
# Link the artifact to a collection. If the collection does not exist, W&B creates it.
run.link_artifact(artifact = artifact, target_path = registry_path)
레지스트리 컬렉션에 태그 추가하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Add tags to a collection in a registry.
"""
import wandb
# Define registry and collection details
collection_name = "<collection_name>"
collection_type = "<collection_type>"
registry_name = "<registry_name>"
# Construct the full registry path
registry_path = f"wandb-registry-{registry_name}/{collection_name}"
# Retrieve the artifact collection
collection = wandb.Api().artifact_collection(
type_name = collection_type,
name = registry_path
)
collection.tags = ["<tag>"]
collection.save()
레지스트리 컬렉션에서 태그 제거하기
잘못된 코드 신고
복사
AI에게 묻기
"""
Remove a tag from a collection in a registry.
"""
import wandb
# Define registry and collection details
collection_name = "<collection_name>"
collection_type = "<collection_type>"
registry_name = "<registry_name>"
# Construct the full registry path
registry_path = f"wandb-registry-{registry_name}/{collection_name}"
# Retrieve the artifact collection
collection = wandb.Api().artifact_collection(
type_name = collection_type,
name = registry_path
)
collection.tags.remove("<tag>")
collection.save()