예제 #1
0
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    run_script = os.path.relpath(__file__, os.getcwd())
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str,
                                                   run_script=run_script,
                                                   start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    if hasattr(myargs.config, 'datasets'):
        prepare_dataset(myargs.config.datasets, cfg=myargs.config)

    args = default_argument_parser().parse_args(args=[])
    args = config2args(myargs.config.args, args)

    args.opts += ['OUTPUT_DIR', args1.outdir + '/detectron2']
    print("Command Line Args:", args)

    myargs = D2Utils.unset_myargs_for_multiple_processing(
        myargs, num_gpus=args.num_gpus)

    launch(
        main,
        args.num_gpus,
        num_machines=args.num_machines,
        machine_rank=args.machine_rank,
        dist_url=args.dist_url,
        args=(args, myargs),
    )
예제 #2
0
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    from template_lib.utils.modelarts_utils import prepare_dataset
    run_script = os.path.relpath(__file__, os.getcwd())
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str,
                                                   run_script=run_script,
                                                   start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    if hasattr(myargs.config, 'datasets'):
        prepare_dataset(myargs.config.datasets, cfg=myargs.config)

    helper = Helper(save_dir=os.path.join(myargs.args.outdir, 'robust_darts'),
                    args_list=[])
    args = helper.config
    args = config2args(myargs.config.args, args)
    if args.drop_path_prob == 0:
        args.cutout = False

    log_format = '%(asctime)s %(message)s'
    # logging.basicConfig()
    logging.basicConfig(level=logging.INFO,
                        format=log_format,
                        datefmt='%m/%d %I:%M:%S %p')
    logging.getLogger().handlers = myargs.logger.handlers
    # for handler in myargs.logger.handlers:
    #   logging.getLogger().addHandler(handler)

    space = spaces_dict[args.space]
    main(space, args=args, helper=helper, myargs=myargs)
예제 #3
0
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    from template_lib.utils.modelarts_utils import prepare_dataset
    run_script = os.path.relpath(__file__, os.getcwd())
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str,
                                                   run_script=run_script,
                                                   start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    if hasattr(myargs.config, 'datasets'):
        prepare_dataset(myargs.config.datasets, cfg=myargs.config)

    parser = build_parser()
    args = parser.parse_args([])
    args = config2args(myargs.config.args, args)

    outdir = os.path.join(myargs.args.outdir, 'NAO')
    os.makedirs(outdir, exist_ok=True)
    args.output_dir = outdir

    log_format = '%(asctime)s %(message)s'
    logging.basicConfig(stream=sys.stdout,
                        level=logging.INFO,
                        format=log_format,
                        datefmt='%m/%d %I:%M:%S %p')

    main(args, myargs)
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    from template_lib.utils.modelarts_utils import prepare_dataset
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str, start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    prepare_dataset(myargs.config.dataset)
    main(myargs)
예제 #5
0
def run(argv_str=None):
  from template_lib.utils.config import parse_args_and_setup_myargs, config2args
  from template_lib.utils.modelarts_utils import prepare_dataset
  run_script = os.path.relpath(__file__, os.getcwd())
  args1, myargs, _ = parse_args_and_setup_myargs(argv_str, run_script=run_script, start_tb=False)
  myargs.args = args1
  myargs.config = getattr(myargs.config, args1.command)

  prepare_dataset(myargs.config.dataset)
  main(myargs)
예제 #6
0
def run(argv_str=None):
  from template_lib.utils.config import parse_args_and_setup_myargs, config2args
  from template_lib.utils.modelarts_utils import prepare_dataset
  run_script = os.path.relpath(__file__, os.getcwd())
  args1, myargs, _ = parse_args_and_setup_myargs(argv_str, run_script=run_script, start_tb=False)
  myargs.args = args1
  myargs.config = getattr(myargs.config, args1.command)

  if hasattr(myargs.config, 'datasets'):
    prepare_dataset(myargs.config.datasets, cfg=myargs.config)

  args = parser.parse_args([])
  args = config2args(myargs.config.args, args)

  args.path = os.path.join(myargs.args.outdir, args.path)
  main(args, myargs)
