code: def generate(
      model,
      tokenizer,
      inputs,
      num_beams=1,
      num_beam_groups=1,
      do_sample=False,
      num_return_sequences=1,
      max_new_tokens=100,
  ):
      generate_ids = model.generate(
          inputs.input_ids,
          num_beams=num_beams,
          num_beam_groups=num_beam_groups,
          do_sample=do_sample,
          num_return_sequences=num_return_sequences,
          max_new_tokens=max_new_tokens,
      )
  
      result = tokenizer.batch_decode(
          generate_ids,
          skip_special_tokens=True,
          clean_up_tokenization_spaces=False,
      )
      return result
  
file_path: deepspeedexamples/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/prompt_eval.py
imports: import argparse
  import logging
  import torch
  from transformers import AutoModelForCausalLM
  from dschat.utils.model.model_utils import create_hf_model
  from dschat.utils.utils import load_hf_tokenizer
  from deepspeed import get_accelerator
label_desc: Use image node_id 2 for calling a global function with example usage: generate(model, tokenizer, inputs, num_beams, num_beam_groups, do_sample, num_return_sequences, max_new_tokens) and returns: result