code: def convert_hf_model(
      model: PreTrainedModel,
      input_data: List,
      device: Device,
      tokenizer: Optional[PreTrainedTokenizer] = None,
      tokenizer_args: Optional[Dict] = None,
      batch_size: int = 1,
      **kwargs,
  ):
      if is_dict_type(input_data[0]):
          # already tokenized data
          if "labels" in input_data[0]:
              labels = [data.pop("labels") for data in input_data]
          else:
              labels = None
          input_example = input_data[0]
          (
              output_structure,
              output_type,
          ) = get_output_structure_from_dict(
              input_example=input_example,
              model=model,
              device=device,
          )
          input_data = _HFDictDataset(
              input_data=input_data,
              ys=labels,
              keywords=list(input_example.keys()),
          )
  
      else:
          assert tokenizer is not None, (
              "Tokenizer is needed when passing data in string format. Please "
              "provide the tokenizer as keyword argument."
          )
          if tokenizer_args is None:
              tokenizer_args = {}
          if not isinstance(input_data[0], str):
              ys = [data[1] for data in input_data]
              input_data = [data[0] for data in input_data]
          else:
              ys = None
          (
              output_structure,
              output_type,
          ) = get_output_structure_from_text(
              text=input_data[0],
              model=model,
              tokenizer=tokenizer,
              tokenizer_args=tokenizer_args,
              device=device,
          )
          input_example = tokenizer(input_data, **tokenizer_args)
          input_data = _HFTextDataset(
              input_texts=input_data,
              ys=ys,
              keywords=list(input_example.keys()),
              batch_size=batch_size,
              tokenizer=tokenizer,
              tokenizer_args=tokenizer_args,
          )
      if isinstance(model, torch.nn.Module):
          wrapper_model = PyTorchTransformerWrapper(
              core_model=model, encoded_input=input_example
          )
      else:
          wrapper_model = TensorFlowTransformerWrapper(
              core_model=model, encoded_input=input_example
          )
  
      return (
          wrapper_model,
          input_data,
          list(wrapper_model.inputs_types.keys()),
          output_structure,
          output_type,
      )
  
file_path: nebuly/optimization/nebullvm/nebullvm/operations/conversions/huggingface.py
imports: from typing import List, Dict, Sequence, Optional
  import numpy
  from nebullvm.core.models import Device
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch
  from nebullvm.optional_modules.huggingface import PreTrainedTokenizer, PreTrainedModel
  from nebullvm.tools.huggingface import get_output_structure_from_dict, get_output_structure_from_text, PyTorchTransformerWrapper, TensorFlowTransformerWrapper
  from nebullvm.tools.utils import is_dict_type
label_desc: Use image node_id 1 for calling a global function with example usage: convert_hf_model(model, input_data, device, tokenizer, tokenizer_args, batch_size) and returns: wrapper_model,  input_data,  list,  output_structure,  output_type