메인 콘텐츠로 건너뛰기

Documentation Index

Fetch the complete documentation index at: https://wb-21fd5541-john-wbdocs-2044-rename-serverless-products.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

class Api

W&B 서버를 쿼리할 때 사용됩니다. 예시:
import wandb

wandb.Api()

방법 Api.__init__

__init__(
    overrides: 'dict[str, Any] | None' = None,
    timeout: 'int | None' = None,
    api_key: 'str | None' = None
) → None
API를 초기화합니다. 매개변수:
  • overrides: base_url을 설정할 수 있습니다.
  • https: //api.wandb.ai가 아닌 다른 W&B 서버를 using하는 경우입니다. entity, 프로젝트, run`의 기본값도 설정할 수 있습니다.
  • timeout: API 요청의 HTTP 타임아웃(초)입니다. 지정하지 않으면 기본 타임아웃이 사용됩니다.
  • api_key: 인증에 사용할 API 키입니다. 제공하지 않으면 현재 환경 또는 설정의 API 키를 사용합니다. 제공되었거나 환경에 설정된 API 키가 없으면 API 키 입력을 요청합니다.

속성 Api.client

클라이언트 객체를 반환합니다. 반환값:
  • RetryingClient: 클라이언트 속성 값입니다.

속성 Api.default_entity

기본 W&B entity를 반환합니다. 반환값:
  • str | None: default_entity 속성의 값입니다.

속성 Api.user_agent

W&B의 공개 사용자 에이전트를 반환합니다. 반환값:
  • str: user_agent 속성 값.

속성 Api.viewer

viewer 객체를 반환합니다. 예외:
  • ValueError: W&B에서 viewer 데이터를 가져올 수 없는 경우.
  • requests.RequestException: GraphQL 요청 중 오류가 발생한 경우.
반환값:
  • User: viewer 속성 값.

방법 Api.artifact

artifact(name: 'str', type: 'str | None' = None)
단일 artifact를 반환합니다. 인수:
  • name: artifact의 이름입니다. artifact 이름은 최소한 artifact가 로깅된 프로젝트 이름, artifact 이름, 그리고 artifact의 버전 또는 alias로 구성된 filepath와 유사합니다. 선택적으로 artifact를 로깅한 entity를 접두사로 추가한 뒤 슬래시(/)를 붙일 수 있습니다. 이름에 entity를 지정하지 않으면 Run 또는 API 설정의 entity가 사용됩니다.
  • type: 가져올 artifact의 유형입니다.
반환값: Artifact 객체입니다. 예외:
  • ValueError: artifact 이름이 지정되지 않은 경우.
  • ValueError: artifact 유형이 지정되었지만 가져온 artifact의 유형과 일치하지 않는 경우.
예시: 다음 코드 스니펫에서 “entity”, “project”, “artifact”, “version”, 및 “alias”는 각각 W&B entity, artifact가 속한 프로젝트 이름, artifact 이름, 그리고 artifact의 버전을 나타내는 플레이스홀더입니다.
import wandb

# 프로젝트, artifact 이름, artifact의 alias를 지정합니다
wandb.Api().artifact(name="project/artifact:alias")

# 프로젝트, artifact 이름, 특정 artifact 버전을 지정합니다
wandb.Api().artifact(name="project/artifact:version")

# entity, 프로젝트, artifact 이름, artifact의 alias를 지정합니다
wandb.Api().artifact(name="entity/project/artifact:alias")

# entity, 프로젝트, artifact 이름, 특정 artifact 버전을 지정합니다
wandb.Api().artifact(name="entity/project/artifact:version")
참고:
이 메서드는 외부에서만 사용하도록 되어 있습니다. wandb 저장소 코드 내부에서 api.artifact()를 호출하지 마세요.

방법 Api.artifact_collection

artifact_collection(type_name: 'str', name: 'str') → ArtifactCollection
유형별 단일 artifact 컬렉션을 반환합니다. 반환된 ArtifactCollection 객체를 사용해 해당 컬렉션의 특정 artifact에 대한 정보를 조회하는 등 추가 작업을 수행할 수 있습니다. 인수:
  • type_name: 가져올 artifact 컬렉션의 유형입니다.
  • name: artifact 컬렉션 이름입니다. 필요에 따라 artifact를 로깅한 entity를 접두사로 추가한 뒤 슬래시(/)를 붙일 수 있습니다.
반환값: ArtifactCollection 객체입니다. 예시: 다음 코드 스니펫에서 “type”, “entity”, “project”, “artifact_name”는 각각 컬렉션 유형, 사용자의 W&B entity, artifact가 속한 프로젝트 이름, artifact 이름을 나타내는 플레이스홀더입니다.
import wandb

collections = wandb.Api().artifact_collection(
    type_name="type", name="entity/project/artifact_name"
)

# 컬렉션의 첫 번째 artifact를 가져옵니다.
artifact_example = collections.artifacts()[0]

# artifact의 내용을 지정된 루트 디렉터리에 다운로드합니다.
artifact_example.download()

방법 Api.artifact_collection_exists

