> ## 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.

# Run

export const GitHubLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="github-source-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub source
  </a>;

<GitHubLink url="https://github.com/wandb/wandb/blob/main/wandb/apis/public/runs.py" />

## <kbd>class</kbd> `Run`

특정 Entity 및 Project와 연결된 단일 Run입니다.

### <kbd>method</kbd> `Run.__init__`

```python theme={null}
__init__(
    client: 'RetryingClient',
    entity: 'str',
    project: 'str',
    run_id: 'str',
    attrs: 'Mapping | None' = None,
    include_sweeps: 'bool' = True,
    lazy: 'bool' = True,
    api: 'public.Api | None' = None
)
```

**Args:**

* `client`: W\&B API 클라이언트입니다.
* `entity`: Run과 연결된 Entity입니다.
* `project`: Run과 연결된 Project입니다.
* `run_id`: Run의 고유 식별자입니다.
* `attrs`: Run의 속성입니다.
* `include_sweeps`: Run에 Sweeps를 포함할지 여부입니다.

**Attributes:**

* `tags` (\[str]): Run과 연결된 태그 리스트
* `url` (str): 이 Run의 URL
* `id` (str): Run의 고유 식별자 (기본값은 8자)
* `name` (str): Run의 이름
* `state` (str): 다음 중 하나: running, finished, crashed, killed, preempting, preempted
* `config` (dict): Run과 연결된 하이퍼파라미터 딕셔너리
* `created_at` (str): Run이 시작된 ISO 타임스탬프
* `system_metrics` (dict): Run에 대해 기록된 최신 시스템 메트릭
* `summary` (dict): 현재 요약을 보유하는 가변(mutable) 딕셔너리 형태의 속성입니다. update를 호출하면 변경 사항이 유지됩니다.
* `project` (str): Run과 연결된 Project
* `entity` (str): Run과 연결된 Entity 이름
* `project_internal_id` (int): Project의 내부 ID
* `user` (str): Run을 생성한 Users 이름
* `path` (str): 고유 식별자 \[entity]/\[project]/\[run\_id]
* `notes` (str): Run에 대한 메모
* `read_only` (boolean): Run의 편집 가능 여부
* `history_keys` (str): `wandb.Run.log({"key": "value"})`로 기록된 History 메트릭 키
* `metadata` (str): wandb-metadata.json에서 가져온 Run 관련 메타데이터

Run 오브젝트를 초기화합니다.

Run은 항상 `api`가 `wandb.Api`의 인스턴스인 `api.runs()`를 호출하여 초기화됩니다.

***

### <kbd>property</kbd> Run.config

Run config를 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**Returns:**

* `dict[str, Any]`: config 속성 값.

***

### <kbd>property</kbd> Run.entity

Run과 연결된 Entity입니다.

**Returns:**

* `str`: entity 속성 값.

***

### <kbd>property</kbd> Run.id

Run의 고유 식별자입니다.

**Returns:**

* `str`: id 속성 값.

***

### <kbd>property</kbd> Run.lastHistoryStep

Run history에 기록된 마지막 스텝을 반환합니다.

**Returns:**

* `int`: lastHistoryStep 속성 값.

***

### <kbd>property</kbd> Run.metadata

wandb-metadata.json에서 가져온 Run 관련 메타데이터입니다.

메타데이터에는 Run의 설명, 태그, 시작 시간, 메모리 사용량 등이 포함됩니다.

**Returns:**

* `dict[str, Any] | None`: metadata 속성 값.

***

### <kbd>property</kbd> Run.name

Run의 이름입니다.

**Returns:**

* `str | None`: name 속성 값.

***

### <kbd>property</kbd> Run.path

Run의 경로입니다. 경로는 entity, project, run\_id를 포함하는 리스트입니다.

**Returns:**

* `list[str]`: path 속성 값.

***

### <kbd>property</kbd> Run.rawconfig

내부 키를 포함한 원본 Run config를 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**Returns:**

* `dict[str, Any]`: rawconfig 속성 값.

***

### <kbd>property</kbd> Run.state

Run의 상태입니다. Finished, Failed, Crashed, Running 중 하나일 수 있습니다.

**Returns:**

* `str`: state 속성 값.

***

### <kbd>property</kbd> Run.storage\_id

Run의 고유 저장소 식별자입니다.

**Returns:**

* `str`: storage\_id 속성 값.

***

### <kbd>property</kbd> Run.summary

