code: def _finetune_translate(df, args):
      config = AutoConfig.from_pretrained(args["model_name"])
      df = df.rename(
          columns={
              args["target"]: "translation",
              args["input_column"]: "text",
          }
      )
      tokenizer_from = args.get("using", {}).get(
          "tokenizer_from", args["model_name"]
      )
      tokenizer = AutoTokenizer.from_pretrained(tokenizer_from)
      dataset = Dataset.from_pandas(df)
  
      def _tokenize_translate_fn(examples):
          source_lang = args["lang_input"]
          target_lang = args["lang_output"]
          max_target_length = config.task_specific_params[
              "summarization"
          ]["max_length"]
          prefix = f"translate {source_lang} to {target_lang}: "
          inputs = [prefix + ex for ex in examples["text"]]
          targets = [ex for ex in examples["translation"]]
          model_inputs = tokenizer(
              inputs, max_length=config.n_positions, truncation=True
          )
  
          # Setup the tokenizer for targets
          with tokenizer.as_target_tokenizer():
              labels = tokenizer(
                  targets, max_length=max_target_length, truncation=True
              )
  
          model_inputs["labels"] = labels["input_ids"]
          return model_inputs
  
      tokenized_datasets = dataset.map(
          _tokenize_translate_fn, batched=True
      )
      ds = tokenized_datasets.shuffle(seed=42).train_test_split(
          test_size=args.get("eval_size", 0.1)
      )
      train_ds = ds["train"]
      eval_ds = ds["test"]
      ft_args = args.get("using", {}).get("trainer_args", {})
      ft_args["output_dir"] = args["model_folder"]
      ft_args["predict_with_generate"] = True
  
      model = AutoModelForSeq2SeqLM.from_pretrained(
          args["model_name"], config=config
      )
      model.resize_token_embeddings(len(tokenizer))
      training_args = Seq2SeqTrainingArguments(**ft_args)
      data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)
  
      # generate trainer and finetune
      trainer = Trainer(
          model=model,
          args=training_args,
          train_dataset=train_ds,
          eval_dataset=eval_ds,
          data_collator=data_collator,
          # compute_metrics=_compute_metrics,
      )
  
      return tokenizer, trainer
  
file_path: mindsdb/mindsdb/integrations/handlers/huggingface_handler/finetune.py
imports: import evaluate
  import nltk
  import numpy
  from datasets import Dataset
  from transformers import AutoConfig, AutoModelForSeq2SeqLM, AutoModelForSequenceClassification, AutoTokenizer, DataCollatorForSeq2Seq, Seq2SeqTrainingArguments, Trainer, TrainingArguments
label_desc: Use image node_id 2 for calling a global function with example usage: _finetune_translate(df, args) and returns: tokenizer,  trainer, model_inputs