artifact_collection_exists(name: 'str', type: 'str') → bool
지정된 프로젝트와 entity 내에 artifact collection이 존재하는지 여부입니다. 매개변수:
  • name: artifact collection 이름입니다. 선택적으로 artifact를 로깅한 entity를 접두사로 붙인 다음 슬래시(/)를 추가할 수 있습니다. entity 또는 프로젝트를 지정하지 않으면 override 매개변수가 있는 경우 이를 바탕으로 collection을 추론합니다. 그렇지 않으면 entity는 User Settings에서 가져오고 프로젝트는 기본적으로 “uncategorized”로 설정됩니다.
  • type: artifact collection의 유형입니다.
반환값: artifact collection이 존재하면 True, 그렇지 않으면 False를 반환합니다. 예시: 다음 코드 스니펫에서 “type”과 “collection_name”은 각각 artifact collection의 유형과 collection의 이름을 의미합니다.
import wandb

wandb.Api.artifact_collection_exists(type="type", name="collection_name")

방법 Api.artifact_collections

artifact_collections(
    project_name: 'str',
    type_name: 'str',
    per_page: 'int' = 50,
    start: 'str | None' = None
) → ArtifactCollections
조건에 맞는 아티팩트 컬렉션 목록을 반환합니다. 매개변수:
  • project_name: 필터링할 프로젝트 이름입니다.
  • type_name: 필터링할 artifact 유형 이름입니다.
  • per_page: 쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로 이 값을 변경할 이유는 없습니다.
  • start: 이전 paginator의 .cursor 속성에서 캡처한 값을 사용해 이전 쿼리를 다시 이어가기 위한 페이지네이션 커서입니다.
반환값: 반복 가능한 ArtifactCollections 객체입니다.

방법 Api.artifact_exists

artifact_exists(name: 'str', type: 'str | None' = None) → bool
지정된 프로젝트와 entity 내에 artifact 버전이 존재하는지 여부입니다. 매개변수:
  • name: artifact의 이름입니다. artifact의 entity와 프로젝트를 접두사로 추가합니다. artifact의 버전 또는 alias를 콜론(:)과 함께 뒤에 붙입니다. entity 또는 프로젝트를 지정하지 않으면, 값이 설정되어 있는 경우 W&B가 override 매개변수를 사용합니다. 그렇지 않으면 entity는 User Settings에서 가져오고 프로젝트는 “Uncategorized”로 설정됩니다.
  • type: artifact의 유형입니다.
반환값: artifact 버전이 존재하면 True, 그렇지 않으면 False입니다. 예시: 다음 코드 스니펫에서 “entity”, “project”, “artifact”, “version”, “alias”는 각각 W&B entity, artifact가 속한 프로젝트 이름, artifact 이름, 그리고 artifact 버전을 나타내는 플레이스홀더입니다.
import wandb

wandb.Api().artifact_exists("entity/project/artifact:version")
wandb.Api().artifact_exists("entity/project/artifact:alias")

방법 Api.artifact_type

artifact_type(type_name: 'str', project: 'str | None' = None) → ArtifactType
일치하는 ArtifactType을 반환합니다. 매개변수:
  • type_name: 조회할 artifact 유형의 이름입니다.
  • project: 지정한 경우, 필터링할 프로젝트 이름 또는 경로입니다.
반환값: ArtifactType 객체입니다.

방법 Api.artifact_types

artifact_types(
    project: 'str | None' = None,
    start: 'str | None' = None
) → ArtifactTypes
일치하는 artifact 유형 모음을 반환합니다. 매개변수:
  • project: 필터링할 프로젝트 이름 또는 경로입니다.
  • start: 이전 paginator의 .cursor 속성에서 캡처한 값으로, 이전 쿼리를 이어서 실행하기 위한 페이지네이션 커서입니다.
반환값: 반복 가능한 ArtifactTypes 객체입니다.

방법 Api.artifact_versions

artifact_versions(type_name, name, per_page=50)
사용 중단되었습니다. 대신 Api.artifacts(type_name, name) 방법을 사용하세요.

방법 Api.artifacts

artifacts(
    type_name: 'str',
    name: 'str',
    per_page: 'int' = 50,
    tags: 'list[str] | None' = None,
    start: 'str | None' = None
) → Artifacts
Artifacts 컬렉션을 반환합니다. 매개변수:
  • type_name: 가져올 artifact의 유형입니다.
  • name: artifact의 컬렉션 이름입니다. 선택적으로 artifact를 로깅한 entity를 접두사로 추가하고 그 뒤에 슬래시를 붙일 수 있습니다.
  • per_page: 쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로 이 값을 변경할 이유는 없습니다.
  • tags: 지정한 tags를 모두 가진 artifact만 반환합니다.
  • start: 이전 paginator의 .cursor 속성에서 캡처한 값으로, 이전 쿼리를 다시 이어서 실행하기 위한 페이지네이션 커서입니다.
반환값: 반복 가능한 Artifacts 객체입니다. 예시: 다음 코드 스니펫에서 “type”, “entity”, “project”, “artifact_name”은 각각 artifact 유형, W&B entity, artifact가 로깅된 프로젝트 이름, artifact 이름을 나타내는 플레이스홀더입니다.
import wandb

wandb.Api().artifacts(type_name="type", name="entity/project/artifact_name")
paginator의 .cursor를 저장해 두고 이를 start=로 전달하면, 반복을 일시 중지한 뒤 나중에 같은 위치에서 재개할 수 있습니다:
from itertools import islice

