From 5c088b9a477a48e3d5421c3f73835151bd24f002 Mon Sep 17 00:00:00 2001 From: Andrew Zhao Date: Sat, 5 Dec 2020 12:31:28 +0800 Subject: [PATCH] fixed logging --- moco/main.py | 3 ++- simsiam/main.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/moco/main.py b/moco/main.py index d55c56f..69512a0 100644 --- a/moco/main.py +++ b/moco/main.py @@ -12,6 +12,7 @@ import argparse from tqdm import tqdm from pathlib import Path +from datetime import datetime from warnings import simplefilter from moco.model import MoCo @@ -85,7 +86,7 @@ scheduler = torch.optim.lr_scheduler.MultiplicativeLR(optimizer, lambda epoch: 0.1 if epoch in (120, 160) else 1) memo_bank = MemoryBank(f_k, device, momentum_loader, args.K) - writer = SummaryWriter(args.logs_root) + writer = SummaryWriter(args.logs_root + f'/{int(datetime.now().timestamp()*1e6)}') pbar = tqdm(range(args.epochs)) for epoch in pbar: diff --git a/simsiam/main.py b/simsiam/main.py index f34085d..cc15ee3 100644 --- a/simsiam/main.py +++ b/simsiam/main.py @@ -13,6 +13,7 @@ from tqdm import tqdm from pathlib import Path from warnings import simplefilter +from datetime import datetime from simsiam.model import SimSiam from simsiam.data import GaussianBlur, CIFAR10Pairs @@ -72,7 +73,7 @@ test_data = CIFAR10(root=args.data_root, train=False, transform=test_transform, download=True) test_loader = DataLoader(test_data, batch_size=args.batch_size, shuffle=False, num_workers=28) - writer = SummaryWriter(args.logs_root) + writer = SummaryWriter(args.logs_root + f'/{int(datetime.now().timestamp()*1e6)}') model = torch.nn.DataParallel(SimSiam(args), device_ids=args.device_ids).to(device) Path('/'.join(args.check_point.split('/')[:-1])).mkdir(parents=True, exist_ok=True) Path(args.logs_root).mkdir(parents=True, exist_ok=True)