def test_train(): with tempfile.TemporaryDirectory() as tmp_dir: train_config = train.TrainConfig( train_image_dir_path=(Path(__file__).parent / 'dammy_image_data').resolve(), max_iter=2, batch_size=5, snapshot_iter_interval=2, display_iter_interval=1, n_discriminator_update=3, evaluation_iter_interval=1) model_config = ModelConfig(width=64, height=64, n_units_xyrz=10, n_hidden_units=[10, 10], z_size=2) train.train(Path(tmp_dir), train_config, model_config)
if not argslist.use_lstm: argslist.history_length = 1 os.environ['CUDA_VISIBLE_DEVICES'] = '1' params = ["reward_type", "history_length", "shared_lstm", "batch_size", "num_task", "train_data_name", "buffer_size", "max_episode_len", "save_rate", "gamma", "num_units"] save_path = "policy" dict_arg = vars(argslist) for param in params: save_path = save_path + "_" + param + "_" + str(dict_arg[param]) save_path += "_UAVnumber_" + str(FLAGS.num_uav) + "_size_map_" + str(FLAGS.size_map) + "_radius_" + str(FLAGS.radius) argslist.save_dir = argslist.save_dir + save_path + "_debug/" print(argslist.save_dir) # train if argslist.train: train(argslist) if argslist.transfer_train: transfer_train(argslist, 300) # train test if argslist.train_test: argslist.draw_picture_test = True if argslist.mp: train_multi_process_test(argslist) else: train_test(argslist, int(396/argslist.save_rate)) # transfer test if argslist.transfer_test: argslist.draw_picture_test = True