> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 레지스트리

> W&B 모델 레지스트리를 사용하여 모델 버전을 정리하고 관리하세요.

W\&B 모델 레지스트리를 사용하여 모델 버전을 구성하고 관리하세요.

<h2 id="add-a-description-to-a-collection-in-a-registry">
  레지스트리의 컬렉션에 설명 추가
</h2>

```python theme={"system"}
"""
Add an description to a collection in a registry.
"""
import wandb

# 레지스트리와 컬렉션 세부 정보를 정의합니다
collection_type = "<collection_type>"
registry_name = "<registry_name>"
collection_name = "<collection_name>"

# 전체 레지스트리 경로를 구성합니다
registry_path = f"wandb-registry-{registry_name}/{collection_name}"

# W&B API를 초기화합니다
api = wandb.Api()

# 아티팩트 컬렉션을 가져옵니다
collection = api.artifact_collection(
  type_name = collection_type, 
  name = registry_path
  )

# 컬렉션 객체에 설명 주석을 추가합니다
collection.description = "<description>"

# 업데이트된 컬렉션을 저장합니다
collection.save()
```

<h2 id="create-a-new-registry">
  새 레지스트리 만들기
</h2>

```python theme={"system"}
"""
Create a new registry in W&B. If the registry does not exist, W&B creates it.
"""
import wandb

# W&B API 초기화
api = wandb.Api()

# 새 레지스트리 생성
registry = api.create_registry(
    name="<registry_name>",
    visibility="<visibility>",  # 예: "public" 또는 "private"
)
```

<h2 id="delete-a-registry">
  레지스트리 삭제
</h2>

```python theme={"system"}
"""
Delete a registry from W&B.
"""
import wandb

# 레지스트리 및 컬렉션 세부 정보 정의
registry_name = "<registry_name>"
collection_name = "<collection_name>"

# 전체 레지스트리 경로 구성
registry_path = f"wandb-registry-{registry_name}/{collection_name}"

# W&B API 초기화
api = wandb.Api()

# 삭제할 레지스트리 가져오기
fetched_registry = api.registry("<registry_name>")

# 레지스트리 삭제
fetched_registry.delete()
```

<h2 id="create-an-artifact-and-link-it-to-a-collection-in-a-registry">
  아티팩트를 생성하고 레지스트리의 컬렉션에 연결하기
</h2>

```python theme={"system"}
"""
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

# 아티팩트 객체 생성
artifact = wandb.Artifact(name = "<artifact_name>", type = "<artifact_type>")

# 레지스트리 및 컬렉션 이름 정의
registry_name = "<registry_name>"
collection_name = "<collection_name>"
target_path = f"wandb-registry-{registry_name}/{collection_name}"

# run 초기화
with wandb.init(entity = "<entity>", project = "<project>") as run:
  # 아티팩트를 컬렉션에 연결합니다. 컬렉션이 없으면 W&B가 새로 생성합니다.
  run.link_artifact(artifact = artifact, target_path = target_path)
```

<h2 id="retrieve-a-specific-version-of-an-artifact-from-a-registry-collection">
  레지스트리 컬렉션에서 아티팩트의 특정 버전 가져오기
</h2>

```python theme={"system"}
"""
Retrieve a specific version of an artifact from a registry collection.
"""

import wandb

# 레지스트리, 컬렉션, 아티팩트 버전 정보를 지정합니다
registry = "<registry_name>"
collection = "<collection_name>"
version = "<version>"

# 버전을 포함한 전체 아티팩트 이름을 생성합니다
artifact_name = f"wandb-registry-{registry}/{collection}:{version}"

# W&B API를 초기화합니다
api = wandb.Api()

# 지정한 레지스트리 컬렉션에서 해당 버전의 아티팩트를 가져옵니다
artifact = api.artifact(name = artifact_name)
```

<h2 id="create-a-registry-collection-and-link-an-artifact-to-it">
  레지스트리 컬렉션을 만들고 아티팩트 연결하기
</h2>

```python theme={"system"}
"""
Ceates a registry collection and links an artifact to it.
"""
import wandb

# 아티팩트 객체 생성
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}"

# run 초기화
with wandb.init(entity = "<entity>", project = "<project>") as run:

  # 아티팩트를 컬렉션에 연결합니다. 컬렉션이 없으면 W&B가 자동으로 생성합니다.
  run.link_artifact(artifact = artifact, target_path = registry_path)
```

<h2 id="add-tags-to-a-collection-in-a-registry">
  레지스트리의 컬렉션에 태그 추가
</h2>

```python theme={"system"}
"""
Add tags to a collection in a registry.
"""
import wandb

# 레지스트리와 컬렉션 세부 정보를 정의합니다
collection_name = "<collection_name>"
collection_type = "<collection_type>"
registry_name = "<registry_name>"

# 전체 레지스트리 경로를 구성합니다
registry_path = f"wandb-registry-{registry_name}/{collection_name}"

# 아티팩트 컬렉션을 가져옵니다
collection = wandb.Api().artifact_collection(
  type_name = collection_type, 
  name = registry_path
  )

collection.tags = ["<tag>"]
collection.save()
```

<h2 id="remove-a-tag-from-a-collection-in-a-registry">
  레지스트리의 컬렉션에서 태그 제거
</h2>

```python theme={"system"}
"""
Remove a tag from a collection in a registry.
"""
import wandb

# 레지스트리 및 컬렉션 세부 정보 정의
collection_name = "<collection_name>"
collection_type = "<collection_type>"
registry_name = "<registry_name>"

# 전체 레지스트리 경로 구성
registry_path = f"wandb-registry-{registry_name}/{collection_name}"

# 아티팩트 컬렉션 조회
collection = wandb.Api().artifact_collection(
  type_name = collection_type, 
  name = registry_path
  )

collection.tags.remove("<tag>")
collection.save()
```


## Related topics

- [자동화 이벤트 및 범위](/ko/products/wandb/automations/automation-events.md)
