def test_main():
    config = json.load(open('config.json', 'r'))
    config["output_path"] += "{:%Y-%m-%d_%H:%M}/".format(
        datetime.datetime.now())
    config['is_file_saved'] = False
    config['portrait_dir'] = "./data/person_image_dataset/96x64_one/"
    config['batch_size'] = 1
    config['train_data_num'] = 1
    config['test_data_num'] = 1

    t = Trainer(**config)
    t.optimize()
    assert 1 == 1
import datetime
import json
import os

from modules.trainer import Trainer
from utils.argument_handler import argment_handler

if __name__ == "__main__":
    args = argment_handler()

    config = json.load(open(args.config_file, 'r'))
    config["output_path"] += "{:%Y-%m-%d_%H:%M}/".format(
        datetime.datetime.now())
    config['is_file_saved'] = not args.no_write

    if config['is_file_saved']:
        os.mkdir(config["output_path"])
        json.dump(config,
                  open(config["output_path"] + 'config.json', 'w'),
                  indent=4)

    t = Trainer(**config)
    t.optimize()