code: def get_swin_config(swin_name):
      config = SwinConfig()
      name_split = swin_name.split("_")
  
      model_size = name_split[1]
      img_size = int(name_split[4])
      window_size = int(name_split[3][-1])
  
      if model_size == "tiny":
          embed_dim = 96
          depths = (2, 2, 6, 2)
          num_heads = (3, 6, 12, 24)
      elif model_size == "small":
          embed_dim = 96
          depths = (2, 2, 18, 2)
          num_heads = (3, 6, 12, 24)
      elif model_size == "base":
          embed_dim = 128
          depths = (2, 2, 18, 2)
          num_heads = (4, 8, 16, 32)
      else:
          embed_dim = 192
          depths = (2, 2, 18, 2)
          num_heads = (6, 12, 24, 48)
  
      if "in22k" in swin_name:
          num_classes = 21841
      else:
          num_classes = 1000
          repo_id = "huggingface/label-files"
          filename = "imagenet-1k-id2label.json"
          id2label = json.load(
              open(
                  hf_hub_download(
                      repo_id, filename, repo_type="dataset"
                  ),
                  "r",
              )
          )
          id2label = {int(k): v for k, v in id2label.items()}
          config.id2label = id2label
          config.label2id = {v: k for k, v in id2label.items()}
  
      config.image_size = img_size
      config.num_labels = num_classes
      config.embed_dim = embed_dim
      config.depths = depths
      config.num_heads = num_heads
      config.window_size = window_size
  
      return config
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/swin/convert_swin_timm_to_pytorch.py
imports: import argparse
  import json
  import torch
  from PIL import Image
  import requests
  import timm
  from huggingface_hub import hf_hub_download
  from transformers import AutoFeatureExtractor, SwinConfig, SwinForImageClassification
label_desc: Use image node_id 1 for calling a global function with example usage: get_swin_config(swin_name) and returns: config