code: def create_model(
      model_name: str = None,
      pretrained: bool = False,
      device: str = None,
      **kwargs,
  ):
      if device is None:
          device = "cuda" if torch.cuda.is_available() else "cpu"
      if pretrained:
          if model_name is None:
              raise AssertionError(
                  "Fail to load pretrained model: no model name is specified."
              )
      if model_name:
          model_configs = get_configs.configs(model_name)
          model_configs = dict(
              pretrained=model_configs["pretrained"],
              num_classes=model_configs["num_classes"],
              embed_dim=model_configs["embed_dim"],
              depths=model_configs["depths"],
              num_heads=model_configs["num_heads"],
              patch_size=model_configs["patch_size"],
              window_size=model_configs["window_size"],
              drop_path_rate=model_configs["drop_path_rate"],
              patch_norm=model_configs["patch_norm"],
              device=device,
          )
          if not pretrained:
              model_configs["pretrained"] = None
          model = VideoSwinTransformer(**model_configs)
      else:
          model = VideoSwinTransformer(**kwargs)
  
      return model
  
imports: import torch
  from torch import nn
  from torch.utils import model_zoo
  from einops import rearrange
  from towhee.models.layers.patch_embed3d import PatchEmbed3D
  from towhee.models.layers.patch_merging3d import PatchMerging3D
  from towhee.models.video_swin_transformer.video_swin_transformer_block import VideoSwinTransformerBlock
  from towhee.models.video_swin_transformer import get_configs
  from towhee.models.utils.init_vit_weights import init_vit_weights
  from collections import OrderedDict
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: create_model(model_name, pretrained, device) and returns: model