Run summary 메트릭을 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**Returns:**

* `HTTPSummary`: summary 속성 값.

***

### <kbd>property</kbd> Run.summary\_metrics

Run summary 메트릭을 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**Returns:**

* `dict[str, Any]`: summary\_metrics 속성 값.

***

### <kbd>property</kbd> Run.sweep\_name

Sweep 이름을 가져옵니다. sweepName은 경량 프래그먼트에 포함되어 있으므로 항상 사용 가능합니다.

**Returns:**

* `str | None`: sweep\_name 속성 값.

***

### <kbd>property</kbd> Run.system\_metrics

Run 시스템 메트릭을 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**Returns:**

* `dict[str, Any]`: system\_metrics 속성 값.

***

### <kbd>property</kbd> Run.url

Run의 URL입니다.

Run URL은 entity, project, run\_id로 생성됩니다. SaaS 사용자의 경우 `https://wandb.ai/entity/project/run_id` 형식을 갖습니다.

**Returns:**

* `str`: url 속성 값.

***

### <kbd>property</kbd> Run.username

이 API는 더 이상 사용되지 않습니다(deprecated). 대신 `entity`를 사용하세요.

**Returns:**

* `str`: username 속성 값.

***

### <kbd>method</kbd> `Run.beta_scan_history`

```python theme={null}
beta_scan_history(
    keys: 'list[str] | None' = None,
    page_size: 'int' = 1000,
    min_step: 'int' = 0,
    max_step: 'int | None' = None,
    use_cache: 'bool' = True
) → public.BetaHistoryScan
```

Run의 모든 history 레코드에 대한 반복 가능한 컬렉션을 반환합니다.

이 함수는 아직 개발 중이며 예상대로 작동하지 않을 수 있습니다. wandb-core를 사용하여 로컬에 내보낸 Run의 parquet history에서 history를 읽습니다.

**Args:**

* `keys`: Run history에서 읽을 메트릭 리스트입니다. 키가 제공되지 않으면 모든 메트릭이 반환됩니다.
* `page_size`: 한 번에 읽을 history 레코드 수입니다.
* `min_step`: history 읽기를 시작할 최소 스텝(포함)입니다.
* `max_step`: history를 읽을 최대 스텝(제외)입니다.
* `use_cache`: True로 설정하면 WANDB\_CACHE\_DIR에서 Run history를 확인합니다. 캐시에서 Run history를 찾을 수 없는 경우 서버에서 다운로드합니다. False로 설정하면 매번 Run history를 다운로드합니다.

**Returns:**
history 레코드를 순회할 수 있는 BetaHistoryScan 오브젝트입니다.

***

### <kbd>classmethod</kbd> `Run.create`

```python theme={null}
create(
    api: 'public.Api',
    run_id: 'str | None' = None,
    project: 'str | None' = None,
    entity: 'str | None' = None,
    state: "Literal['running', 'pending']" = 'running'
) → Self
```

주어진 Project에 대한 Run을 생성합니다.

***

### <kbd>method</kbd> `Run.delete`

```python theme={null}
delete(delete_artifacts: 'bool' = False) → None
```

wandb 백엔드에서 해당 Run을 삭제합니다.

**Args:**

* `delete_artifacts` (bool, 선택 사항): Run과 연결된 Artifacts를 삭제할지 여부입니다.

***

### <kbd>method</kbd> `Run.file`

```python theme={null}
file(name: 'str') → public.File
```

Artifact 내의 지정된 이름을 가진 파일 경로를 반환합니다.

**Args:**

* `name` (str): 요청된 파일의 이름.

**Returns:**
name 인수와 일치하는 `File` 오브젝트.

***

### <kbd>method</kbd> `Run.files`

```python theme={null}
files(
    names: 'list[str] | None' = None,
    pattern: 'str | None' = None,
    per_page: 'int' = 50
) → public.Files
```

주어진 기준과 일치하는 Run의 모든 파일에 대한 `Files` 오브젝트를 반환합니다.

일치시킬 정확한 파일 이름 리스트 또는 일치시킬 패턴을 지정할 수 있습니다. 둘 다 제공되는 경우 패턴은 무시됩니다.

**Args:**

