apps/train.py
def parse_args():
    '''process arguments from the command line'''
    parser = argparse.ArgumentParser(
        description='Build and Train your Neural Network')
    parser.add_argument('data_dir', type=str,
                        help='directory of the training data (required)')
    parser.add_argument('--save_dir', type=str,
                        help='directory where to save your neural network. By default it will save in current directory')
    parser.add_argument(
        '--arch', type=str, help='models to pretrain from (vgg16, alexnet, or densenet121)')
    parser.add_argument('--learning_rate', type=float,
                        help='learning rate of training')
    parser.add_argument('--hidden_units', type=int,
                        help='number of hidden units of the network')
    parser.add_argument('--epochs', type=int, help='number of training epochs')
    parser.add_argument('--gpu', action='store_true', default=False,
                        help='use GPU for training when available')
    # parse arguments
    args = parser.parse_args()
    return args
process arguments from the command line
process arguments from the command line
process arguments from the command line
def parse_args():
    parser = argparse.ArgumentParser(
        description='Build and Train your Neural Network')
    parser.add_argument('data_dir', type=str,
                        help='directory of the training data (required)')
    parser.add_argument('--save_dir', type=str,
                        help='directory where to save your neural network. By default it will save in current directory')
    parser.add_argument(
        '--arch', type=str, help='models to pretrain from (vgg16, alexnet, or densenet121)')
    parser.add_argument('--learning_rate', type=float,
                        help='learning rate of training')
    parser.add_argument('--hidden_units', type=int,
                        help='number of hidden units of the network')
    parser.add_argument('--epochs', type=int, help='number of training epochs')
    parser.add_argument('--gpu', action='store_true', default=False,
                        help='use GPU for training when available')
    args = parser.parse_args()
    return args
def parse_args ( ) : parser = argparse . ArgumentParser ( description = 'Build and Train your Neural Network' ) parser . add_argument ( 'data_dir' , type = str , help = 'directory of the training data (required)' ) parser . add_argument ( '--save_dir' , type = str , help = 'directory where to save your neural network. By default it will save in current directory' ) parser . add_argument ( '--arch' , type = str , help = 'models to pretrain from (vgg16, alexnet, or densenet121)' ) parser . add_argument ( '--learning_rate' , type = float , help = 'learning rate of training' ) parser . add_argument ( '--hidden_units' , type = int , help = 'number of hidden units of the network' ) parser . add_argument ( '--epochs' , type = int , help = 'number of training epochs' ) parser . add_argument ( '--gpu' , action = 'store_true' , default = False , help = 'use GPU for training when available' ) args = parser . parse_args ( ) return args
process arguments from the command line
process arguments from the command line
'''process arguments from the command line''' # parse arguments