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: This iterates over each prediction head and ensures that its input dimensionality matches the output
  dimensionality of the language model. If it doesn't, it is resized so it does fit
code: def fit_heads_to_lm(self):
      """This iterates over each prediction head and ensures that its input dimensionality matches the output
      dimensionality of the language model. If it doesn't, it is resized so it does fit
      """
      for ph in self.prediction_heads:
          ph.resize_input(self.lm_output_dims)
          ph.to(self.device)
  
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 2 for calling the AdaptiveModel obj's underlying member method code with example usage: obj.fit_heads_to_lm() without return types