def parse_args(): parser = argparse.ArgumentParser("Run an already learned DQN model.") # Environment parser.add_argument("--env", type=str, required=True, help="name of the game") parser.add_argument("--model-dir", type=str, default=None, help="load model from this directory. ") parser.add_argument("--video", type=str, default=None, help="Path to mp4 file where the \ video of first episode will be recorded.") boolean_flag(parser, "stochastic", default=True, help="whether or not to use stochastic \ actions according to models eps value") boolean_flag(parser, "dueling", default=False, help="whether or not to use dueling model") # V: Attack Arguments# parser.add_argument("--model-dir2", type=str, default=None, help="load adversarial model from \ this directory (blackbox attacks). ") parser.add_argument("--attack", type=str, default=None, help="Method to attack the model.") boolean_flag(parser, "noisy", default=False, help="whether or not to NoisyNetwork") boolean_flag(parser, "noisy2", default=False, help="whether or not to NoisyNetwork") boolean_flag(parser, "blackbox", default=False, help="whether or not to NoisyNetwork") return parser.parse_args()
def parse_args(): parser = argparse.ArgumentParser("DQN experiments for Atari games") # Environment parser.add_argument("--env", type=str, default="Pong", help="name of the game") parser.add_argument("--seed", type=int, default=42, help="which seed to use") # Core DQN parameters parser.add_argument("--replay-buffer-size", type=int, default=int(1e6), help="replay buffer size") parser.add_argument("--lr", type=float, default=1e-4, help="learning rate for Adam optimizer") parser.add_argument("--num-steps", type=int, default=int(2e8), help="total number of steps to run the environment for") parser.add_argument("--batch-size", type=int, default=32, help="number of transitions to optimize at the same time") parser.add_argument("--learning-freq", type=int, default=4, help="number of iterations between every optimization step") parser.add_argument("--target-update-freq", type=int, default=40000, help="number of iterations between every target network update") # Bells and whistles boolean_flag(parser, "noisy", default=False, help="whether or not to NoisyNetwork") boolean_flag(parser, "double-q", default=True, help="whether or not to use double q learning") boolean_flag(parser, "dueling", default=False, help="whether or not to use dueling model") boolean_flag(parser, "prioritized", default=False, help="whether or not to use prioritized replay buffer") parser.add_argument("--prioritized-alpha", type=float, default=0.6, help="alpha parameter for prioritized replay buffer") parser.add_argument("--prioritized-beta0", type=float, default=0.4, help="initial value of beta parameters for prioritized replay") parser.add_argument("--prioritized-eps", type=float, default=1e-6, help="eps parameter for prioritized replay buffer") # Checkpointing parser.add_argument("--save-dir", type=str, default=None, required=True, help="directory in which training state and model should be saved.") parser.add_argument("--save-azure-container", type=str, default=None, help="It present data will saved/loaded from Azure. Should be in format ACCOUNT_NAME:ACCOUNT_KEY:CONTAINER") parser.add_argument("--save-freq", type=int, default=1e6, help="save model once every time this many iterations are completed") boolean_flag(parser, "load-on-start", default=True, help="if true and model was previously saved then training will be resumed") #V: Attack Arguments # parser.add_argument("--attack", type=str, default=None, help="Method to attack the model.") parser.add_argument("--attack-init", type=int, default=0, help="Iteration no. to begin attacks") parser.add_argument("--attack-prob", type=float, default=0.0, help="Probability of attack at each step, float in range 0 - 1.0" ) return parser.parse_args()
def parse_args(): parser = argparse.ArgumentParser("DQN experiments for Atari games") # Environment parser.add_argument("--env", type=str, default="Pong", help="name of the game") parser.add_argument("--seed", type=int, default=42, help="which seed to use") # Core DQN parameters parser.add_argument("--replay-buffer-size", type=int, default=int(1e6), help="replay buffer size") parser.add_argument("--lr", type=float, default=1e-4, help="learning rate for Adam optimizer") parser.add_argument("--num-steps", type=int, default=int(2e8), help="total number of steps to \ run the environment for") parser.add_argument("--batch-size", type=int, default=32, help="number of transitions to optimize \ at the same time") parser.add_argument("--learning-freq", type=int, default=4, help="number of iterations between \ every optimization step") parser.add_argument("--target-update-freq", type=int, default=40000, help="number of iterations between \ every target network update") # Bells and whistles boolean_flag(parser, "noisy", default=False, help="whether or not to NoisyNetwork") boolean_flag(parser, "double-q", default=True, help="whether or not to use double q learning") boolean_flag(parser, "dueling", default=False, help="whether or not to use dueling model") boolean_flag(parser, "prioritized", default=False, help="whether or not to use prioritized replay buffer") parser.add_argument("--prioritized-alpha", type=float, default=0.6, help="alpha parameter for prioritized replay buffer") parser.add_argument("--prioritized-beta0", type=float, default=0.4, help="initial value of beta \ parameters for prioritized replay") parser.add_argument("--prioritized-eps", type=float, default=1e-6, help="eps parameter for prioritized replay buffer") # Checkpointing parser.add_argument("--save-dir", type=str, default=None, required=True, help="directory in which \ training state and model should be saved.") parser.add_argument("--save-azure-container", type=str, default=None, help="It present data will saved/loaded from Azure. \ Should be in format ACCOUNT_NAME:ACCOUNT_KEY:\ CONTAINER") parser.add_argument("--save-freq", type=int, default=1e6, help="save model once every time this many \ iterations are completed") boolean_flag(parser, "load-on-start", default=True, help="if true and model was previously saved then training \ will be resumed") # V: Attack Arguments # parser.add_argument("--attack", type=str, default=None, help="Method to attack the model.") parser.add_argument("--attack-init", type=int, default=0, help="Iteration no. to begin attacks") parser.add_argument("--attack-prob", type=float, default=0.0, help="Probability of attack at each step, \ float in range 0 - 1.0") return parser.parse_args()