API 치트 시트 — Run·로깅·쿼리

API 치트 시트 — Run·로깅·쿼리

자주 쓰는 네튠 동작을 한눈에 정리한 치트 시트예요. 프로젝트 생성부터 런 로깅·쿼리까지의 패턴을 보겠습니다.

출처: https://docs.neptune.ai/api_cheat_sheet

프로젝트 생성

from neptune_scale.projects import create_project

create_project(
    name="project-x",
    workspace="team-alpha",          # 이미 존재해야 하는 워크스페이스
    visibility="workspace",          # 기본은 private
    description="Team-wide sandbox project",
)

런 만들기와 컨피그 로깅

런은 실험의 단위예요. 컨피그(하이퍼파라미터)를 로깅하고 태그를 달아 분류합니다.

from neptune_scale import Run

run = Run(...)

# 단일 값 로깅
run.log_configs({
    "use_preprocessing": True,
    "learning_rate": 0.001,
    "optimizer": "Adam",
})

# 태그 추가
run.add_tags(tags=["tag1", "tag2", "tag3"])

네임스페이스 아래에 중첩하면 폴더처럼 정리돼요.

메트릭 시리즈 로깅

# 스텝당 하나의 메트릭
run.log_metrics(data={"metrics/loss": 0.14}, step=1)

# 스텝당 여러 메트릭
run.log_metrics(data={"metrics/loss": 0.12, "metrics/acc": 0.95}, step=2)

쿼리

neptune_query로 실험 테이블을 가져올 수 있어요.

import neptune_query as nq
from neptune_query import Filter

lr_filter = Filter.eq("config/learning_rate", 0.001)
nq.fetch_experiments_table(experiments=lr_filter, attributes=r"metrics/train/")

더 알아보기

  • https://docs.neptune.ai/quickstart — 빠른 시작
  • https://docs.neptune.ai/logging/methods — 로깅 메서드