code: def main(num_iterations=10):
      # Active learning parameters
      num_classes = len(TWENTY_NEWS_SUBCATEGORIES)
      model_args = SetFitModelArguments(
          "sentence-transformers/paraphrase-mpnet-base-v2"
      )
      # If GPU memory is a problem:
      # model_args = SetFitModelArguments('sentence-transformers/all-MiniLM-L6-v2')
  
      clf_factory = SetFitClassificationFactory(
          model_args,
          num_classes,
          classification_kwargs=dict(
              {
                  "device": "cuda",
                  "max_seq_len": 64,
                  "mini_batch_size": 8,
              }
          ),
      )
  
      query_strategy = BreakingTies()
  
      # Prepare some data
      train, test = get_twenty_newsgroups_corpus(
          categories=TWENTY_NEWS_SUBCATEGORIES
      )
      train.data = [txt for txt in train.data]
  
      train = TextDataset.from_arrays(
          train.data, train.target, target_labels=np.arange(num_classes)
      )
      test = TextDataset(
          test.data, test.target, target_labels=np.arange(num_classes)
      )
  
      # Active learner
      setfit_train_kwargs = {"show_progress_bar": False}
      active_learner = PoolBasedActiveLearner(
          clf_factory,
          query_strategy,
          train,
          fit_kwargs={"setfit_train_kwargs": setfit_train_kwargs},
      )
      indices_labeled = initialize_active_learner(
          active_learner, train.y
      )
  
      try:
          perform_active_learning(
              active_learner,
              train,
              indices_labeled,
              test,
              num_iterations,
          )
      except PoolExhaustedException:
          print("Error! Not enough samples left to handle the query.")
      except EmptyPoolException:
          print(
              "Error! No more samples left. (Unlabeled pool is empty)"
          )
  
imports: import numpy
  from small_text import EmptyPoolException, PoolBasedActiveLearner, PoolExhaustedException, BreakingTies, SetFitClassificationFactory, SetFitModelArguments, TextDataset, random_initialization_balanced
  from examplecode.data.corpus_twenty_news import get_twenty_newsgroups_corpus
  from examplecode.shared import evaluate
label_desc: Use image node_id 1 for calling a global function with example usage: main(num_iterations) without return types