class_docstr: PyTorch implementation containing all the modelling needed for your NLP task. Combines a language
  model and a prediction head. Allows for gradient flow back to the language model component.
class_docstr_tok: ["PyTorch","implementation","containing","all","the","modelling","needed","for","your","NLP","task",".","Combines","a","language","model","and","a","prediction","head",".","Allows","for","gradient","flow","back","to","the","language","model","component","."]
docstr: Replaces methods in the prediction heads with dummy functions. Used for benchmarking where we want to
  isolate the lm run time from ph run time.
code: def bypass_ph(self):
      """Replaces methods in the prediction heads with dummy functions. Used for benchmarking where we want to
      isolate the lm run time from ph run time."""
  
      def fake_forward(x):
          """Slices lm vector outputs of shape (batch_size, max_seq_len, dims) --> (batch_size, max_seq_len, 2)"""
          return x.narrow(2, 0, 2)
  
      def fake_logits_to_preds(logits, **kwargs):
          batch_size = logits.shape[0]
          return [None, None] * batch_size
  
      def fake_formatted_preds(**kwargs):
          return None
  
      for ph in self.prediction_heads:
          ph.forward = fake_forward
          ph.logits_to_preds = fake_logits_to_preds
          ph.formatted_preds = fake_formatted_preds
  
imports: import copy
  import json
  import logging
  import os
  from pathlib import Path
  import multiprocessing
  import numpy
  import torch
  from torch import nn
  from transformers import AutoConfig
  from transformers.convert_graph_to_onnx import convert, quantize
  from farm.data_handler.processor import Processor
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.prediction_head import PredictionHead, pick_single_fn
  from farm.utils import MLFlowLogger, stack
  import farm.conversion.transformers
label_desc: Use image node_id 3 for calling the AdaptiveModel obj's underlying member method code with example usage: obj.bypass_ph() and returns: x, unknown, None