From fc396baf1aac35f096a0fb0f49ed1da3bef39e45 Mon Sep 17 00:00:00 2001 From: James Betker Date: Sat, 3 Oct 2020 20:29:06 -0600 Subject: [PATCH] Move loaded_options to util Doesn't seem to work with python 3.6 --- codes/options/options.py | 2 -- codes/train.py | 2 +- codes/utils/util.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/codes/options/options.py b/codes/options/options.py index be42de2f..bead66c4 100644 --- a/codes/options/options.py +++ b/codes/options/options.py @@ -5,8 +5,6 @@ import yaml from utils.util import OrderedYaml Loader, Dumper = OrderedYaml() -loaded_options = None - def parse(opt_path, is_train=True): with open(opt_path, mode='r') as f: opt = yaml.load(f, Loader=Loader) diff --git a/codes/train.py b/codes/train.py index 6c390eb9..e61abe71 100644 --- a/codes/train.py +++ b/codes/train.py @@ -127,7 +127,7 @@ def main(): # torch.autograd.set_detect_anomaly(True) # Save the compiled opt dict to the global loaded_options variable. - option.loaded_options = opt + util.loaded_options = opt #### create train and val dataloader dataset_ratio = 1 # enlarge the size of each epoch diff --git a/codes/utils/util.py b/codes/utils/util.py index 1f2f82d1..2dd3378f 100644 --- a/codes/utils/util.py +++ b/codes/utils/util.py @@ -14,7 +14,6 @@ from torchvision.utils import make_grid from shutil import get_terminal_size import scp import paramiko -from options.options import loaded_options from torch.utils.checkpoint import checkpoint import yaml @@ -23,6 +22,7 @@ try: except ImportError: from yaml import Loader, Dumper +loaded_options = None def OrderedYaml(): '''yaml orderedDict support'''