code: def adaptive_model_qa(use_gpu, num_processes):
      """
      PyTest Fixture for a Question Answering Inferencer based on PyTorch.
      """
      try:
          model = Inferencer.load(
              "deepset/bert-base-cased-squad2",
              task_type="question_answering",
              batch_size=16,
              num_processes=num_processes,
              gpu=use_gpu,
          )
          yield model
      finally:
          if num_processes != 0:
              # close the pool
              # we pass join=True to wait for all sub processes to close
              # this is because below we want to test if all sub-processes
              # have exited
              model.close_multiprocessing_pool(join=True)
  
      # check if all workers (sub processes) are closed
      current_process = psutil.Process()
      children = current_process.children()
      assert len(children) == 0
  
file_path: FARM/test/conftest.py
imports: import psutil
  import pytest
  from pathlib import Path
  from farm.data_handler.data_silo import DataSilo
  from farm.data_handler.processor import SquadProcessor
  from farm.modeling.adaptive_model import AdaptiveModel
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.optimization import initialize_optimizer
  from farm.modeling.prediction_head import QuestionAnsweringHead
  from farm.modeling.tokenization import Tokenizer
  from farm.train import Trainer
  from farm.utils import set_all_seeds, initialize_device_settings
  from farm.infer import Inferencer, QAInferencer
label_desc: Use image node_id 4 for calling a global function with example usage: adaptive_model_qa(use_gpu, num_processes) without return types