Move loaded_options to util

Doesn't seem to work with python 3.6
This commit is contained in:
James Betker 2020-10-03 20:29:06 -06:00
parent 2d8e9a9d30
commit fc396baf1a
3 changed files with 2 additions and 4 deletions

View File

@ -5,8 +5,6 @@ import yaml
from utils.util import OrderedYaml from utils.util import OrderedYaml
Loader, Dumper = OrderedYaml() Loader, Dumper = OrderedYaml()
loaded_options = None
def parse(opt_path, is_train=True): def parse(opt_path, is_train=True):
with open(opt_path, mode='r') as f: with open(opt_path, mode='r') as f:
opt = yaml.load(f, Loader=Loader) opt = yaml.load(f, Loader=Loader)

View File

@ -127,7 +127,7 @@ def main():
# torch.autograd.set_detect_anomaly(True) # torch.autograd.set_detect_anomaly(True)
# Save the compiled opt dict to the global loaded_options variable. # Save the compiled opt dict to the global loaded_options variable.
option.loaded_options = opt util.loaded_options = opt
#### create train and val dataloader #### create train and val dataloader
dataset_ratio = 1 # enlarge the size of each epoch dataset_ratio = 1 # enlarge the size of each epoch

View File

@ -14,7 +14,6 @@ from torchvision.utils import make_grid
from shutil import get_terminal_size from shutil import get_terminal_size
import scp import scp
import paramiko import paramiko
from options.options import loaded_options
from torch.utils.checkpoint import checkpoint from torch.utils.checkpoint import checkpoint
import yaml import yaml
@ -23,6 +22,7 @@ try:
except ImportError: except ImportError:
from yaml import Loader, Dumper from yaml import Loader, Dumper
loaded_options = None
def OrderedYaml(): def OrderedYaml():
'''yaml orderedDict support''' '''yaml orderedDict support'''