class_docstr: Pairwise ranking model
  This model takes in a query, and two responses (pos_response and neg_response)
  It passes representations of the query and the two responses to a decoder
  pos_response should be ranked higher than neg_response - this is ensured by training
  with a ranking hinge loss function
code: def from_config(
      cls, config: Config, tensorizers: Dict[str, Tensorizer]
  ):
      # merge tensorizer vocab
      vocab_builder = VocabBuilder()
      for tensorizer in tensorizers.values():
          vocab_builder.add_all(tensorizer.vocab.counts)
      merged_vocab = vocab_builder.make_vocab()
      for tensorizer in tensorizers.values():
          tensorizer.vocab = merged_vocab
  
      # create embeddings
      positive_emb = create_module(
          config.embedding, None, tensorizers["pos_response"]
      )
      negative_emb = positive_emb
      query_emb = positive_emb
      embeddings = nn.ModuleList(
          [positive_emb, negative_emb, query_emb]
      )
      embedding_dim = embeddings[0].embedding_dim
  
      # create representations
      positive_repr = create_module(
          config.representation, embed_dim=embedding_dim
      )
      negative_repr = positive_repr
      query_repr = (
          positive_repr
          if config.shared_representations
          else create_module(
              config.representation, embed_dim=embedding_dim
          )
      )
      representations = nn.ModuleList(
          [positive_repr, negative_repr, query_repr]
      )
  
      # representation.representation_dim: tuple(2, actual repr dim)
      decoder = create_module(
          config.decoder,
          from_dim=representations[0].representation_dim,
          to_dim=config.decoder_output_dim,
      )
      output_layer = create_module(config.output_layer)
      return cls(
          embeddings,
          representations,
          decoder,
          output_layer,
          encode_relations=False,
          shared_representations=config.shared_representations,
      )
  
file_path: pytext/pytext/models/query_document_pairwise_ranking_model.py
imports: from typing import Dict, List, Tuple
  import torch
  import torch.nn
  from pytext.data.tensorizers import Tensorizer, TokenTensorizer, VocabBuilder
  from pytext.models.decoders.mlp_decoder_query_response import MLPDecoderQueryResponse
  from pytext.models.model import Model
  from pytext.models.module import create_module
  from pytext.models.output_layers import PairwiseRankingOutputLayer
  from pytext.models.pair_classification_model import PairwiseModel
label_desc: Use image node_id 1 for calling the QueryDocPairwiseRankingModel obj's underlying member method code with example usage: obj.from_config(cls, config, tensorizers) and returns: cls