class_docstr: Base Class for implementing AdaptiveModel with frameworks like PyTorch and ONNX.
class_docstr_tok: ["Base","Class","for","implementing","AdaptiveModel","with","frameworks","like","PyTorch","and","ONNX","."]
docstr: Populates prediction head with information coming from tasks.
  
  :param tasks: A dictionary where the keys are the names of the tasks and the values are the details of the task (e.g. label_list, metric, tensor name)
  :param require_labels: If True, an error will be thrown when a task is not supplied with labels)
  :return:
docstr_tok: ["Populates","prediction","head","with","information","coming","from","tasks",".",":","param","tasks",":","A","dictionary","where","the","keys","are","the","names","of","the","tasks","and","the","values","are","the","details","of","the","task","(","e.g",".","label_list",",","metric",",","tensor","name",")",":","param","require_labels",":","If","True",",","an","error","will","be","thrown","when","a","task","is","not","supplied","with","labels",")",":","return",":"]
code: def connect_heads_with_processor(self, tasks, require_labels=True):
      """
      Populates prediction head with information coming from tasks.
  
      :param tasks: A dictionary where the keys are the names of the tasks and the values are the details of the task (e.g. label_list, metric, tensor name)
      :param require_labels: If True, an error will be thrown when a task is not supplied with labels)
      :return:
      """
  
      for head in self.prediction_heads:
          head.label_tensor_name = tasks[head.task_name][
              "label_tensor_name"
          ]
          label_list = tasks[head.task_name]["label_list"]
          if not label_list and require_labels:
              raise Exception(
                  f"The task '{head.task_name}' is missing a valid set of labels"
              )
          label_list = tasks[head.task_name]["label_list"]
          head.label_list = label_list
          num_labels = len(label_list)
          head.metric = tasks[head.task_name]["metric"]
  
imports: import copy
  import json
  import logging
  import os
  from argparse import Namespace
  from pathlib import Path
  import multiprocessing
  import numpy
  import torch
  from torch import nn
  from farm.data_handler.processor import TextSimilarityProcessor
  from farm.data_handler.data_silo import DataSilo
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.prediction_head import PredictionHead, TextSimilarityHead
  from farm.modeling.tokenization import Tokenizer
  from farm.utils import MLFlowLogger, stack
label_desc: Use image node_id 6 for calling the BaseBiAdaptiveModel obj's underlying member method code with example usage: obj.connect_heads_with_processor(tasks, require_labels) without return types