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. If you’re looking for an explanation, look at this blogpost.


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 vgg16

from nfnets import replace_conv, AGC, WSConv2d, ScaledStdConv2d

model = vgg16()
replace_conv(model, WSConv2d) # 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)