SAVRN
Search Contact SAVRN

Open-weight model · Image classification

swin_base_patch4_window12_384.ms_in22k_ft_in1k

by PyTorch Image Models timm/swin_base_patch4_window12_384.ms_in22k_ft_in1k

A Swin Transformer image classification model. Pretrained on ImageNet-22k and fine-tuned on ImageNet-1k by paper authors. Explore the dataset and runtime metrics of this model in timm model results.

Parameters91M
Context
Weights730.6 MB
Licensemit
AccessOpen weights
Monthly Downloads105.5k

Runs On

What it takes to serve swin_base_patch4_window12_384.ms_in22k_ft_in1k (91M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.2 GB 0.2 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

Model Card

By PyTorch Image Models, published under mit, revision 006b1859d333.

A Swin Transformer image classification model. Pretrained on ImageNet-22k and fine-tuned on ImageNet-1k by paper authors. Explore the dataset and runtime metrics of this model in timm model results.

Read PyTorch Image Models's full model card

Model card for swin_base_patch4_window12_384.ms_in22k_ft_in1k

A Swin Transformer image classification model. Pretrained on ImageNet-22k and fine-tuned on ImageNet-1k by paper authors.

Model Details

  • Model Type: Image classification / feature backbone
  • Model Stats:
  • Params (M): 87.9
  • GMACs: 47.2
  • Activations (M): 134.8
  • Image size: 384 x 384
  • Papers:
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows: https://arxiv.org/abs/2103.14030
  • Original: https://github.com/microsoft/Swin-Transformer
  • Dataset: ImageNet-1k
  • Pretrain Dataset: ImageNet-22k

Model Usage

Image Classification

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model('swin_base_patch4_window12_384.ms_in22k_ft_in1k', pretrained=True)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0))  # unsqueeze single image into batch of 1

top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)

Feature Map Extraction

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model(
    'swin_base_patch4_window12_384.ms_in22k_ft_in1k',
    pretrained=True,
    features_only=True,
)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0))  # unsqueeze single image into batch of 1

for o in output:
    # print shape of each feature map in output
    # e.g. for swin_base_patch4_window7_224 (NHWC output)
    #  torch.Size([1, 56, 56, 128])
    #  torch.Size([1, 28, 28, 256])
    #  torch.Size([1, 14, 14, 512])
    #  torch.Size([1, 7, 7, 1024])
    # e.g. for swinv2_cr_small_ns_224 (NCHW output)
    #  torch.Size([1, 96, 56, 56]) 
    #  torch.Size([1, 192, 28, 28])
    #  torch.Size([1, 384, 14, 14])
    #  torch.Size([1, 768, 7, 7])
    print(o.shape)

Image Embeddings

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model(
    'swin_base_patch4_window12_384.ms_in22k_ft_in1k',
    pretrained=True,
    num_classes=0,  # remove classifier nn.Linear
)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0))  # output is (batch_size, num_features) shaped tensor

# or equivalently (without needing to set num_classes=0)

output = model.forward_features(transforms(img).unsqueeze(0))
# output is unpooled (ie.e a (batch_size, H, W,  num_features) tensor for swin / swinv2
# or (batch_size, num_features, H, W) for swinv2_cr

output = model.forward_head(output, pre_logits=True)
# output is (batch_size, num_features) tensor

Model Comparison

Explore the dataset and runtime metrics of this model in timm model results.

Citation

@inproceedings{liu2021Swin,
  title={Swin Transformer: Hierarchical Vision Transformer using Shifted Windows},
  author={Liu, Ze and Lin, Yutong and Cao, Yue and Hu, Han and Wei, Yixuan and Zhang, Zheng and Lin, Stephen and Guo, Baining},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
  year={2021}
}
@misc{rw2019timm,
  author = {Ross Wightman},
  title = {PyTorch Image Models},
  year = {2019},
  publisher = {GitHub},
  journal = {GitHub repository},
  doi = {10.5281/zenodo.4414861},
  howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
}

Identity and Version

Repository
timm/swin_base_patch4_window12_384.ms_in22k_ft_in1k
Publisher
PyTorch Image Models
Task
Image classification
Modality
Image
Library
timm
Parameters
91M parameters
Languages
Not stated by the source
Revision
006b1859d333de1eaf2c2c5e332a8d530df6cb8a
First published
2023-03-18
Last updated
2025-01-21

Files and Weights

5 files, 730.6 MB in total. The weights are 2 files totalling 730.6 MB in bin, safetensors.

