composer.functional#
Functional API for applying algorithms in your own training loop.
from composer import functional as cf
from torchvision import models
model = models.resnet50()
# replace some layers with blurpool
cf.apply_blurpool(model)
# replace some layers with squeeze-excite
cf.apply_squeeze_excite(model, latent_channels=64, min_channels=128)
Functions
Removes position embeddings and replaces the attention function and attention mask as per |
|
Add anti-aliasing filters to strided |
|
Changes the memory format of the model to torch.channels_last. |
|
Replaces |
|
Replaces all instances of torch.nn.LayerNorm with a apex.normalization.fused_layer_norm.FusedLayerNorm. |
|
Replaces the Linear layers in the feed-forward network with Gated Linear Units. |
|
Replace batch normalization modules with ghost batch normalization modules. |
|
Clips all gradients in model based on specified clipping_type. |
|
Replaces all instances of torch.nn.Dropout with a GyroDropout. |
|
Adds Squeeze-and-Excitation blocks (Hu et al, 2019) after |
|
Applies Stochastic Depth (Huang et al, 2016) to the specified model. |
|
Weight Standardization standardizes convolutional weights in a model. |
|
Applies the AugMix (Hendrycks et al, 2020) data augmentation. |
|
Applies ColOut augmentation to a batch of images and (optionally) targets, dropping the same random rows and columns from all images and targets in a batch. |
|
Updates the weights of |
|
Create new samples using combinations of pairs of samples. |
|
See |
|
Progressively freeze the layers of the network in-place during training, starting with the earlier layers. |
|
Create new samples using convex combinations of pairs of samples. |
|
Randomly applies a sequence of image data augmentations to an image or batch of images. |
|
Resize inputs and optionally outputs by cropping or interpolating. |
|
Prunes minibatches as a subroutine of |
|
Set the sequence length of a batch. |
|
Decides if selective backprop should be run based on time in training. |
|
Shrink targets towards a uniform distribution as in Szegedy et al. |