-
Notifications
You must be signed in to change notification settings - Fork 1
wandb 사용법
Jisun Kim edited this page Nov 12, 2021
·
1 revision
-
wandb 설치 & import
!pip install wandb import wandb wandb.login() // key 입력: c443e51764d5d28b0537672fa85ae1481065de47
-
wandb init
wandb.init(project = "kor_trocr", entity = "zzisun")
project: 생성한 프로젝트명
entity: 계정 username
config: saving inputs to your job, like hyperparameters for a model or settings for a data preprocessing job
-
wandb watch
gradient, topology 값들을 visualization
wandb.watch(net, fn_loss, log="all", log_freq=10)
• models: 모델
• criterions: loss function
• log: "gradients", "parameters", "all", all이라고 설정하면, gradient, parameters와 관련된 값들을 visualization
-
wandb.log
visualization하고 싶은 argument를 넘겨준다.
wandb.log({'accuracy': 0.9, 'epoch': 5}) wandb.log({'loss': 0.2}, commit=False) # Somewhere else when I'm ready to report this step: wandb.log({'accuracy': 0.8})
-
wandb.sweep
hyper parameter 조합을 자동으로 실행 후 어떤 parameter가 중요한지 보여준다
-
Initialize the sweep
Sweep의 구성요소를 정의하고, 프로젝트에서 사용하기 위해 Sweep API로 초기화
-
Run the sweep agent
-
# this line initializes the sweep
sweep_id = wandb.sweep({'name': 'my-awesome-sweep',
'metric': {'name': 'accuracy', 'goal': 'maximize'},
'method': 'grid',
'parameters': {'a': {'values': [1, 2, 3, 4]}}})
# this line actually runs it -- parameters are available to
# my_train_func via wandb.config
wandb.agent(sweep_id, function=my_train_func)