> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-serverless-sft-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Artifacts 개요

> start_thought W&B Artifacts 개요, 작동 방식 및 시작 방법에 대해 알아봅니다.

export const TryProductLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="github-source-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" xmlns="http://www.w3.org/2000/svg">
      <line x1="4" y1="21" x2="4" y2="14"></line>
      <line x1="4" y1="10" x2="4" y2="3"></line>
      <line x1="12" y1="21" x2="12" y2="12"></line>
      <line x1="12" y1="8" x2="12" y2="3"></line>
      <line x1="20" y1="21" x2="20" y2="16"></line>
      <line x1="20" y1="12" x2="20" y2="3"></line>
      <circle cx="4" cy="12" r="2"></circle>
      <circle cx="12" cy="10" r="2"></circle>
      <circle cx="20" cy="14" r="2"></circle>
    </svg>
    Try in W&amp;B
  </a>;

export const ColabLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="colab-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01.21.03zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z" />
    </svg>
    Try in Colab
  </a>;

<CardGroup cols={4}>
  <ColabLink url="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb_registry/zoo_wandb.ipynb" />

  <TryProductLink url="https://wandb.ai/wandb/arttest/artifacts/model/iv3_trained/5334ab69740f9dda4fed/lineage" />
</CardGroup>

W\&B Artifacts 를 사용하여 [W\&B Runs](/models/runs/) 의 입력 및 출력으로 사용되는 데이터를 추적하고 버전을 관리하세요. 예를 들어, 모델 트레이닝 run 은 데이터셋을 입력으로 받아 트레이닝된 모델을 출력으로 생성할 수 있습니다. 하이퍼파라미터, 메타데이터, 메트릭을 run 에 로그할 수 있으며, Artifacts 를 사용하여 모델 트레이닝에 사용된 데이터셋을 입력으로, 결과물인 모델 체크포인트를 출력으로 로그, 추적 및 버전 관리할 수 있습니다.

## 유스 케이스

전체 ML 워크플로우에서 [runs](/models/runs/) 의 입력과 출력으로 Artifacts 를 사용할 수 있습니다. 데이터셋, 모델 또는 다른 Artifacts 를 처리 프로세스의 입력으로 사용할 수 있습니다.

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-serverless-sft-revamp/-xwwlqpAcEzLHKzq/images/artifacts/artifacts_landing_page2.png?fit=max&auto=format&n=-xwwlqpAcEzLHKzq&q=85&s=6ec1d86a049c1ae7571dd12c3334fe94" width="1991" height="503" data-path="images/artifacts/artifacts_landing_page2.png" />
</Frame>

| 유스 케이스                            | 입력                   | 출력                            |
| --------------------------------- | -------------------- | ----------------------------- |
| 모델 트레이닝 (Model Training)          | 데이터셋 (트레이닝 및 검증 데이터) | 트레이닝된 모델                      |
| 데이터셋 전처리 (Dataset Pre-Processing) | 데이터셋 (원시 데이터)        | 데이터셋 (전처리된 데이터)               |
| 모델 평가 (Model Evaluation)          | 모델 + 데이터셋 (테스트 데이터)  | [W\&B Table](/models/tables/) |
| 모델 최적화 (Model Optimization)       | 모델                   | 최적화된 모델                       |

<Note>
  다음 코드조각들은 순서대로 실행되어야 합니다.
</Note>

## Artifact 생성하기

네 줄의 코드로 Artifact 를 생성하세요:

1. [W\&B run](/models/runs/) 을 생성합니다.
2. [`wandb.Artifact`](/models/ref/python/experiments/artifact) 를 사용하여 Artifact 오브젝트를 생성합니다.
3. `wandb.Artifact.add_file()` 을 사용하여 모델 파일이나 데이터셋과 같은 하나 이상의 파일을 Artifact 오브젝트에 추가합니다.
4. `wandb.Run.log_artifact()` 를 사용하여 W\&B 에 Artifact 를 로그합니다.

예를 들어, 다음 코드조각은 `dataset.h5` 라는 파일을 `example_artifact` 라는 이름의 Artifact 로 로그하는 방법을 보여줍니다:

```python theme={null}
import wandb

# run 생성 및 프로젝트 설정
with wandb.init(project="artifacts-example", job_type="add-dataset") as run:
    # Artifact 오브젝트 생성
    artifact = wandb.Artifact(name="example_artifact", type="dataset")
    # 파일 추가
    artifact.add_file(local_path="./dataset.h5", name="training_dataset")
    # Artifact 로그
    run.log_artifact(artifact)
```

* Artifact 의 `type` 은 W\&B 플랫폼에서 어떻게 표시될지에 영향을 줍니다. `type` 을 지정하지 않으면 기본값은 `unspecified` 로 설정됩니다.
* 드롭다운의 각 레이블은 서로 다른 `type` 파라미터 값을 나타냅니다. 위의 코드조각에서 Artifact 의 `type` 은 `dataset` 입니다.

<Note>
  Amazon S3 버킷과 같은 외부 오브젝트 스토리지에 저장된 파일이나 디렉토리에 대한 참조를 추가하는 방법은 [외부 파일 추적 가이드](/models/artifacts/track-external-files/) 페이지를 참조하세요.
</Note>

## Artifact 다운로드하기

[`wandb.Run.use_artifact()`](/models/ref/python/experiments/run#use_artifact) 메소드를 사용하여 run 의 입력으로 표시할 Artifact 를 지정합니다.

이전 코드조각에 이어, 다음 코드 예시는 이전에 생성된 `example_artifact` 라는 이름의 Artifact 를 사용하는 방법을 보여줍니다:

```python theme={null}
with wandb.init(project="artifacts-example", job_type="add-dataset") as run:
    # "training_dataset" 아티팩트를 사용하는 run 오브젝트를 반환
    artifact = run.use_artifact("training_dataset:latest")  
```

이 코드는 Artifact 오브젝트를 반환합니다.

그 다음, 반환된 오브젝트를 사용하여 Artifact 의 모든 내용을 다운로드합니다:

```python theme={null}
# 전체 `my_data` 아티팩트를 기본 디렉토리에 다운로드합니다.
datadir = artifact.download()  
```

<Note>
  `root` [파라미터](/models/ref/python/experiments/artifact) 에 커스텀 경로를 전달하여 Artifact 를 특정 디렉토리에 다운로드할 수 있습니다. Artifact 를 다운로드하는 다른 방법과 추가 파라미터는 [Artifact 다운로드 및 사용](/models/artifacts/download-and-use-an-artifact/) 가이드를 확인하세요.
</Note>

## 다음 단계

* Artifact 의 [버전 관리](/models/artifacts/create-a-new-artifact-version/) 및 [업데이트](/models/artifacts/update-an-artifact/) 방법을 알아보세요.
* [Automations](/models/automations/) 를 사용하여 Artifact 의 변경 사항에 따라 다운스트림 워크플로우를 트리거하거나 Slack 채널에 알림을 보내는 방법을 알아보세요.
* 트레이닝된 모델을 보관하는 공간인 [Registry](/models/registry/) 에 대해 알아보세요.
* [Python SDK](/models/ref/python/experiments/artifact) 및 [CLI](/models/ref/cli/wandb-artifact/) 레퍼런스 가이드를 살펴보세요.
