code: def generate_text(
      self, text: str, args: GENSettings = GENSettings()
  ) -> GenerationResult:
      # loads pipeline if it hasn't been loaded already.
      self._load_pipeline()
  
      self.__assert_default_text_is_val(text)
      input_ids = self.tokenizer.encode(text, return_tensors="pt")
      adjusted_min_length = args.min_length + len(input_ids[0])
      adjusted_max_length = args.max_length + len(input_ids[0])
      if args.bad_words:
          bad_words_ids = [
              self.tokenizer(" " + phrase.strip()).input_ids
              for phrase in args.bad_words
          ]
      else:
          bad_words_ids = None
  
      output = self._pipeline(
          text,
          min_length=adjusted_min_length,
          return_full_text=False,
          max_length=adjusted_max_length,
          do_sample=args.do_sample,
          early_stopping=args.early_stopping,
          num_beams=args.num_beams,
          temperature=args.temperature,
          top_k=args.top_k,
          no_repeat_ngram_size=args.no_repeat_ngram_size,
          top_p=args.top_p,
          bad_words_ids=bad_words_ids,
      )
      return GenerationResult(text=output[0]["generated_text"])
  
imports: from dataclasses import dataclass
  from typing import List, Union
  from datasets import Dataset
  from transformers import AutoModelForCausalLM, default_data_collator, TextGenerationPipeline
  from happytransformer.adaptors import get_adaptor
  from happytransformer.args import GENEvalArgs, GENTrainArgs
  from happytransformer.fine_tuning_util import csv_tok_text_gen_mlm, EvalResult, tok_text_gen_mlm
  from happytransformer.happy_transformer import HappyTransformer
label_desc: Use image node_id 4 for calling the HappyGeneration obj's underlying member method code with example usage: obj.generate_text(text, args) and returns: GenerationResult