예제 #7
0
def run(argv_str=None, return_args=False):
  from template_lib.utils.config import parse_args_and_setup_myargs, config2args
  from template_lib.utils import parser_set_default
  from template_lib.utils.modelarts_utils import prepare_dataset
  run_script = os.path.relpath(__file__, os.getcwd())
  args1, myargs, _ = parse_args_and_setup_myargs(argv_str, run_script=run_script, start_tb=False)
  myargs.args = args1
  myargs.config = getattr(myargs.config, args1.command)

  if return_args:
    return args1, myargs

  if hasattr(myargs.config, 'datasets'):
    prepare_dataset(myargs.config.datasets, cfg=myargs.config)

  # main(myargs)
  return args1, myargs
예제 #8
0
def run(argv_str=None):
  from template_lib.utils.config import parse_args_and_setup_myargs, config2args
  from template_lib.utils.modelarts_utils import prepare_dataset
  run_script = os.path.relpath(__file__, os.getcwd())
  args1, myargs, _ = parse_args_and_setup_myargs(argv_str, run_script=run_script, start_tb=False)
  myargs.args = args1
  myargs.config = getattr(myargs.config, args1.command)

  if hasattr(myargs.config, 'datasets'):
    prepare_dataset(myargs.config.datasets, cfg=myargs.config)

  opt = TestOptions().parse(print_options=False)

  opt = config2args(myargs.config.args, opt)

  main(opt, myargs)
  pass
예제 #9
0
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    from template_lib.utils.modelarts_utils import prepare_dataset
    run_script = os.path.relpath(__file__, os.getcwd())
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str,
                                                   run_script=run_script,
                                                   start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    if hasattr(myargs.config, 'datasets'):
        prepare_dataset(myargs.config.datasets, cfg=myargs.config)

    parser = build_parser()
    args = parser.parse_args()
    if args.rand_seed is None or args.rand_seed < 0:
        args.rand_seed = random.randint(1, 100000)

    args = config2args(config=myargs.config.args, args=args)
    args.save_dir = os.path.join(args1.outdir, '201')
    main(args, myargs)
예제 #10
0
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    from template_lib.utils.modelarts_utils import prepare_dataset
    run_script = os.path.relpath(__file__, os.getcwd())
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str,
                                                   run_script=run_script,
                                                   start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    if hasattr(myargs.config, 'datasets'):
        prepare_dataset(myargs.config.datasets, cfg=myargs.config)

    parser = argparse.ArgumentParser()
    parser.add_argument('--out', type=str)
    parser.add_argument('--n_worker', type=int, default=8)
    parser.add_argument('--path', type=str)
    args = parser.parse_args([])
    args = config2args(myargs.config.args, args)

    main(args, myargs)
예제 #11
0
def run(argv_str=None):
    from template_lib.utils.config import parse_args_and_setup_myargs, config2args
    from template_lib.utils.modelarts_utils import prepare_dataset
    run_script = os.path.relpath(__file__, os.getcwd())
    args1, myargs, _ = parse_args_and_setup_myargs(argv_str,
                                                   run_script=run_script,
                                                   start_tb=False)
    myargs.args = args1
    myargs.config = getattr(myargs.config, args1.command)

    if hasattr(myargs.config, 'datasets'):
        prepare_dataset(myargs.config.datasets, cfg=myargs.config)

    parser = argparse.ArgumentParser(description='Progressive Growing of GANs')

    parser.add_argument('--path', type=str, help='path of specified dataset')
    parser.add_argument(
        '--phase',
        type=int,
        default=600_000,
        help='number of samples used for each training phases',
    )
    parser.add_argument('--lr',
                        default=0.001,
                        type=float,
                        help='learning rate')
    parser.add_argument('--sched',
                        action='store_true',
                        help='use lr scheduling')
    parser.add_argument('--init_size',
                        default=8,
                        type=int,
                        help='initial image size')
    parser.add_argument('--max_size',
                        default=1024,
                        type=int,
                        help='max image size')
    parser.add_argument('--ckpt',
                        default=None,
                        type=str,
                        help='load from previous checkpoints')
    parser.add_argument(
        '--no_from_rgb_activate',
        action='store_true',
        help='use activate in from_rgb (original implementation)',
    )
    parser.add_argument('--mixing',
                        action='store_true',
                        help='use mixing regularization')
    parser.add_argument(
        '--loss',
        type=str,
        default='wgan-gp',
        choices=['wgan-gp', 'r1'],
        help='class of gan loss',
    )

    args = parser.parse_args([])
    args = config2args(myargs.config.args, args)

    main(args, myargs)