본문 바로가기

WandB

WandB를 이용한 인공지능모델 학습 모니터링 및 로깅

WandB란

Build better models faster with experiment tracking, dataset versioning, and model management

라고 홈페이지에 소개가 되어있다.

간단하게 해석하자면 실험 추적, 데이터 세트 버전 관리 및 모델 관리를 통해 더 나은 모델을 더 빠르게 구축할 수 있게 도와주는 MLOps 플랫폼이다.

본문에서는 wandb를 이용해 logging을 하고 report로 output한 결과를 간단하게 보여준다.

 

WandB log

우선, pip로 wandb를 설치한다.

 

pip install wandb

 

두번째로, wandb를 import 및 initialize 한다

 

import wandb
wandb.init(project="your_project_name", entity="your_wandb_username")
wandb.config = {
 "learning_rate": lr,
 "epochs": num_epochs,
 "batch_size": batch_size
}

#If you want to specify the run name, use code below.
#wandb.run.name = 'name'
 
마지막으로 wandb.log 메소드를 이용해 loss를 dictionary로 올려버린다.
 
loss_dict = model(images, target)
wandb.log(loss_dict)
 
그럼 끝
 

 

WandB reports

실험한 내용을 가지고 report를 작성할 수 있는데, 일반 문서 작성하듯이 작성하되 실험한 내용 및 그래프를 그대로 가져와서 만들 수 있다는 것이 매우 장점인듯 싶다. 특히 예시중에 논문을 report기능을 통해 작성한 것을 봤는데, 굉장히 깔끔해 보였다. 내가 작성한 report도 가져와봤다.

 

https://wandb.ai/engui/segmentation/reports/-Semantic-segmentation-WandB-test--VmlldzoxOTM3NzE5?accessToken=6b52zmkur1nq2oxyuots67g7jszvw3zkj3q7kynkpk8w3hi54twljrjotchl23z1