def getOptions(): parser = argparse.ArgumentParser(description='Test data loader.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) malpiOptions.addMalpiOptions( parser ) args = parser.parse_args() malpiOptions.preprocessOptions(args) return args
early.on_train_end() # finished, final model: if save_model: vae.save_json("tf_vae/vae.json") return best_loss if __name__ == "__main__": import argparse import malpiOptions parser = argparse.ArgumentParser(description='Test data loader.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--learning_rate', type=float, default=0.0001, help='Learning rate') parser.add_argument('--z_size', type=int, default=32, help='Latent space size') parser.add_argument('--batch_size', type=int, default=100, help='Mini-batch size') parser.add_argument('--kl_tolerance', type=float, default=0.5, help='Max KL tolerance') parser.add_argument('--epochs', type=int, default=100, help='Mini-batch size') malpiOptions.addMalpiOptions( parser ) args = parser.parse_args() malpiOptions.preprocessOptions(args) if args.test_only: runTests(args) exit() main( args.dirs, z_size=args.z_size, batch_size=args.batch_size, learning_rate=args.learning_rate, kl_tolerance=args.kl_tolerance, epochs=args.epochs, save_model=False, verbose=True )
help='number of episodes to use to train') parser.add_argument('--new_model', action='store_true', help='start a new model from scratch?') parser.add_argument('--epochs', default=10, help='number of epochs to train for') parser.add_argument( '--val', help='File with one drive data directory per line for validation') parser.add_argument('--val_split', type=float, default=0.2, help='Percent validation split') addMalpiOptions(parser) args = parser.parse_args() preprocessOptions(args) if len(args.dirs) == 0 and not (args.test_only or args.start_batch): parser.print_help() print("\nNo directories supplied") exit() if args.val is None: last = int(len(args.dirs) * args.val_split) np.random.shuffle(args.dirs) test = args.dirs[:last] train = args.dirs[last:] args.dirs = train args.val = test
def getOptions(): parser = argparse.ArgumentParser( description='Train on robot image/action data.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) #parser.add_argument('dirs', nargs='*', metavar="Directory", help='A directory containing recorded robot data') #parser.add_argument('-f', '--file', help='File with one directory per line') parser.add_argument( '--fc', action="store_true", default=False, help='Train a model with a fully connected layer (no RNN)') parser.add_argument( '--dk', action="store_true", default=False, help='Train a model with DonkeyCar style Convolution layers') parser.add_argument('--early', action="store_true", default=False, help='Stop training early if learning plateaus') parser.add_argument('--runs', type=int, default=1, help='How many runs to train') parser.add_argument('--name', help='Display name for this training experiment') parser.add_argument( '--aux', default=None, help='Use this auxiliary data in place of standard actions') parser.add_argument('--model', default=None, help='A file containing weights to pre-load the model') parser.add_argument( '--val', default=None, help='A file with a list of directories to be used for validation') parser.add_argument('--val_split', type=float, default=0.2, help='Percent validation split') parser.add_argument( '--notify', help='Email address to notify when the training is finished') #parser.add_argument('--test_only', action="store_true", default=False, help='run tests, then exit') parser.add_argument('--random', action="store_true", default=False, help='Test an untrained model, then exit') parser.add_argument( '--aug', type=int, default=None, help= 'Augment images by this factor. 2 = twice as many images, half of which are altered' ) malpiOptions.addMalpiOptions(parser) args = parser.parse_args() malpiOptions.preprocessOptions(args) if len(args.dirs) == 0 and not args.test_only: parser.print_help() print("\nNo directories supplied") exit() if args.val is None: last = int(len(args.dirs) * args.val_split) np.random.shuffle(args.dirs) test = args.dirs[:last] train = args.dirs[last:] args.dirs = train args.val = test return args