Douzero_Resnet/douzero/dmc/arguments.py

78 lines
4.2 KiB
Python

import argparse
parser = argparse.ArgumentParser(description='DouZero: PyTorch DouDizhu AI')
# General Settings
parser.add_argument('--xpid', default='douzero',
help='Experiment id (default: douzero)')
parser.add_argument('--save_interval', default=30, type=int,
help='Time interval (in minutes) at which to save the model')
parser.add_argument('--objective', default='adp', type=str, choices=['adp', 'wp', 'logadp'],
help='Use ADP or WP as reward (default: ADP)')
# Training settings
parser.add_argument('--onnx_sync_interval', default=120, type=int,
help='Time interval (in seconds) at which to sync the onnx model')
parser.add_argument('--gpu_devices', default='0', type=str,
help='Which GPUs to be used for training')
parser.add_argument('--infer_devices', default='0', type=str,
help='Which device to be used for infer')
parser.add_argument('--num_infer', default=2, type=int,
help='The number of process used for infer')
parser.add_argument('--num_actor_devices', default=1, type=int,
help='The number of devices used for simulation')
parser.add_argument('--num_actors', default=3, type=int,
help='The number of actors for each simulation device')
parser.add_argument('--num_actors_thread', default=4, type=int,
help='The number of actors for each simulation device')
parser.add_argument('--training_device', default='0', type=str,
help='The index of the GPU used for training models. `cpu` means using cpu')
parser.add_argument('--load_model', action='store_true',
help='Load an existing model')
parser.add_argument('--old_model', action='store_true',
help='Use vanilla model')
parser.add_argument('--unified_model', action='store_true',
help='Use unified model')
parser.add_argument('--lite_model', action='store_true',
help='Use lite card model')
parser.add_argument('--lagacy_model', action='store_true',
help='Use lagacy bomb model')
parser.add_argument('--disable_checkpoint', action='store_true',
help='Disable saving checkpoint')
parser.add_argument('--savedir', default='douzero_checkpoints',
help='Root dir where experiment data will be saved')
parser.add_argument('--enable_onnx', action='store_true',
help='Use onnx model for train')
parser.add_argument('--onnx_model_path', default='douzero_checkpoints',
help='Root dir where onnx temp model will be saved')
parser.add_argument('--enable_upload', action='store_true',
help='Should the cpkt model will be upload to server')
parser.add_argument('--upload_url', default='https://dou.zaneyork.cn:8443/model/upload',
help='The cpkt model will be upload to')
# Hyperparameters
parser.add_argument('--total_frames', default=100000000000, type=int,
help='Total environment frames to train for')
parser.add_argument('--exp_epsilon', default=0.01, type=float,
help='The probability for exploration')
parser.add_argument('--batch_size', default=16, type=int,
help='Learner batch size')
parser.add_argument('--unroll_length', default=100, type=int,
help='The unroll length (time dimension)')
parser.add_argument('--num_buffers', default=50, type=int,
help='Number of shared-memory buffers')
parser.add_argument('--num_threads', default=1, type=int,
help='Number learner threads')
parser.add_argument('--max_grad_norm', default=40., type=float,
help='Max norm of gradients')
# Optimizer settings
parser.add_argument('--learning_rate', default=0.0001, type=float,
help='Learning rate')
parser.add_argument('--alpha', default=0.99, type=float,
help='RMSProp smoothing constant')
parser.add_argument('--momentum', default=0, type=float,
help='RMSProp momentum')
parser.add_argument('--epsilon', default=1e-8, type=float,
help='RMSProp epsilon')