code: def detect_and_swap_model(
      model, data_type="fp16", remove_padding=False
  ):
      """currently only supports:
      - BertModel and model with BertModel as .bert attribute
      """
      model = detect_and_swap_bert_model(
          model,
          data_type=data_type,
          lib_path=default_lib_path,
          remove_padding=remove_padding,
      )
      if data_type == "fp16":
          model.half()
      elif data_type == "bf16":
          model.bfloat16()
      return model
  
file_path: nebuly/optimization/nebullvm/nebullvm/operations/optimizations/compilers/faster_transformer/__init__.py
imports: from copy import deepcopy
  from typing import Union
  from nebullvm.core.models import QuantizationType, DeviceType
  from nebullvm.operations.optimizations.compilers.faster_transformer.bert import detect_and_swap_bert_model
  from nebullvm.operations.optimizations.compilers.torchscript import TorchScriptCompiler
  from nebullvm.operations.optimizations.compilers.utils import get_faster_transformer_repo_path
  from nebullvm.optional_modules.torch import GraphModule, Module, ScriptModule, torch
  from nebullvm.tools.data import DataManager
  from nebullvm.tools.huggingface import PyTorchTransformerWrapper
label_desc: Use image node_id 1 for calling a global function with example usage: detect_and_swap_model(model, data_type, remove_padding) and returns: model