code: def main(num_iterations=10):
      device = "cuda"
  
      # Prepare some data
      train, test = get_train_test()
      train, test = preprocess_data(train, test)
      num_classes = len(np.unique(train.y))
  
      # Active learning parameters
      classifier_kwargs = dict(
          {
              "embedding_matrix": load_gensim_embedding(train.vocab),
              "max_seq_len": 512,
              "num_epochs": 4,
              "device": device,
          }
      )
  
      clf_factory = KimCNNFactory(
          "kimcnn", num_classes, classifier_kwargs
      )
      query_strategy = ExpectedGradientLength(
          num_classes, device=device
      )
  
      # Active learner
      active_learner = PoolBasedActiveLearner(
          clf_factory, query_strategy, train
      )
      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)"
          )
  
file_path: small-text/examples/examplecode/pytorch_multiclass_classification.py
imports: import torch
  import numpy
  from small_text import ActiveLearnerException, EmptyPoolException, ExpectedGradientLength, KimCNNFactory, PoolBasedActiveLearner, PoolExhaustedException, random_initialization_stratified
  from examplecode.data.example_data_multiclass import get_train_test, preprocess_data
  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