code: def test_dpr_query_only():
      erroneous_dicts = [
          {
              "query": "where is castle on the hill based on",
              "answers": ["Framlingham Castle"],
          },
          {
              "query": "where is castle on the hill 2 based on",
              "answers": ["Framlingham Castle 2"],
          },
      ]
  
      query_tok = "facebook/dpr-question_encoder-single-nq-base"
      query_tokenizer = Tokenizer.load(query_tok, use_fast=True)
      passage_tok = "facebook/dpr-ctx_encoder-single-nq-base"
      passage_tokenizer = Tokenizer.load(passage_tok, use_fast=True)
      processor = TextSimilarityProcessor(
          query_tokenizer=query_tokenizer,
          passage_tokenizer=passage_tokenizer,
          max_seq_len_query=256,
          max_seq_len_passage=256,
          data_dir="data/retriever",
          train_filename="nq-train.json",
          test_filename="nq-dev.json",
          embed_title=True,
          num_hard_negatives=1,
          label_list=["hard_negative", "positive"],
          metric="text_similarity_metric",
          shuffle_negatives=False,
      )
  
      (
          dataset,
          tensor_names,
          problematic_ids,
          baskets,
      ) = processor.dataset_from_dicts(
          dicts=erroneous_dicts, return_baskets=True
      )
      assert len(problematic_ids) == 0
      assert tensor_names == [
          "query_input_ids",
          "query_segment_ids",
          "query_attention_mask",
      ]
  
imports: import pytest
  import torch
  import logging
  import numpy
  from pathlib import Path
  from torch.utils.data import SequentialSampler
  from tqdm import tqdm
  from farm.data_handler.dataloader import NamedDataLoader
  from farm.data_handler.processor import TextSimilarityProcessor
  from farm.data_handler.data_silo import DataSilo
  from farm.train import Trainer
  from farm.modeling.optimization import initialize_optimizer
  from farm.modeling.biadaptive_model import BiAdaptiveModel
  from farm.modeling.language_model import LanguageModel, DPRContextEncoder, DPRQuestionEncoder
  from farm.modeling.prediction_head import TextSimilarityHead
  from farm.modeling.tokenization import Tokenizer
  from farm.utils import set_all_seeds, initialize_device_settings
label_desc: Use image node_id 5 for calling a global function with example usage: test_dpr_query_only() without return types