code: def search_hp(
      args,
      features,
      labels,
      memory_bank_model,
      logits_type=None,
  ):
      """
      Search the best hyper-parameters of alpha and beta.
  
      Parameters
      ----------
      args
          The args of searching scales and steps.
      features, labels
          The preprocessed features and labels of validation set.
      memory_bank_model
          The AutoMMMemoryBank to generate logits and logits with memory bank.
      logits_type
          The target logits of searching corresponding to "adapted_logits" and "adapted_logits_with_finetuning".
  
      Return
      ------
      The best hyper-parameters of alpha and beta.
      """
      beta_list = [
          i * (args.search_scale[0] - 0.1) / args.search_step[0] + 0.1
          for i in range(args.search_step[0])
      ]
      alpha_list = [
          i * (args.search_scale[1] - 0.1) / args.search_step[1] + 0.1
          for i in range(args.search_step[1])
      ]
  
      best_acc = 0
      best_beta, best_alpha = 0, 0
  
      pure_logits = None
      for beta in beta_list:
          for alpha in alpha_list:
              with torch.no_grad():
                  logits = memory_bank_model(
                      features, alpha, beta, pure_logits
                  )
              if pure_logits is None:
                  pure_logits = logits["pure_logits"]
              acc = cls_acc(logits[logits_type], labels)
  
              if acc > best_acc:
                  print(
                      "New best setting, beta: {:.2f}, alpha: {:.2f}; accuracy: {:.2f}".format(
                          beta, alpha, acc
                      )
                  )
                  best_acc = acc
                  best_beta = beta
                  best_alpha = alpha
  
          print(
              "\nAfter searching, the best accuracy: {:.2f}.\n".format(
                  best_acc
              )
          )
  
      return best_beta, best_alpha
  
imports: import torch
  import pandas
  from tqdm import tqdm
  import torch.nn.functional
  import torch.nn
  from autogluon.multimodal import MultiModalPredictor
  from datasets import list_datasets, load_dataset
  from setfit import sample_dataset
  from imagedatasets import build_dataset
  from torch.utils.data import Dataset
label_desc: Use image node_id 8 for calling a global function with example usage: search_hp(args, features, labels, memory_bank_model, logits_type) and returns: best_beta,  best_alpha