Пример #1
0
        default=1
    )
    args = parser.parse_args()

    # Polyaxon
    tracking.init()

    logger.info('Loading data...')
    (x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=args.max_features,
                                                          skip_top=args.skip_top)

    logger.info('train sequences %s', len(x_train))
    logger.info('test sequences %s', len(x_test))

    # Polyaxon
    tracking.log_data_ref(content=x_train, name='x_train')
    tracking.log_data_ref(content=y_train, name='y_train')
    tracking.log_data_ref(content=x_test, name='x_test')
    tracking.log_data_ref(content=y_test, name='y_test')

    logger.info('Transforming data...')
    x_train, y_train, x_test, y_test = transform_data(x_train,
                                                      y_train,
                                                      x_test,
                                                      y_test,
                                                      args.maxlen)

    logger.info('Training...')
    score, accuracy = train(max_features=args.max_features,
                            maxlen=args.maxlen,
                            epochs=args.epochs,
Пример #2
0
        type=int,
        default=1
    )
    args = parser.parse_args()

    # Polyaxon
    tracking.init()

    logger.info('Downloading data ...')
    mnist = mx.test_utils.get_mnist()
    train_iter = mx.io.NDArrayIter(mnist['train_data'], mnist['train_label'], args.batch_size,
                                   shuffle=True)
    val_iter = mx.io.NDArrayIter(mnist['test_data'], mnist['test_label'], args.batch_size)

    # Polyaxon
    tracking.log_data_ref(content=mnist['train_data'], name='x_train')
    tracking.log_data_ref(content=mnist['train_label'], name='y_train')
    tracking.log_data_ref(content=mnist['test_data'], name='x_test')
    tracking.log_data_ref(content=mnist['test_label'], name='y_test')

    context = mx.gpu if os.environ.get('NVIDIA_VISIBLE_DEVICES') else mx.cpu

    metrics = model(context=context,
                    train_iter=train_iter,
                    val_iter=val_iter,
                    conv1_kernel=args.conv1_kernel,
                    conv1_filters=args.conv1_filters,
                    conv1_activation=args.conv1_activation,
                    conv2_kernel=args.conv1_kernel,
                    conv2_filters=args.conv1_filters,
                    conv2_activation=args.conv1_activation,