* `names` (list): 요청된 파일의 이름들, 비어 있으면 모든 파일을 반환합니다.
* `pattern` (str, 선택 사항): W\&B에서 파일을 반환할 때 일치시킬 패턴입니다. 이 패턴은 mySQL의 LIKE 구문을 사용하므로 .json으로 끝나는 모든 파일을 매칭하려면 "%.json"이 됩니다. names와 pattern이 모두 제공되면 ValueError가 발생합니다.
* `per_page` (int): 페이지당 결과 수.

**Returns:**
`File` 오브젝트를 순회하는 반복자인 `Files` 오브젝트.

***

### <kbd>method</kbd> `Run.history`

```python theme={null}
history(
    samples: 'int' = 500,
    keys: 'list[str] | None' = None,
    x_axis: 'str' = '_step',
    pandas: 'bool' = True,
    stream: "Literal['default', 'system']" = 'default'
) → list[dict[str, Any]] | pd.DataFrame
```

Run에 대해 샘플링된 history 메트릭을 반환합니다.

history 레코드가 샘플링되어도 괜찮다면 이 방법이 더 간단하고 빠릅니다.

**Args:**

* `samples`: (int, 선택 사항) 반환할 샘플 수
* `pandas`: (bool, 선택 사항) pandas 데이터프레임 반환 여부
* `keys`: (list, 선택 사항) 특정 키에 대한 메트릭만 반환
* `x_axis`: (str, 선택 사항) xAxis로 사용할 메트릭, 기본값은 \_step
* `stream`: (str, 선택 사항) 메트릭의 경우 "default", 머신 메트릭의 경우 "system"

**Returns:**

* `pandas.DataFrame`: pandas=True인 경우 history 메트릭의 `pandas.DataFrame`을 반환합니다.
* `list of dicts`: pandas=False인 경우 history 메트릭의 딕셔너리 리스트를 반환합니다.

***

### <kbd>method</kbd> `Run.load`

```python theme={null}
load(force: 'bool' = False) → dict[str, Any]
```

lazy 모드에 기반한 적절한 프래그먼트를 사용하여 Run 데이터를 로드합니다.

***

### <kbd>method</kbd> `Run.load_full_data`

```python theme={null}
load_full_data(force: 'bool' = False) → dict[str, Any]
```

config, systemMetrics, summaryMetrics와 같은 무거운 필드를 포함한 전체 Run 데이터를 로드합니다.

이 메소드는 처음에 Run 리스트를 가져오기 위해 lazy=True를 사용했지만, 특정 Run에 대한 전체 데이터 액세스가 필요한 경우 유용합니다.

**Args:**

* `force`: 데이터가 이미 로드되어 있더라도 강제로 다시 로드합니다.

**Returns:**
로드된 Run 속성들

***

### <kbd>method</kbd> `Run.log_artifact`

```python theme={null}
log_artifact(
    artifact: 'wandb.Artifact',
    aliases: 'Collection[str] | None' = None,
    tags: 'Collection[str] | None' = None
) → wandb.Artifact
```

Artifact를 Run의 출력으로 선언합니다.

**Args:**

* `artifact` (`Artifact`): `wandb.Api().artifact(name)`에서 반환된 Artifact.
* `aliases` (list, 선택 사항): 이 Artifact에 적용할 에일리어스.
* `tags`: (list, 선택 사항) 이 Artifact에 적용할 태그(있는 경우).

**Returns:**
`Artifact` 오브젝트.

***

### <kbd>method</kbd> `Run.logged_artifacts`

```python theme={null}
logged_artifacts(per_page: 'int' = 100) → public.RunArtifacts
```

이 Run에 의해 로깅된 모든 Artifacts를 가져옵니다.

Run 중에 로깅된 모든 출력 Artifacts를 검색합니다. 반복하거나 단일 리스트로 수집할 수 있는 페이지네이션된 결과를 반환합니다.

**Args:**

* `per_page`: API 요청당 가져올 Artifacts 수.

**Returns:**
이 Run 중에 출력으로 로깅된 모든 Artifact 오브젝트의 반복 가능한 컬렉션.

**Example:**

```python theme={null}
import wandb
import tempfile

with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as tmp:
   tmp.write("This is a test artifact")
   tmp_path = tmp.name
run = wandb.init(project="artifact-example")
artifact = wandb.Artifact("test_artifact", type="dataset")
artifact.add_file(tmp_path)
run.log_artifact(artifact)
run.finish()

api = wandb.Api()

finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")

for logged_artifact in finished_run.logged_artifacts():
   print(logged_artifact.name)
```

***

### <kbd>method</kbd> `Run.save`

