From aba47f0a356cd185a704c84469489bc26ea227df Mon Sep 17 00:00:00 2001 From: Luca Antiga Date: Thu, 5 Jan 2023 09:09:22 +0100 Subject: [PATCH 1/2] Make wandb import conditioned to wandb_log=True --- README.md | 1 - train.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92206ca..6a1c1bf 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ Dependencies: - `pip install tiktoken` for OpenAI's fast BPE code <3 - `pip install wandb` for optional logging <3 - `pip install tqdm` -- `pip install networkx` ## usage diff --git a/train.py b/train.py index ed346db..2e9379f 100644 --- a/train.py +++ b/train.py @@ -13,7 +13,6 @@ import os import time import math -import wandb import numpy as np import torch from torch.nn.parallel import DistributedDataParallel as DDP @@ -75,6 +74,9 @@ if gpu_id == 0: torch.manual_seed(1337 + gpu_id) # note: each worker gets a different seed torch.backends.cuda.matmul.allow_tf32 = True # allow tf32 on matmul torch.backends.cudnn.allow_tf32 = True # allow tf32 on cudnn +# import wandb conditionally +if wandb_log: + import wandb # poor man's data loader, TODO evaluate need for actual DataLoader data_dir = os.path.join('data', dataset) From 09f1f458e8a5e381d2357a7391bb6eb51d7122a5 Mon Sep 17 00:00:00 2001 From: Luca Antiga Date: Sun, 8 Jan 2023 15:51:50 +0100 Subject: [PATCH 2/2] Move conditional import --- train.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/train.py b/train.py index 2e9379f..5db73a8 100644 --- a/train.py +++ b/train.py @@ -74,9 +74,6 @@ if gpu_id == 0: torch.manual_seed(1337 + gpu_id) # note: each worker gets a different seed torch.backends.cuda.matmul.allow_tf32 = True # allow tf32 on matmul torch.backends.cudnn.allow_tf32 = True # allow tf32 on cudnn -# import wandb conditionally -if wandb_log: - import wandb # poor man's data loader, TODO evaluate need for actual DataLoader data_dir = os.path.join('data', dataset) @@ -182,6 +179,7 @@ def get_lr(iter): # logging if wandb_log and gpu_id == 0: + import wandb wandb.init(project=wandb_project, name=wandb_run_name) wandb.config = { "batch_size": batch_size,