composer.models

Models provided to Trainer must use the basic interface specified by BaseMosaicModel.

Additionally, for convience we provide a number of extensions of BaseMosaicModel as detailed below.

Base Models

BaseMosaicModel

MosaicClassifier

MosaicTransformer

Implements the base logic that all Transformers can build on top off.

Image Models

CIFAR10_ResNet56

MNIST_Classifier

EfficientNetB0

ResNet18

ResNet50

ResNet101

Language Models

Metrics and Loss Functions

Evaluation metrics for common tasks are in torchmetrics and are directly compatible with BaseMosaicModel. Additionally, we provide implementations of the following metrics and loss functions.

Dice

CrossEntropyLoss

Torchmetric implementation to calculate validation loss

soft_cross_entropy

Drop-in replacement for torch.CrossEntropy that can handle dense labels.

LanguageCrossEntropyLoss

Implements a CrossEntropyLoss metric that can be run during the validation step, and is compatible with the HF API.

Perplexity

Subclasses the LanguageCrossEntropyLoss to provide a perplexity measurement.