code: def create_model(
      model_name: str = None,
      pretrained: bool = False,
      weights_path: str = None,
      device: str = None,
      **kwargs,
  ):
      if device is None:
          device = "cuda" if torch.cuda.is_available() else "cpu"
      if pretrained and weights_path is None:
          raise AssertionError(
              "if pretrained is true, weights_path needs to be specified"
          )
      if model_name is None:
          if pretrained:
              raise AssertionError(
                  "Fail to load pretrained model: no model name is specified."
              )
          model = WaveViT(**kwargs)
      else:
          configs = get_configs(model_name)
          configs.update(**kwargs)
          model = WaveViT(**configs)
          model.default_cfg = _cfg()
          if pretrained:
              state_dic = torch.load(weights_path, map_location=device)[
                  "state_dict"
              ]
              model.load_state_dict(state_dic)
      # add .float() to solve the following problems
      # Input type (torch.FloatTensor) and weight type (torch.HalfTensor) should be the same
      model.to(device).float()
      model.eval()
  
      return model
  
file_path: towhee/towhee/models/wave_vit/wave_vit.py
imports: import torch
  from torch import nn
  from typing import List, Any
  import numpy
  from timm.models.vision_transformer import _cfg
  from towhee.models.wave_vit.wave_vit_block import rand_bbox, Stem, DownSamples, Block, ClassBlock
  from towhee.models.utils.init_vit_weights import init_vit_weights
  from towhee.models.wave_vit.wave_vit_utils import get_configs
label_desc: Use image node_id 1 for calling a global function with example usage: create_model(model_name, pretrained, weights_path, device) and returns: model