class_docstr: This factory is used to create task models bundling the task,
     encoder, and task head within the task model.
  
  Attributes:
      registry (dict): Dynamic registry mapping task types to task models
class_docstr_tok: ["This","factory","is","used","to","create","task","models","bundling","the","task",",","encoder",",","and","task","head","within","the","task","model",".","Attributes",":","registry","(","dict",")",":","Dynamic","registry","mapping","task","types","to","task","models"]
docstr: This creates the TaskModel corresponding to the Task, abc.abstractmethod,
      and encoder used.
  
  Args:
      task (Task): Task
      encoder (JiantTransformersModel): encoder
      head (BaseHead): Task head
      **kwargs: Additional arguments for initializing TaskModel
  
  Returns:
      TaskModel: Initialized task model bundling task, encoder, and head
docstr_tok: ["This","creates","the","TaskModel","corresponding","to","the","Task",",","abc.abstractmethod",",","and","encoder","used",".","Args",":","task","(","Task",")",":","Task","encoder","(","JiantTransformersModel",")",":","encoder","head","(","BaseHead",")",":","Task","head","*","*","kwargs",":","Additional","arguments","for","initializing","TaskModel","Returns",":","TaskModel",":","Initialized","task","model","bundling","task",",","encoder",",","and","head"]
code: def __call__(cls, task, encoder, head, **kwargs):
      """This creates the TaskModel corresponding to the Task, abc.abstractmethod,
          and encoder used.
  
      Args:
          task (Task): Task
          encoder (JiantTransformersModel): encoder
          head (BaseHead): Task head
          **kwargs: Additional arguments for initializing TaskModel
  
      Returns:
          TaskModel: Initialized task model bundling task, encoder, and head
      """
      taskmodel_class = cls.registry[task.TASK_TYPE]
      taskmodel = taskmodel_class(task, encoder, head, **kwargs)
      return taskmodel
  
imports: import abc
  import torch
  import torch.nn
  from typing import Callable
  import jiant.proj.main.modeling.heads
  from jiant.proj.main.components.outputs import LogitsAndLossOutput
  from jiant.proj.main.components.outputs import LogitsOutput
  from jiant.utils.python.datastructures import take_one
  from jiant.tasks.core import TaskTypes
label_desc: Use image node_id 2 for calling the JiantTaskModelFactory obj's underlying member method code with example usage: obj.__call__(cls, task, encoder, head) and returns: taskmodel