class_docstr: This factory is used to create task-specific heads for the supported Transformer encoders.
  
  Attributes:
      registry (dict): Dynamic registry mapping task types to task heads
class_docstr_tok: ["This","factory","is","used","to","create","task-specific","heads","for","the","supported","Transformer","encoders",".","Attributes",":","registry","(","dict",")",":","Dynamic","registry","mapping","task","types","to","task","heads"]
docstr: Summary
  
  Args:
      task (Task): A task head will be created based on the task type
      **kwargs: Arguments required for task head initialization
  
  Returns:
      BaseHead: Initialized task head
code: def __call__(self, task, **kwargs) -> BaseHead:
      """Summary
  
      Args:
          task (Task): A task head will be created based on the task type
          **kwargs: Arguments required for task head initialization
  
      Returns:
          BaseHead: Initialized task head
      """
      head_class = self.registry[task.TASK_TYPE]
      head = head_class(task, **kwargs)
      return head
  
imports: from __future__ import annotations
  import abc
  import torch
  import torch.nn
  import transformers
  from jiant.ext.allennlp import SelfAttentiveSpanExtractor
  from jiant.shared.model_resolution import ModelArchitectures
  from jiant.tasks.core import TaskTypes
  from typing import Callable
  from typing import List
label_desc: Use image node_id 2 for calling the JiantHeadFactory obj's underlying member method code with example usage: obj.__call__(task) and returns: head