code: def get_deta_config(model_name):
      backbone_config = SwinConfig(
          embed_dim=192,
          depths=(2, 2, 18, 2),
          num_heads=(6, 12, 24, 48),
          window_size=12,
          out_features=["stage2", "stage3", "stage4"],
      )
  
      config = DetaConfig(
          backbone_config=backbone_config,
          num_queries=900,
          encoder_ffn_dim=2048,
          decoder_ffn_dim=2048,
          num_feature_levels=5,
          assign_first_stage=True,
          with_box_refine=True,
          two_stage=True,
      )
  
      # set labels
      repo_id = "huggingface/label-files"
      if "o365" in model_name:
          num_labels = 366
          filename = "object365-id2label.json"
      else:
          num_labels = 91
          filename = "coco-detection-id2label.json"
  
      config.num_labels = num_labels
      id2label = json.load(
          open(
              cached_download(
                  hf_hub_url(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()}
  
      return config
  
file_path: transformers/src/transformers/models/deta/convert_deta_swin_to_pytorch.py
imports: import argparse
  import json
  from pathlib import Path
  import requests
  import torch
  from huggingface_hub import cached_download, hf_hub_download, hf_hub_url
  from PIL import Image
  from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig
  from transformers.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: get_deta_config(model_name) and returns: config