SAVRN
Search Contact SAVRN

Open-weight model · Image classification

swin_tiny_patch4_window7_224.ms_in1k

by PyTorch Image Models timm/swin_tiny_patch4_window7_224.ms_in1k

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

Parameters29M
Context
Weights228.6 MB
Licensemit
AccessOpen weights
Monthly Downloads148.3k

Runs On

What it takes to serve swin_tiny_patch4_window7_224.ms_in1k (29M 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.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.0 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 4cc3a7275b50.

A Swin Transformer image classification model. Pretrained 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_tiny_patch4_window7_224.ms_in1k

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

Model Details

  • Model Type: Image classification / feature backbone
  • Model Stats:
  • Params (M): 28.3
  • GMACs: 4.5
  • Activations (M): 17.1
  • Image size: 224 x 224
  • 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

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_tiny_patch4_window7_224.ms_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_tiny_patch4_window7_224.ms_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_tiny_patch4_window7_224.ms_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_tiny_patch4_window7_224.ms_in1k
Publisher
PyTorch Image Models
Task
Image classification
Modality
Image
Library
timm
Parameters
29M parameters
Languages
Not stated by the source
Revision
4cc3a7275b50b53a7bec45f32c236ebe64227cff
First published
2023-03-18
Last updated
2025-01-21

Files and Weights

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

Weights2 files · 228.6 MB
Configuration1 file · 637 B
Documentation1 file · 4.4 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights114.3 MB fb01861f7931
pytorch_model.binWeights114.3 MB 4d7d61fb43a9
config.jsonConfiguration637 B
README.mdDocumentation4.4 KB
.gitattributesRepository1.5 KB

License and Download

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

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

Built From

Memory Requirements

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

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

Questions About swin_tiny_patch4_window7_224.ms_in1k

How much GPU memory does swin_tiny_patch4_window7_224.ms_in1k need?

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

What is the cheapest GPU to run swin_tiny_patch4_window7_224.ms_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_tiny_patch4_window7_224.ms_in1k commercially?

Yes. swin_tiny_patch4_window7_224.ms_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

convnext_tiny.in12k_ft_in1k

PyTorch Image Models

A ConvNeXt image classification model. Pretrained in timm on ImageNet-12k (a 11821 class subset of full ImageNet-22k) and fine-tuned on ImageNet-1k by Ross Wightman. ImageNet-12k training done on TPUs thanks to support of the TRC program. Fine-tuning performed on 8x GPU Lambda Labs cloud instances. 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 29M parameters timm

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 29M parameters timm

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 29M parameters timm

Model · Image classification

convnextv2-tiny-22k-224

AI at Meta

ConvNeXt V2 model pretrained using the FCMAE framework and fine-tuned on the ImageNet-22K dataset at resolution 224x224. 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 29M parameters transformers

Model · Image classification

resnet50d.ra2_in1k

PyTorch Image Models

A ResNet-D image classification model. 3-layer stem of 3x3 convolutions with pooling 2x2 average pool + 1x1 convolution shortcut downsample Trained on ImageNet-1k in timm using recipe template described below. RandAugment RA2 recipe. Inspired by and evolved from EfficientNet RandAugment recipes. Published as B recipe in ResNet Strikes Back. RMSProp (TF 1.0 behaviour) optimizer, EMA weight averaging Step (exponential decay w/ staircase) LR schedule with warmup - Deep Residual Learning for Image Recognition: https://arxiv.org/abs/1512.03385 - Bag of Tricks for Image Classification with Convolutional Neural Networks: https://arxiv.org/abs/1812.01187 Explore the dataset and runtime metrics of…

Open weights apache-2.0 26M parameters timm

Model · Image classification

resnet50.a1_in1k

PyTorch Image Models

A ResNet-B image classification model. single layer 7x7 convolution with pooling 1x1 convolution shortcut downsample Trained on ImageNet-1k in timm using recipe template described below. ResNet Strikes Back A1 recipe - Deep Residual Learning for Image Recognition: https://arxiv.org/abs/1512.03385 Explore the dataset and runtime metrics of this model in timm model results.

Open weights apache-2.0 26M parameters timm