code: def finetune(
      self,
      df: Optional[pd.DataFrame] = None,
      args: Optional[Dict] = None,
  ) -> None:
      finetune_args = args if args else {}
      args = self.base_model_storage.json_get("args")
      args.update(finetune_args)
  
      model_name = args["model_name"]
      model_folder = self.model_storage.folder_get(model_name)
      args["model_folder"] = model_folder
      model_folder_name = model_folder.split("/")[-1]
      task = args["task"]
  
      if task not in FINETUNE_MAP:
          raise KeyError(
              f"{task} is not currently supported, please choose a supported task - {', '.join(FINETUNE_MAP)}"
          )
  
      tokenizer, trainer = FINETUNE_MAP[task](df, args)
  
      try:
          trainer.train()
          trainer.save_model(
              model_folder
          )  # TODO: save entire pipeline instead https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.Pipeline.save_pretrained
          tokenizer.save_pretrained(model_folder)
  
          # persist changes
          self.model_storage.json_set("args", args)
          self.model_storage.folder_sync(model_folder_name)
  
      except Exception as e:
          err_str = f"Finetune failed with error: {str(e)}"
          logger.debug(err_str)
          raise Exception(err_str)
  
file_path: mindsdb/mindsdb/integrations/handlers/huggingface_handler/huggingface_handler.py
imports: from typing import Dict, Optional
  import pandas
  import transformers
  from huggingface_hub import HfApi
  from mindsdb.integrations.handlers.huggingface_handler.settings import FINETUNE_MAP
  from mindsdb.integrations.libs.base import BaseMLEngine
  from mindsdb.utilities import log
label_desc: Use image node_id 11 for calling the HuggingFaceHandler obj's underlying member method code with example usage: obj.finetune(df, args) without return types