code: def convert_gpt2_lm_head_model(
      model: GPT2LMHeadModel,
      tokenizer,
      weight_data_type="fp32",
      data_type="fp16",
      use_fp32_to_compute_logit=False,
  ):
      """
      currently doens't support fp8 or multi-gpu
      """
      weights_data_type = weight_data_type
      temp_dir = tempfile.TemporaryDirectory()
      temp_dir_path = temp_dir.name
      ft_model_location = saved_dir = temp_dir_path + "/gpt2"
      hf_config = model.config.to_dict()
      # convert huggingface model to faster transformer model
      convert_huggingface_gpt_to_faster_transformer(
          saved_dir=saved_dir,
          model=model.transformer,
          weight_data_type=weight_data_type,
      )
  
      head_num = hf_config["n_head"]
      layer_num = hf_config["n_layer"]
      start_id = hf_config["bos_token_id"]
      end_id = hf_config["eos_token_id"]
      size_per_head = hf_config["n_embd"] // head_num
  
      vocab_size = tokenizer.vocab_size
  
      tensor_para_size = 1
      pipeline_para_size = 1
      ckpt_path = os.path.join(
          ft_model_location, f"{tensor_para_size}-gpu"
      )
      max_seq_len = hf_config["n_ctx"]
      int8_mode = 0  # 0: no quantization, 1: quantize weights to int8
      # load faster transformer model, note that the lm_head is not saved
      # it's reconstructed during loading from the embedding weights
      gpt = gpt_decoder.Gpt(
          num_heads=head_num,
          size_per_head=size_per_head,
          num_layers=layer_num,
          vocab_size=vocab_size,
          start_id=start_id,
          end_id=end_id,
          tensor_para_size=tensor_para_size,
          pipeline_para_size=pipeline_para_size,
          lib_path=lib_path,
          max_seq_len=max_seq_len,
          int8_mode=int8_mode,
          inference_data_type=data_type,
          weights_data_type=weights_data_type,
          use_fp32_to_compute_logit=use_fp32_to_compute_logit,
      )
      gpt.load(ckpt_path, data_type)
      return FasterTransformerGPT2Wrapper(gpt, model.config)
  
file_path: nebuly/optimization/nebullvm/nebullvm/operations/optimizations/compilers/faster_transformer/gpt/__init__.py
imports: import os
  import tempfile
  from typing import Callable, Iterable, List, Optional, Tuple, Union
  from nebullvm.operations.optimizations.compilers.faster_transformer.gpt.utils import gpt_decoder
  from nebullvm.operations.optimizations.compilers.faster_transformer.gpt.utils.huggingface_gpt_convert import main
  from nebullvm.operations.optimizations.compilers.utils import get_faster_transformer_repo_path
  from nebullvm.optional_modules.huggingface import GPT2LMHeadModel
  from nebullvm.optional_modules.torch import torch
label_desc: Use image node_id 1 for calling a global function with example usage: convert_gpt2_lm_head_model(model, tokenizer, weight_data_type, data_type, use_fp32_to_compute_logit) and returns: FasterTransformerGPT2Wrapper