```python theme={null}
save() → None
```

Run 오브젝트의 변경 사항을 W\&B 백엔드에 유지합니다.

***

### <kbd>method</kbd> `Run.scan_history`

```python theme={null}
scan_history(
    keys: 'list[str] | None' = None,
    page_size: 'int' = 1000,
    min_step: 'int | None' = None,
    max_step: 'int | None' = None
) → Iterator[dict[str, Any]]
```

Run의 모든 history 레코드에 대한 반복 가능한 컬렉션을 반환합니다.

**Args:**

* `keys` (\[str], 선택 사항): 이 키들만 가져오고, 모든 키가 정의된 행만 가져옵니다.
* `page_size` (int, 선택 사항): api에서 가져올 페이지 크기.
* `min_step` (int, 선택 사항): 한 번에 스캔할 최소 페이지 수.
* `max_step` (int, 선택 사항): 한 번에 스캔할 최대 페이지 수.

**Returns:**
history 레코드(dict)에 대한 반복 가능한 컬렉션.

**Example:**
예제 Run의 모든 loss 값을 내보냅니다.

```python theme={null}
run = api.run("entity/project-name/run-id")
history = run.scan_history(keys=["Loss"])
losses = [row["Loss"] for row in history]
```

***

### <kbd>method</kbd> `Run.to_html`

```python theme={null}
to_html(height: 'int' = 420, hidden: 'bool' = False) → str
```

이 Run을 표시하는 iframe을 포함한 HTML을 생성합니다.

***

### <kbd>method</kbd> `Run.update`

```python theme={null}
update() → None
```

Run 오브젝트의 변경 사항을 wandb 백엔드에 유지합니다.

***

### <kbd>method</kbd> `Run.upload_file`

```python theme={null}
upload_file(path: 'str', root: 'str' = '.') → public.File
```

로컬 파일을 W\&B에 업로드하고 이 Run과 연결합니다.

**Args:**

* `path` (str): 업로드할 파일의 경로. 절대 경로 또는 상대 경로일 수 있습니다.
* `root` (str): 파일을 저장할 기준이 되는 루트 경로입니다. 예를 들어, 현재 "my\_dir"에 있고 파일을 Run에 "my\_dir/file.txt"로 저장하려면 root를 "../"로 설정합니다. 기본값은 현재 디렉토리(".")입니다.

**Returns:**
업로드된 파일을 나타내는 `File` 오브젝트.

***

### <kbd>method</kbd> `Run.use_artifact`

```python theme={null}
use_artifact(
    artifact: 'wandb.Artifact',
    use_as: 'str | None' = None
) → wandb.Artifact
```

Artifact를 Run의 입력으로 선언합니다.

**Args:**

* `artifact` (`Artifact`): `wandb.Api().artifact(name)`에서 반환된 Artifact
* `use_as` (string, 선택 사항): 스크립트에서 Artifact가 어떻게 사용되는지 식별하는 문자열입니다. 베타 버전인 wandb launch 기능의 Artifact 스와핑 기능을 사용할 때 Run에서 사용되는 Artifacts를 쉽게 구분하기 위해 사용됩니다.

**Returns:**
`Artifact` 오브젝트.

***

### <kbd>method</kbd> `Run.used_artifacts`

```python theme={null}
used_artifacts(per_page: 'int' = 100) → public.RunArtifacts
```

이 Run에서 명시적으로 사용된 Artifacts를 가져옵니다.

일반적으로 `run.use_artifact()`를 통해 Run 중에 명시적으로 사용된 것으로 선언된 입력 Artifacts만 검색합니다. 반복하거나 단일 리스트로 수집할 수 있는 페이지네이션된 결과를 반환합니다.

**Args:**

* `per_page`: API 요청당 가져올 Artifacts 수.

**Returns:**
이 Run에서 입력으로 명시적으로 사용된 Artifact 오브젝트의 반복 가능한 컬렉션.

**Example:**

```python theme={null}
import wandb

run = wandb.init(project="artifact-example")
run.use_artifact("test_artifact:latest")
run.finish()

api = wandb.Api()
finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")
for used_artifact in finished_run.used_artifacts():
   print(used_artifact.name)
test_artifact
```

***

### <kbd>method</kbd> `Run.wait_until_finished`

```python theme={null}
wait_until_finished() → None
```

Run이 완료될 때까지 Run의 상태를 확인합니다.
