Beispiel #1
0
                        (comm_block.Get_size() - 1),
                        elastic_lr=args.elastic_lr,
                        elastic_momentum=args.elastic_momentum)
        else:
            algo = Algo(args.optimizer,
                        loss=args.loss,
                        validate_every=validate_every,
                        sync_every=args.sync_every,
                        worker_optimizer=args.worker_optimizer)

        os.environ['KERAS_BACKEND'] = backend
        #import_keras()
        block = process_block.ProcessBlock(comm_world,
                                           comm_block,
                                           algo,
                                           data,
                                           device,
                                           model_provider,
                                           args.epochs,
                                           train_list,
                                           val_list,
                                           folds=args.n_fold,
                                           num_masters=args.n_master,
                                           num_process=args.n_process,
                                           verbose=args.verbose,
                                           early_stopping=args.early_stopping,
                                           target_metric=args.target_metric,
                                           monitor=args.monitor)
        block.label = args.label
        block.run()
Beispiel #2
0
                                                  param_ranges, model_fn)
        opt_coordinator.run(num_iterations=30)
    else:
        data = H5Data(batch_size=args.batch,
                      features_name='Images',
                      labels_name='Labels')
        data.set_file_names(train_list)
        validate_every = data.count_data() / args.batch
        algo = Algo(args.optimizer,
                    loss=args.loss,
                    validate_every=validate_every,
                    sync_every=args.sync_every)
        os.environ['KERAS_BACKEND'] = backend
        import_keras()
        import keras.callbacks as cbks
        callbacks = []
        if args.early_stopping is not None:
            callbacks.append(
                cbks.EarlyStopping(patience=args.early_stopping, verbose=1))
        block = process_block.ProcessBlock(comm_world,
                                           comm_block,
                                           algo,
                                           data,
                                           device,
                                           args.epochs,
                                           train_list,
                                           val_list,
                                           callbacks,
                                           verbose=args.verbose)
        block.run()