Welcome to NFNets PyTorch’s documentation!¶
NFNets-PyTorch is an implementation of the paper: “High-Performance Large-Scale Image Recognition Without Normalization “. Original paper can be found at arxiv. You can find other implementations at PapersWithCode.
Install¶
Stable release
pip3 install nfnets-pytorch
Latest code
pip3 install git+https://github.com/vballoli/nfnets-pytorch
Sample usage¶
import torch
from torch import nn
from torchvision.models import resnet18
from nfnets import replace_conv, AGC, WSConv2d, ScaledStdConv2d
model = resnet18()
replace_conv(model, ScaledStdConv2d) # Original repo's implementation
replace_conv(model, ScaledStdConv2d) # timm
optim = torch.optim.SGD(model.parameters(), 1e-3) # Or any of your favourite optimizer
optim = AGC(model.parameters(), optim)