import wandb

api = wandb.Api()

# 첫 번째 페이지의 결과를 가져온 후 커서를 저장합니다.
page_size = 10
artifacts = api.artifacts(
    type_name="type",
    name="entity/project/artifact_name",
    per_page=page_size,
)
first_page = list(islice(artifacts, page_size))

saved_cursor = artifacts.cursor

# 나중에 (예: 새 프로세스에서) 저장된 커서로부터 반복을 재개합니다.
remaining_artifacts = api.artifacts(
    type_name="type",
    name="entity/project/artifact_name",
    per_page=page_size,
    start=saved_cursor,
)

방법 Api.automation

automation(name: 'str', entity: 'str | None' = None) → Automation
매개변수와 일치하는 유일한 Automation을 반환합니다. 매개변수:
  • name: 조회할 Automation의 이름입니다.
  • entity: 해당 Automation을 조회할 entity입니다.
예외:
  • ValueError: 검색 조건과 일치하는 Automation이 없거나 여러 개인 경우.
예시: “my-automation”이라는 이름의 기존 Automation 조회:
import wandb

api = wandb.Api()
automation = api.automation(name="my-automation")
entity “my-team”에서 “other-automation”이라는 이름의 기존 automation을 조회합니다:
automation = api.automation(name="other-automation", entity="my-team")

방법 Api.automations

