Ejemplo n.º 1
0
def main():
    conf = Configs()
    experiment.create(name='probabilities_fixed_cards')
    experiment.calculate_configs(conf, {}, ['run'])
    experiment.add_pytorch_models(dict(model=conf.model))
    experiment.start()
    conf.run()
Ejemplo n.º 2
0
def main():
    conf = Configs()
    experiment.create(name='who_won')
    experiment.calculate_configs(conf, {}, ['run'])
    experiment.add_pytorch_models(dict(model=conf.model))
    experiment.start()
    conf.run()
Ejemplo n.º 3
0
def main():
    conf = Configs()
    experiment.create(name='mnist_latest')
    conf.optimizer = 'adam_optimizer'
    experiment.calculate_configs(conf, {}, ['set_seed', 'run'])
    experiment.add_pytorch_models(dict(model=conf.model))
    experiment.start()
    conf.run()
Ejemplo n.º 4
0
def main():
    conf = Configs()
    experiment.create(name='cifar_10', writers={'sqlite'})
    conf.optimizer = 'adam_optimizer'
    experiment.calculate_configs(conf, {}, ['set_seed', 'run'])
    experiment.add_pytorch_models(dict(model=conf.model))
    experiment.start()
    conf.run()
Ejemplo n.º 5
0
def search(conf: Configs):
    tracker.set_global_step(0)

    experiment.create(name='mnist_hyperparam_tuning')
    experiment.calculate_configs(conf, {}, ['set_seed', 'run'])
    experiment.add_pytorch_models(dict(model=conf.model))
    experiment.start()

    conf.run()
    tracker.reset()
Ejemplo n.º 6
0
def main():
    conf = Configs()
    experiment.create(name='sklearn', writers={'sqlite'})
    experiment.calculate_configs(conf)

    experiment.add_sklearn_models(dict(model=conf.model))
    experiment.start()
    conf.run()

    experiment.save_checkpoint()
Ejemplo n.º 7
0
def main():
    conf = Configs()
    experiment.create(name='mnist_configs', writers={'sqlite'})
    conf.optimizer = 'sgd_optimizer'
    experiment.calculate_configs(conf,
                                 {},
                                 ['set_seed', 'loop'])
    experiment.add_pytorch_models(dict(model=conf.model))
    experiment.start()
    conf.loop()
Ejemplo n.º 8
0
def main():
    conf = Configs()
    experiment.create(name='configs')
    experiment.calculate_configs(conf, {'optimizer': 'sgd_optimizer'},
                                 ['set_seed', 'run'])
    experiment.start()
    conf.run()

    # save the model
    experiment.save_checkpoint()
Ejemplo n.º 9
0
def main():
    conf = Configs()

    experiment.create(name='Battleship_DQN')
    experiment.calculate_configs(conf,
                                 {},
                                 ['set_seed', 'policy', 'target', 'run'])
    experiment.add_pytorch_models(dict(model=conf.policy))
    experiment.start()

    conf.run()

    if conf.is_save_models:
        experiment.save_checkpoint()
Ejemplo n.º 10
0
def main():
    experiment.create()
    conf = Configs()
    conf.learning_rate = 1e-4
    conf.epochs = 500
    conf.conv_sizes = [(128, 2), (256, 4)]
    # conf.conv_sizes = [(128, 1), (256, 2)]
    conf.activation = 'relu'
    conf.dropout = 0.1
    conf.train_batch_size = 32
    experiment.calculate_configs(conf, 'run')

    experiment.start()
    with tracker.namespace('valid'):
        conf.valid_dataset.save_artifacts()
    conf.run()
Ejemplo n.º 11
0
def main():
    conf = Configs()
    experiment.create(name='test_artifacts', writers={'sqlite'})
    experiment.calculate_configs(conf, 'run')
    experiment.start()
    conf.run()
Ejemplo n.º 12
0
def main():
    # set indicator types
    tracker.set_queue("train_loss", 20, True)
    tracker.set_histogram("valid_loss", True)
    tracker.set_scalar("valid_accuracy", True)

    epochs = 10

    train_batch_size = 64
    test_batch_size = 1000

    use_cuda = True
    cuda_device = 0
    seed = 5
    train_log_interval = 10

    learning_rate = 0.01

    # get device
    is_cuda = use_cuda and torch.cuda.is_available()
    if not is_cuda:
        device = torch.device("cpu")
    else:
        if cuda_device < torch.cuda.device_count():
            device = torch.device(f"cuda:{cuda_device}")
        else:
            print(f"Cuda device index {cuda_device} higher than "
                  f"device count {torch.cuda.device_count()}")

            device = torch.device(f"cuda:{torch.cuda.device_count() - 1}")

    # data transform
    data_transform = transforms.Compose(
        [transforms.ToTensor(),
         transforms.Normalize((0.1307, ), (0.3081, ))])

    # train loader
    train_loader = torch.utils.data.DataLoader(datasets.MNIST(
        str(lab.get_data_path()),
        train=True,
        download=True,
        transform=data_transform),
                                               batch_size=train_batch_size,
                                               shuffle=True)

    # test loader
    test_loader = torch.utils.data.DataLoader(datasets.MNIST(
        str(lab.get_data_path()),
        train=False,
        download=True,
        transform=data_transform),
                                              batch_size=test_batch_size,
                                              shuffle=False)

    # model
    model = Net().to(device)

    # optimizer
    optimizer = optim.Adam(model.parameters(), lr=learning_rate)

    # set seeds
    torch.manual_seed(seed)

    # only for logging purposes
    configs = {
        'epochs': epochs,
        'train_batch_size': train_batch_size,
        'test_batch_size': test_batch_size,
        'use_cuda': use_cuda,
        'cuda_device': cuda_device,
        'seed': seed,
        'train_log_interval': train_log_interval,
        'learning_rate': learning_rate,
        'device': device,
        'train_loader': train_loader,
        'test_loader': test_loader,
        'model': model,
        'optimizer': optimizer,
    }

    # create the experiment
    experiment.create(name='tracker')

    # experiment configs
    experiment.calculate_configs(configs)

    # pyTorch model
    experiment.add_pytorch_models(dict(model=model))

    experiment.start()

    # training loop
    for epoch in range(1, epochs + 1):
        train(model, optimizer, train_loader, device, train_log_interval)
        test(model, test_loader, device)
        logger.log()

    # save the model
    experiment.save_checkpoint()
Ejemplo n.º 13
0
def main():
    conf = Configs()
    experiment.create(name='mnist_gan', writers={'sqlite'})
    experiment.calculate_configs(conf, {}, ['set_seed', 'main'])
    experiment.start()
    conf.main()
Ejemplo n.º 14
0
def main():
    conf = Configs()
    experiment.create(name='rnn', writers={'sqlite', 'tensorboard'})
    experiment.calculate_configs(conf, {}, run_order=['set_seed', 'main'])
    experiment.start()
    conf.main()