def main(): conf = Configs() experiment = Experiment(writers={'sqlite'}) experiment.calc_configs(conf, {'epochs': 'random'}, ['set_seed', 'loop']) experiment.add_models(dict(model=conf.model)) experiment.start(run=-1) conf.loop()
def main(): conf = Configs() experiment = Experiment(writers={'sqlite'}) experiment.calc_configs(conf, {'optimizer': 'adam_optimizer'}, ['set_seed', 'main']) experiment.add_models(dict(model=conf.model)) experiment.start() conf.main()
def main(): conf = Configs() experiment = Experiment(writers={'sqlite', 'tensorboard'}) experiment.calc_configs(conf, {'epochs': 'random'}, ['set_seed', 'main']) experiment.add_models(dict(model=conf.model)) experiment.start() conf.main()
def main(): conf = Configs() experiment = Experiment(writers={'sqlite'}) experiment.calc_configs(conf, {}, run_order=['set_seed', 'main']) experiment.start() conf.main()
from typing import List, Optional, NamedTuple import torch import torch.nn from parser.load import EncodedFile, split_train_valid, load_files from lab.experiment.pytorch import Experiment from parser import tokenizer # Configure the experiment from parser.batch_builder import BatchBuilder from parser.merge_tokens import InputProcessor EXPERIMENT = Experiment(name="id_embeddings", python_file=__file__, comment="With ID embeddings", check_repo_dirty=False, is_log_python_file=False) logger = EXPERIMENT.logger # device to train on device = torch.device("cuda:1") cpu = torch.device("cpu") class ModelOutput(NamedTuple): decoded_input_logits: torch.Tensor decoded_predictions: Optional[torch.Tensor] probabilities: torch.Tensor logits: torch.Tensor
""" import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from lab.experiment.pytorch import Experiment # Declare the experiment EXPERIMENT = Experiment(name="mnist_pytorch", python_file=__file__, comment="Test", check_repo_dirty=False ) logger = EXPERIMENT.logger class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 20, 5, 1) self.conv2 = nn.Conv2d(20, 50, 5, 1) self.fc1 = nn.Linear(4 * 4 * 50, 500) self.fc2 = nn.Linear(500, 10) def forward(self, x):
from typing import NamedTuple, List, Tuple import torch import torch.nn import parser.load import parser.tokenizer from lab import colors from lab.experiment.pytorch import Experiment from simple_model import SimpleLstmModel from parser import tokenizer # Experiment configuration to load checkpoints EXPERIMENT = Experiment(name="simple_lstm_1000", python_file=__file__, comment="Simple LSTM All Data", check_repo_dirty=False, is_log_python_file=False) logger = EXPERIMENT.logger # device to evaluate on device = torch.device("cuda:1") # Beam search BEAM_SIZE = 8 class Suggestions(NamedTuple): codes: List[List[int]] matched: List[int]
def create_exp(): return Experiment(name="test", comment="Test")