예제 #1
0
 def test_5_shot_5_way(self):
     config = {
         'data.dataset': 'mini-imagenet',
         'data.dataset_path': 'data/mini-imagenet',
         'data.split': 'vinyals',
         'data.train_way': 5,
         'data.batch': 10,
         'data.train_support': 5,
         'data.train_query': 5,
         'data.test_way': 5,
         'data.test_support': 5,
         'data.test_query': 5,
         'data.episodes': 1,
         'data.cuda': cuda_on,
         'data.gpu': 0,
         'model.x_dim': '84,84,3',
         'model.lstm_size': 32,
         'model.save_dir': './miniimagenet_test',
         'train.epochs': 1,
         'train.optim_method': 'Adam',
         'train.lr': 0.001,
         'train.patience': 100,
         'train.restore': 0,
         'train.log_dir': 'tests/logs'
     }
     train(config)
예제 #2
0
    def test_2_way_batch_4(self):
        config = {
            'data.dataset_path':
            '/home/igor/dl/siamese-networks-tf/data/omniglot',
            'data.dataset': 'omniglot',
            'data.train_way': 2,
            'data.test_way': 2,
            'data.split': 'vinyals',
            'data.batch': 4,
            'data.episodes': 2,
            'data.cuda': 1,
            'data.gpu': gpu_num,
            'train.epochs': 1,
            'train.lr': 0.001,
            'train.patience': 100,
            'train.tb_dir': 'results/logs/gradient_tape/',
            'train.log_dir': 'results/logs',
            'train.restore': 0,
            'model.x_dim': '105,105,1',
            'model.save_dir': 'results/models/omniglot'
        }
        train(config)

        config['train.restore'] = 1
        train(config)
예제 #3
0
 def test_1_shot_1_way(self):
     config = {
         "data.dataset": "omniglot",
         "data.split": "vinyals",
         "data.train_way": 1,
         "data.train_support": 1,
         "data.train_query": 1,
         "data.test_way": 1,
         "data.test_support": 1,
         "data.test_query": 1,
         "data.episodes": 10,
         "data.cuda": cuda_on,
         "data.gpu": 0,
         "model.x_dim": "28,28,1",
         "model.z_dim": 64,
         "train.epochs": 2,
         'train.optim_method': "Adam",
         "train.lr": 0.001,
         "train.patience": 5,
         "model.save_path": 'test_omniglot.h5'
     }
     train(config)
     os.remove('test_omniglot.h5')
예제 #4
0
파일: run.py 프로젝트: emma-mens/two-sigma
                                num_workers=1, pin_memory=True, drop_last=True)

        resume = args.resume

        if args.resume:
            assert(bool(args.exp_dir))
            if args.reuse_old:
                with open("%s/args.pkl" % args.exp_dir, "rb") as f:
                    args = pickle.load(f)
        args.resume = resume

        print(args)

        # get number of features of input
        n_features = train_loader.dataset[0][0].shape[1]
        model = models.FinanceModel(input_dim=n_features, output_dim=output_dim,
                                    dropout_p=args.dropout, binary=args.direction)

        if not bool(args.exp_dir):
            print("exp_dir not specified, automatically creating one...")
            args.exp_dir = "exp/Data-%s/Optim-%s_LR-%s_Epochs-%s" % (
                os.path.basename(args.data_file), args.optim, args.lr, args.n_epochs)

        if not args.resume:
            print("\nexp_dir: %s" % args.exp_dir)
            os.makedirs("%s/models" % args.exp_dir)
            with open("%s/args.pkl" % args.exp_dir, "wb") as f:
                pickle.dump(args, f)

        train(model, train_loader, val_loader, args)