Weights2 files · 730.6 MB
Configuration1 file · 650 B
Documentation1 file · 4.5 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights365.3 MB 7ff88869f860
pytorch_model.binWeights365.4 MB 5e6173e086f7
config.jsonConfiguration650 B
README.mdDocumentation4.5 KB
.gitattributesRepository1.5 KB

License and Download

License
mit
Access
Open weights, no gate
Download size
730.6 MB
Download from PyTorch Image Models

Released by PyTorch Image Models through its official repository on Hugging Face. Read the license.

Built From

  • Described by arXiv:2103.14030
  • Trained on (disclosed) imagenet-1k
  • Trained on (disclosed) imagenet-22k

Memory Requirements

PrecisionWeights in memory
As published730.6 MB
16-bit0.2 GB
8-bit0.1 GB
4-bit0.0 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About swin_base_patch4_window12_384.ms_in22k_ft_in1k

How much GPU memory does swin_base_patch4_window12_384.ms_in22k_ft_in1k need?

About 0.2 GB at 16-bit and 0.1 GB at 4-bit: the weights (91M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run swin_base_patch4_window12_384.ms_in22k_ft_in1k on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use swin_base_patch4_window12_384.ms_in22k_ft_in1k commercially?

Yes. swin_base_patch4_window12_384.ms_in22k_ft_in1k is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

Similar Models

Model · Image classification

convnextv2-base-22k-384

AI at Meta

ConvNeXt V2 model pretrained using the FCMAE framework and fine-tuned on the ImageNet-22K dataset at resolution 384x384. It was introduced in the paper ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders by Woo et al. and first released in this repository. Disclaimer: The team releasing ConvNeXT V2 did not write a model card for this model so this model card has been written by the Hugging Face team. ConvNeXt V2 is a pure convolutional model (ConvNet) that introduces a fully convolutional masked autoencoder framework (FCMAE) and a new Global Response Normalization (GRN) layer to ConvNeXt. ConvNeXt V2 significantly improves the performance of pure ConvNets on various…

Open weights apache-2.0 89M parameters transformers

A ConvNeXt-V2 image classification model. Pretrained with a fully convolutional masked autoencoder framework (FCMAE) and fine-tuned on ImageNet-22k and then ImageNet-1k. Explore the dataset and runtime metrics of this model in timm model results. All timing numbers from eager model PyTorch 1.13 on RTX 3090 w/ AMP.

Open weights cc-by-nc-4.0 89M parameters timm

Model · Image classification

siglip2-x256-explicit-content

Prithiv Sakthi

SigLIP 2: Multilingual Vision-Language Encoders with Improved Semantic Understanding, Localization, and Dense Features https://arxiv.org/pdf/2502.14786 The model classifies each image into one of the following content categories: This model is intended for applications such as

Open weights apache-2.0 93M parameters 64 tokens transformers

A ConvNeXt image classification model. Pretrained on ImageNet-22k and fine-tuned on ImageNet-1k by paper authors. Explore the dataset and runtime metrics of this model in timm model results. All timing numbers from eager model PyTorch 1.13 on RTX 3090 w/ AMP.

Open weights apache-2.0 89M parameters timm

A ConvNeXt image classification model. CLIP image tower weights pretrained in OpenCLIP on LAION and fine-tuned on ImageNet-12k followed by ImageNet-1k in timm bby Ross Wightman. Please see related OpenCLIP model cards for more details on pretrain: https://huggingface.co/laion/CLIP-convnextxxlarge-laion2B-s34B-b82K-augreg-soup https://huggingface.co/laion/CLIP-convnextlarged.laion2B-s26B-b102K-augreg https://huggingface.co/laion/CLIP-convnextbasew-laion2B-s13B-b82K-augreg https://huggingface.co/laion/CLIP-convnextbasew320-laionaesthetic-s13B-b82K - Learning Transferable Visual Models From Natural Language Supervision: https://arxiv.org/abs/2103.00020 Explore the dataset and runtime metrics…

Open weights apache-2.0 89M parameters timm

A Vision Transformer (ViT) image classification model. Trained on ImageNet-21k and fine-tuned on ImageNet-1k (with additional augmentation and regularization) in JAX by paper authors, ported to PyTorch by Ross Wightman. - How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers: https://arxiv.org/abs/2106.10270 - An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale: https://arxiv.org/abs/2010.11929v2 Explore the dataset and runtime metrics of this model in timm model results.

Open weights apache-2.0 87M parameters timm