The Model interface will iterate over the dataset, and execute each batch on
forward
, loss
, and backward
.
# adapted from https://github.com/pytorch/examples/blob/master/mnist/main.py from cogitare import Model from cogitare import utils from cogitare.data import DataSet, AsyncDataLoader from cogitare.plugins import EarlyStopping from cogitare.metrics.classification import accuracy import cogitare import torch.nn as nn import torch import torch.nn.functional as F from torch.nn.utils import clip_grad_norm import torch.optim as optim from sklearn.datasets import fetch_mldata import numpy as np CUDA = True cogitare.utils.set_cuda(CUDA)