automations(
    entity: 'str | None' = None,
    name: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[Automation]
지정된 매개변수와 일치하는 모든 Automations에 대한 이터레이터를 반환합니다. 매개변수가 제공되지 않으면 반환된 이터레이터에는 사용자가 접근할 수 있는 모든 Automations가 포함됩니다. 매개변수:
  • entity: Automations를 가져올 entity입니다.
  • name: 가져올 automation의 이름입니다.
  • per_page: 페이지당 가져올 automations의 수입니다. 기본값은 50입니다. 일반적으로 이 값을 변경할 필요는 없습니다.
  • start: 이전 paginator의 .cursor 속성에서 캡처한, 이전 쿼리를 다시 이어서 진행하기 위한 페이지네이션 커서입니다.
반환값: automations의 목록입니다. 예시: entity “my-team”의 기존 automations를 모두 가져옵니다:
import wandb

api = wandb.Api()
automations = api.automations(entity="my-team")

방법 Api.create_automation

create_automation(
    obj: 'NewAutomation',
    fetch_existing: 'bool' = False,
    **kwargs: 'Unpack[WriteAutomationsKwargs]'
) → Automation
새 Automation을 생성합니다. 인수: obj: 생성할 automation입니다. fetch_existing: True이고 충돌하는 automation이 이미 존재하는 경우, 오류를 발생시키는 대신 기존 automation을 가져오도록 시도합니다. **kwargs: 생성 전에 automation에 부여할 추가 값입니다. 제공되면 automation에 이미 설정되어 있을 수 있는 값을 재정의합니다:
  • name: automation의 이름입니다.
    • description: automation의 설명입니다.
    • enabled: automation의 활성화 여부입니다.
    • scope: automation의 범위입니다.
    • event: automation을 트리거하는 이벤트입니다.
    • action: automation에 의해 트리거되는 액션입니다.
반환값: 저장된 Automation입니다. 예시: 특정 프로젝트 내의 run이 맞춤형 임계값을 초과하는 metric을 기록할 때 Slack 알림을 보내는 “my-automation”이라는 새 automation을 생성합니다:
import wandb
from wandb.automations import OnRunMetric, RunEvent, SendNotification

api = wandb.Api()

project = api.project("my-project", entity="my-team")

# 팀의 첫 번째 Slack 인테그레이션 사용
slack_hook = next(api.slack_integrations(entity="my-team"))

event = OnRunMetric(
     scope=project,
     filter=RunEvent.metric("custom-metric") > 10,
)
action = SendNotification.from_integration(slack_hook)

automation = api.create_automation(
     event >> action,
     name="my-automation",
     description="Send a Slack message whenever 'custom-metric' exceeds 10.",
)

방법 Api.create_custom_chart

create_custom_chart(
    entity: 'str',
    name: 'str',
    display_name: 'str',
    spec_type: "Literal['vega2']",
    access: "Literal['private', 'public']",
    spec: 'str | dict'
) → str
맞춤형 차트 프리셋을 만들고 해당 ID를 반환합니다. 인수:
  • entity: 차트를 소유한 entity(사용자 또는 팀)
  • name: 차트 프리셋의 고유 식별자
  • display_name: UI에 표시되는 사람이 읽기 쉬운 이름
  • spec_type: 사양의 유형입니다. Vega-Lite v2 사양의 경우 반드시 “vega2”여야 합니다.
  • access: 차트의 액세스 수준:
    • “private”: 차트를 만든 entity만 차트에 액세스할 수 있습니다
    • “public”: 누구나 차트에 액세스할 수 있습니다
  • spec: 딕셔너리 또는 JSON 문자열 형식의 Vega/Vega-Lite 사양
반환값: 생성된 차트 프리셋의 ID입니다. 형식은 “entity/name”입니다. 예외:
  • wandb.Error: 차트 생성에 실패한 경우
  • UnsupportedError: 서버가 맞춤형 차트를 지원하지 않는 경우
예시:
    import wandb

    api = wandb.Api()

    # 단순한 막대 차트 사양 정의
    vega_spec = {
         "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
         "mark": "bar",
         "data": {"name": "wandb"},
         "encoding": {
             "x": {"field": "${field:x}", "type": "ordinal"},
             "y": {"field": "${field:y}", "type": "quantitative"},
         },
    }

    # 맞춤형 차트 생성
    chart_id = api.create_custom_chart(
         entity="my-team",
         name="my-bar-chart",
         display_name="My Custom Bar Chart",
         spec_type="vega2",
         access="private",
         spec=vega_spec,
    )

    # wandb.plot_table()과 함께 사용
    chart = wandb.plot_table(
         vega_spec_name=chart_id,
         data_table=my_table,
         fields={"x": "category", "y": "value"},
    )

방법 Api.create_project

create_project(name: 'str', entity: 'str') → None
새 프로젝트를 생성합니다. 매개변수:
  • name: 새 프로젝트의 이름입니다.
  • entity: 새 프로젝트가 속한 entity입니다.

방법 Api.create_registry

create_registry(
    name: 'str',
    visibility: "Literal['organization', 'restricted']",
    organization: 'str | None' = None,
    description: 'str | None' = None,
    artifact_types: 'list[str] | None' = None
) → Registry
새 레지스트리를 생성합니다. 매개변수:
  • name: 레지스트리 이름입니다. 이름은 조직 내에서 고유해야 합니다.
  • visibility: 레지스트리의 공개 범위입니다.
  • organization: 조직의 모든 사용자가 이 레지스트리를 볼 수 있습니다. 각 사용자의 역할은 나중에 UI의 Settings에서 수정할 수 있습니다.
  • restricted: UI를 통해 초대된 멤버만 이 레지스트리에 액세스할 수 있습니다. 공개 공유는 비활성화됩니다.
  • organization: 레지스트리가 속한 조직입니다. Settings에 조직이 설정되어 있지 않으면, entity가 하나의 조직에만 속한 경우 해당 조직을 entity에서 가져옵니다.
  • description: 레지스트리 설명입니다.
  • artifact_types: 레지스트리에서 허용하는 artifact 유형입니다. 유형은
  • 128자를 초과할 수 없고 / 또는 ``:를 포함할 수 없습니다. 지정하지 않으면 모든 유형이 허용됩니다. 레지스트리에 추가된 허용 유형은 나중에 제거할 수 없습니다.
반환값: 레지스트리 객체입니다. 예시:
import wandb

api = wandb.Api()
registry = api.create_registry(
    name="my-registry",
    visibility="restricted",
    organization="my-org",
    description="This is a test registry",
    artifact_types=["model"],
)

방법 Api.create_run

create_run(
    run_id: 'str | None' = None,
    project: 'str | None' = None,
    entity: 'str | None' = None
) → public.Run
새 run을 생성합니다. 매개변수:
  • run_id: run에 할당할 ID입니다. 지정하지 않으면 W&B가 임의의 ID를 생성합니다.
  • project: run을 기록할 프로젝트입니다. 프로젝트를 지정하지 않으면 “Uncategorized”라는 프로젝트에 run을 기록합니다.
  • entity: 프로젝트를 소유한 entity입니다. entity를 지정하지 않으면 기본 entity에 run을 기록합니다.
반환값: 새로 생성된 Run입니다.

방법 Api.create_run_queue

create_run_queue(
    name: 'str',
    type: 'public.RunQueueResourceType',
    entity: 'str | None' = None,
    prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None,
    config: 'dict | None' = None,
    template_variables: 'dict | None' = None
) → public.RunQueue
W&B Launch에서 새 run 큐를 생성합니다. 매개변수:
  • name: 생성할 큐의 이름
  • type: 큐에 사용할 리소스 유형입니다. “local-container”, “local-process”, “kubernetes”, “sagemaker”, 또는 “gcp-vertex” 중 하나입니다.
  • entity: 큐를 생성할 entity의 이름입니다. None이면 설정된 entity 또는 기본 entity를 사용합니다.
  • prioritization_mode: 사용할 우선순위 지정 버전입니다. “V0” 또는 None입니다.
  • config: 큐에 사용할 기본 리소스 설정입니다. 템플릿 변수를 지정하려면 handlebars(예: {{var}})를 사용하세요.
  • template_variables: config와 함께 사용할 템플릿 변수 스키마의 사전입니다.
반환값: 새로 생성된 RunQueue. 예외: 매개변수 중 하나라도 유효하지 않으면 ValueError, wandb API 오류가 발생하면 wandb.Error

방법 Api.create_team

create_team(team: 'str', admin_username: 'str | None' = None) → Team
새 Team을 생성합니다. 매개변수:
  • team: 팀 이름
  • admin_username: Team의 관리자 사용자 이름입니다. 기본값은 현재 사용자입니다.
반환값: Team 객체입니다.

방법 Api.create_user

create_user(email: 'str', admin: 'bool | None' = False) → User
새 사용자를 생성합니다. 매개변수:
  • email: 사용자의 이메일 주소입니다.
  • admin: 사용자를 인스턴스 전체 관리자으로 설정합니다.
반환값: User 객체입니다.

방법 Api.delete_automation

delete_automation(obj: 'Automation | str') → Literal[True]
자동화를 삭제합니다. 매개변수:
  • obj: 삭제할 자동화 또는 그 ID입니다.
반환값: 자동화가 성공적으로 삭제되면 True를 반환합니다.

방법 Api.flush

flush()
로컬 캐시를 초기화합니다. api 객체는 run의 로컬 캐시를 유지하므로, 스크립트 실행 중 run 상태가 변경될 수 있다면 run에 연결된 최신 값을 가져오기 위해 api.flush()로 로컬 캐시를 초기화해야 합니다.

방법 Api.from_path

from_path(path: 'str')
경로로부터 run, sweep, 프로젝트 또는 리포트를 반환합니다. 매개변수:
  • path: 프로젝트, run, sweep 또는 리포트의 경로
반환값: Project, Run, Sweep 또는 BetaReport 인스턴스입니다. 예외: 경로가 잘못되었거나 객체가 존재하지 않으면 wandb.Error 예외가 발생합니다. 예시: 다음 코드 스니펫에서 “project”, “team”, “run_id”, “sweep_id”, “report_name”은 각각 프로젝트, 팀, run ID, sweep ID, 특정 리포트 이름을 나타내는 플레이스홀더입니다.
import wandb

api = wandb.Api()

project = api.from_path("project")
team_project = api.from_path("team/project")
run = api.from_path("team/project/runs/run_id")
sweep = api.from_path("team/project/sweeps/sweep_id")
report = api.from_path("team/project/reports/report_name")

방법 Api.integrations

integrations(
    entity: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[Integration]
entity에 대한 모든 인테그레이션의 이터레이터를 반환합니다. 매개변수:
  • entity: 인테그레이션을 가져올 대상 entity입니다(예: 팀 이름). 제공하지 않으면 사용자의 기본 entity를 사용합니다.
  • per_page: 페이지별로 가져올 인테그레이션 수입니다. 기본값은 50입니다. 일반적으로 이 값을 변경할 필요는 없습니다.
Yields:
  • Iterator[SlackIntegration | WebhookIntegration]: 지원되는 인테그레이션의 이터레이터입니다.

방법 Api.job

job(name: 'str | None', path: 'str | None' = None) → public.Job
Job 객체를 반환합니다. 매개변수:
  • name: 작업 이름입니다.
  • path: 작업 artifact를 다운로드할 루트 경로입니다.
반환값: Job 객체입니다.

방법 Api.list_jobs

list_jobs(entity: 'str', project: 'str') → list[dict[str, Any]]
주어진 entity와 프로젝트에 대해, 해당하는 작업이 있으면 작업 목록을 반환합니다. 매개변수:
  • entity: 작업을 조회할 entity입니다.
  • project: 작업을 조회할 프로젝트입니다.
반환값: 조건에 일치하는 작업 목록입니다.

방법 Api.project

project(name: 'str', entity: 'str | None' = None) → public.Project
주어진 이름의 Project를 반환합니다(entity가 지정된 경우 해당 entity에서 반환). 매개변수:
  • name: 프로젝트 이름입니다.
  • entity: 요청한 entity의 이름입니다. None이면 Api에 전달된 기본 entity를 사용합니다. 기본 entity가 없으면 ValueError를 발생시킵니다.
반환값: Project 객체입니다.

방법 Api.projects

projects(entity: 'str | None' = None, per_page: 'int' = 200) → public.Projects
주어진 entity의 Projects를 조회합니다. 매개변수:
  • entity: 요청할 entity의 이름입니다. None이면 Api에 전달된 기본 entity를 사용합니다. 기본 entity도 없으면 ValueError가 발생합니다.
  • per_page: 쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로는 이 값을 변경할 필요가 없습니다.
반환값: 반복 가능한 컬렉션인 Projects 객체를 반환합니다. 이 객체의 각 항목은 Project 객체입니다.

방법 Api.queued_run

queued_run(
    entity: 'str',
    project: 'str',
    queue_name: 'str',
    run_queue_item_id: 'str',
    project_queue=None,
    priority=None
)
경로를 기준으로 큐에 대기 중인 단일 run을 반환합니다. entity/project/queue_id/run_queue_item_id 형식의 경로를 파싱합니다.

방법 Api.registries

registries(
    organization: 'str | None' = None,
    filter: 'dict[str, Any] | None' = None,
    per_page: 'int' = 100,
    start: 'str | None' = None
) → Registries
Registry 객체의 lazy 이터레이터를 반환합니다. 이 이터레이터를 사용하면 조직의 레지스트리 전체에서 레지스트리, 컬렉션 또는 아티팩트 버전을 검색하고 필터링할 수 있습니다. 매개변수:
  • organization: (str, 선택 사항) 가져올 레지스트리의 조직입니다. 지정하지 않으면 사용자 설정에 지정된 조직을 사용합니다.
  • filter: (dict, 선택 사항) lazy 레지스트리 이터레이터의 각 객체에 적용할 MongoDB 스타일 필터입니다. 레지스트리에 대해 필터링할 수 있는 필드는 name, description, created_at, updated_at입니다. 컬렉션에 대해 필터링할 수 있는 필드는 name, tag, description, created_at, updated_at입니다. 버전에 대해 필터링할 수 있는 필드는 tag, alias, created_at, updated_at, metadata입니다.
  • per_page: 쿼리 페이지네이션의 페이지 크기를 설정합니다.
  • start: 이전 paginator의 .cursor 속성에서 캡처한 값으로 이전 쿼리를 이어서 수행하기 위한 페이지네이션 커서입니다.
반환값: Registry 객체의 lazy 이터레이터입니다. 예시: 이름에 “model”이 포함된 모든 레지스트리 찾기
import wandb

api = wandb.Api()  # entity가 여러 org에 속한 경우 org를 지정하십시오
api.registries(filter={"name": {"$regex": "model"}})
레지스트리에서 이름이 “my_collection”이고 태그가 “my_tag”인 모든 컬렉션을 찾습니다.
api.registries().collections(filter={"name": "my_collection", "tag": "my_tag"})
“my_collection”을 포함하는 컬렉션 이름과 “best” 별칭을 가진 버전이 있는 레지스트리에서 모든 아티팩트 버전을 찾습니다.
api.registries().collections(
    filter={"name": {"$regex": "my_collection"}}
).versions(filter={"alias": "best"})
레지스트리에서 “model”을 포함하고 태그 “prod” 또는 별칭 “best”가 있는 모든 아티팩트 버전을 찾습니다
api.registries(filter={"name": {"$regex": "model"}}).versions(
    filter={"$or": [{"tag": "prod"}, {"alias": "best"}]}
)
페이지네이터의 .cursor를 저장하고 이를 start=로 전달해 반복을 일시 중지한 뒤, 나중에 같은 위치에서 재개하세요:
from itertools import islice

import wandb

api = wandb.Api()

# 첫 번째 페이지의 결과를 가져온 후 커서를 저장합니다.
page_size = 10
registries = api.registries(per_page=page_size)
first_page = list(islice(registries, page_size))

saved_cursor = registries.cursor

# 나중에 (예: 새 프로세스에서) 저장된 커서부터 반복을 재개합니다.
remaining_registries = api.registries(per_page=page_size, start=saved_cursor)

방법 Api.registry

registry(name: 'str', organization: 'str | None' = None) → Registry
레지스트리 이름으로 해당 레지스트리를 반환합니다. 매개변수:
  • name: 레지스트리 이름입니다. wandb-registry- 접두사는 포함하지 않습니다.
  • organization: 레지스트리의 조직입니다. 설정에 조직이 지정되어 있지 않으면, entity가 하나의 조직에만 속한 경우 해당 조직을 entity에서 가져옵니다.
반환값: 레지스트리 객체입니다. 예시: 레지스트리 가져오기 및 업데이트
import wandb

api = wandb.Api()
registry = api.registry(name="my-registry", organization="my-org")
registry.description = "This is an updated description"
registry.save()

방법 Api.reports

reports(
    path: 'str' = '',
    name: 'str | None' = None,
    per_page: 'int' = 50
) → public.Reports
주어진 프로젝트 경로의 리포트를 조회합니다. 참고: wandb.Api.reports() API는 베타 버전이며, 향후 릴리스에서 변경될 수 있습니다. 매개변수:
  • path: 리포트가 있는 프로젝트의 경로입니다. 프로젝트를 만든 entity를 접두사로 지정한 뒤 슬래시(/)를 붙이세요.
  • name: 요청한 리포트의 이름입니다.
  • per_page: 쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로는 이를 변경할 이유가 없습니다.
반환값: 반복 가능한 BetaReport 객체 모음인 Reports 객체입니다. 예시:
import wandb

wandb.Api.reports("entity/project")

방법 Api.run

run(path='')
entity/project/run_id 형식의 경로를 해석해 단일 run을 반환합니다. 매개변수:
  • path: entity/project/run_id 형식의 run 경로입니다. api.entity가 설정되어 있으면 project/run_id 형식도 사용할 수 있으며, api.project가 설정되어 있으면 run_id만 지정하면 됩니다.
반환값: Run 객체입니다.

방법 Api.run_queue

run_queue(entity: 'str', name: 'str')
entity의 지정된 RunQueue를 반환합니다. run 큐를 생성하는 방법에 대한 자세한 내용은 Api.create_run_queue를 참조하세요.

방법 Api.runs

runs(
    path: 'str | None' = None,
    filters: 'dict[str, Any] | None' = None,
    order: 'str' = '+created_at',
    per_page: 'int' = 50,
    include_sweeps: 'bool' = True,
    lazy: 'bool' = True
)
Run 객체를 lazy 방식으로 순회하는 Runs 객체를 반환합니다. 필터링할 수 있는 필드는 다음과 같습니다:
  • createdAt: run이 생성된 Timestamp입니다. (ISO 8601 형식, 예: “2023-01-01T12:00:00Z”)
  • displayName: 사람이 읽기 쉬운 run의 Display name입니다. (예: “eager-fox-1”)
  • duration: run의 총 실행 시간(초)입니다.
  • group: 관련 run들을 함께 구성하는 데 사용하는 그룹 이름입니다.
  • host: run이 실행된 호스트 이름입니다.
  • jobType: run의 작업 유형 또는 목적입니다.
  • name: run의 고유 식별자입니다. (예: “a1b2cdef”)
  • state: run의 현재 상태입니다.
  • tags: run에 연결된 tags입니다.
  • username: run을 시작한 사용자의 사용자 이름입니다
또한 run 설정이나 summary 메트릭의 항목으로도 필터링할 수 있습니다. 예를 들어 config.experiment_name, summary_metrics.loss 등이 있습니다. 더 복잡한 필터링이 필요하면 MongoDB 쿼리 Operator를 사용할 수 있습니다. 자세한 내용은 https://docs.mongodb.com/manual/reference/operator/query 를 참조하세요. 지원되는 오퍼레이션은 다음과 같습니다:
  • $and
  • $or
  • $nor
  • $eq
  • $ne
  • $gt
  • $gte
  • $lt
  • $lte
  • $in
  • $nin
  • $exists
  • $regex
매개변수:
  • path: (str) 프로젝트 경로로, “entity/project” 형식이어야 합니다.
  • filters: (dict) MongoDB 쿼리 언어를 사용해 특정 run을 쿼리합니다. config.key, summary_metrics.key, state, entity, createdAt 등의 run 속성으로 필터링할 수 있습니다.
  • For example: {"config.experiment_name": "foo"} 는 실험 이름이 “foo”로 설정된 설정 항목이 있는 run을 찾습니다
  • order: (str) 정렬 기준으로 created_at, heartbeat_at, config.*.value, 또는 summary_metrics.*를 사용할 수 있습니다. 앞에 +를 붙이면 오름차순(기본값)입니다. 앞에 -를 붙이면 내림차순입니다. 기본 정렬은 가장 오래된 것부터 최신순까지의 run.created_at입니다.
  • per_page: (int) 쿼리 페이지네이션의 페이지 크기를 설정합니다.
  • include_sweeps: (bool) 결과에 sweep run을 포함할지 여부입니다.
  • lazy: (bool) 더 빠른 성능을 위해 lazy 로딩을 사용할지 여부입니다. True(기본값)인 경우 처음에는 필수 run 메타데이터만 로드됩니다. config, summaryMetrics, systemMetrics 같은 큰 필드는 접근 시 필요에 따라 로드됩니다. 전체 데이터를 처음부터 로드하려면 False로 설정하세요.
반환값: Run 객체를 순회할 수 있는 컬렉션인 Runs 객체입니다. 예시:
import wandb
from wandb.apis.public import Api

# 프로젝트에서 config.experiment_name이 "foo"로 설정된 run 찾기
Api.runs(path="my_entity/project", filters={"config.experiment_name": "foo"})
# config.experiment_name이 "foo" 또는 "bar"로 설정된 프로젝트의 run 찾기
Api.runs(
    path="my_entity/project",
    filters={
         "$or": [
             {"config.experiment_name": "foo"},
             {"config.experiment_name": "bar"},
         ]
    },
)
# 프로젝트에서 config.experiment_name이 정규식과 일치하는 run 찾기
# (앵커는 지원되지 않음)
Api.runs(
    path="my_entity/project",
    filters={"config.experiment_name": {"$regex": "b.*"}},
)
# 프로젝트에서 run 이름이 정규식과 일치하는 run 찾기
# (앵커는 지원되지 않음)
Api.runs(
    path="my_entity/project", filters={"display_name": {"$regex": "^foo.*"}}
)
# 오름차순 loss로 정렬된 프로젝트의 runs 찾기
Api.runs(path="my_entity/project", order="+summary_metrics.loss")

방법 Api.slack_integrations

slack_integrations(
    entity: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[SlackIntegration]
entity에 대한 Slack 인테그레이션 이터레이터를 반환합니다. 매개변수:
  • entity: 인테그레이션을 조회할 대상 entity(예: 팀 이름)입니다. 지정하지 않으면 사용자의 기본 entity가 사용됩니다.
  • per_page: 페이지당 조회할 인테그레이션 수입니다. 기본값은 50입니다. 일반적으로 이 값을 변경할 필요는 없습니다.
Yields:
  • Iterator[SlackIntegration]: Slack 인테그레이션 이터레이터입니다.
예제: 팀 “my-team”에 등록된 모든 Slack 인테그레이션을 조회합니다:
import wandb

api = wandb.Api()
slack_integrations = api.slack_integrations(entity="my-team")
“team-alerts-”로 시작하는 이름의 채널에 게시하는 Slack 인테그레이션만 찾습니다:
slack_integrations = api.slack_integrations(entity="my-team")
team_alert_integrations = [
    ig
    for ig in slack_integrations
    if ig.channel_name.startswith("team-alerts-")
]

방법 Api.sweep

sweep(path='')
entity/project/sweep_id 형식의 경로를 파싱해 스윕을 반환합니다. 매개변수:
  • path: entity/project/sweep_id 형식의 스윕 경로입니다. api.entity가 설정되어 있으면 project/sweep_id 형식을 사용할 수 있고, api.project가 설정되어 있으면 sweep_id만 사용하면 됩니다.
반환값: Sweep 객체입니다.

방법 Api.sync_tensorboard

sync_tensorboard(root_dir, run_id=None, project=None, entity=None)
tfevent 파일이 포함된 로컬 디렉터리를 wandb로 동기화합니다.

방법 Api.team

team(team: 'str') → Team
지정한 이름과 일치하는 Team을 반환합니다. 매개변수:
  • team: Team 이름입니다.
반환값: Team 객체입니다.

방법 Api.update_automation

update_automation(
    obj: 'Automation',
    create_missing: 'bool' = False,
    **kwargs: 'Unpack[WriteAutomationsKwargs]'
) → Automation
기존 자동화를 업데이트합니다. 매개변수:
  • obj: 업데이트할 자동화입니다. 기존에 존재하는 자동화여야 합니다. create_missing (bool): True이고 자동화가 존재하지 않으면 생성합니다. **kwargs: 업데이트하기 전에 자동화에 할당할 추가 값입니다. 지정하면 자동화에 이미 설정된 값을 덮어씁니다:
    • name: 자동화의 이름입니다.
    • description: 자동화의 설명입니다.
    • enabled: 자동화의 활성화 여부입니다.
    • scope: 자동화의 범위입니다.
    • event: 자동화를 트리거하는 이벤트입니다.
    • action: 자동화에 의해 트리거되는 작업입니다.
반환값: 업데이트된 자동화입니다. 예시: 기존 자동화(“my-automation”)를 비활성화하고 설명을 수정합니다:
import wandb

api = wandb.Api()

automation = api.automation(name="my-automation")
automation.enabled = False
automation.description = "레퍼런스용으로 보관하지만 더 이상 사용하지 않습니다."

updated_automation = api.update_automation(automation)
또는
import wandb

api = wandb.Api()

automation = api.automation(name="my-automation")

updated_automation = api.update_automation(
    automation,
    enabled=False,
    description="Kept for reference, but no longer used.",
)

방법 Api.upsert_run_queue

upsert_run_queue(
    name: 'str',
    resource_config: 'dict',
    resource_type: 'public.RunQueueResourceType',
    entity: 'str | None' = None,
    template_variables: 'dict | None' = None,
    external_links: 'dict | None' = None,
    prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None
)
W&B Launch에서 run 큐를 생성하거나 업데이트합니다. 매개변수:
  • name: 생성할 큐의 이름
  • entity: 큐를 생성할 entity의 이름(선택 사항)입니다. None이면 설정된 entity 또는 기본 entity를 사용합니다.
  • resource_config: 큐에 사용할 기본 리소스 설정(선택 사항)입니다. 템플릿 변수를 지정하려면 handlebars(예: {{var}})를 사용합니다.
  • resource_type: 큐에 사용할 리소스의 유형입니다. “local-container”, “local-process”, “kubernetes”, “sagemaker”, 또는 “gcp-vertex” 중 하나입니다.
  • template_variables: 설정과 함께 사용할 템플릿 변수 스키마의 사전입니다.
  • external_links: 큐와 함께 사용할 외부 링크의 사전(선택 사항)입니다.
  • prioritization_mode: 사용할 우선순위 지정 버전(선택 사항)입니다. “V0” 또는 None입니다.
반환값: 생성되거나 업데이트된 RunQueue. 예외: 매개변수 중 하나라도 올바르지 않으면 ValueError가 발생합니다. wandb API 오류가 발생하면 wandb.Error가 발생합니다.

방법 Api.user

user(username_or_email: 'str') → User | None
사용자 이름 또는 이메일 주소로 사용자를 조회합니다. 이 함수는 로컬 관리자만 사용할 수 있습니다. 자신의 사용자 객체를 가져오려면 api.viewer를 사용하세요. 매개변수:
  • username_or_email: 사용자의 사용자 이름 또는 이메일 주소입니다.
반환값: 사용자를 찾으면 User 객체를, 찾지 못하면 None을 반환합니다.

방법 Api.users

users(username_or_email: 'str') → list[User]
사용자 이름 또는 이메일 주소의 일부를 쿼리해 일치하는 모든 사용자를 반환합니다. 이 함수는 로컬 관리자만 사용할 수 있습니다. 자신의 사용자 객체를 가져오려면 api.viewer를 사용하세요. 매개변수:
  • username_or_email: 찾으려는 사용자의 접두사 또는 접미사입니다.
반환값: User 객체 배열입니다.

방법 Api.webhook_integrations

webhook_integrations(
    entity: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[WebhookIntegration]
entity에 대한 웹훅 인테그레이션 이터레이터를 반환합니다. 매개변수:
  • entity: 인테그레이션을 가져올 대상 entity(예: 팀 이름)입니다. 지정하지 않으면 사용자의 기본 entity가 사용됩니다.
  • per_page: 페이지당 가져올 인테그레이션 수입니다. 기본값은 50입니다. 일반적으로 이 값을 변경할 이유는 없습니다.
Yields:
  • Iterator[WebhookIntegration]: 웹훅 인테그레이션 이터레이터입니다.
예제: 팀 “my-team”에 등록된 모든 웹훅 인테그레이션을 조회합니다:
import wandb

api = wandb.Api()
webhook_integrations = api.webhook_integrations(entity="my-team")
https://my-fake-url.com”로 요청을 전송하는 웹훅 인테그레이션만 찾습니다:
webhook_integrations = api.webhook_integrations(entity="my-team")
my_webhooks = [
    ig
    for ig in webhook_integrations
    if ig.url_endpoint.startswith("https://my-fake-url.com")
]