composer.models.tasks.classification#
A convenience class that creates a ComposerModel for classification tasks from a vanilla PyTorch model.
ComposerClassifier requires batches in the form: (input, target) and includes a basic
classification training loop with soft_cross_entropy() loss and accuracy logging.
Classes
A convenience class that creates a |
- class composer.models.tasks.classification.ComposerClassifier(module)[source]#
Bases:
composer.models.base.ComposerModelA convenience class that creates a
ComposerModelfor classification tasks from a vanilla PyTorch model.ComposerClassifierrequires batches in the form: (input,target) and includes a basic classification training loop withsoft_cross_entropy()loss and accuracy logging.- Parameters
module (Module) โ A PyTorch neural network module.
- Returns
ComposerClassifier โ An instance of
ComposerClassifier.
Example:
import torchvision from composer.models import ComposerClassifier pytorch_model = torchvision.models.resnet18(pretrained=False) model = ComposerClassifier(pytorch_model)