class_docstr: Base class for LIT models.
docstr: Attempts to infer a Spec describing a Model's constructor parameters.
  
  The Model base class attempts to infer a Spec for the constructor using
  `lit_nlp.api.types.infer_spec_for_func()`.
  
  If successful, this function will return a `dict[str, LitType]`. If
  unsucessful (i.e., the inferencer raises a `TypeError` because it encounters
  a parameter that it not supported by `infer_spec_for_func()`), this function
  will return None, log a warning describing where and how the inferencing
  failed, and LIT users **will not** be able to load new instances of this
  model from the UI.
  
  Returns:
    A Spec representation of the Model's constructor, or None if a Spec could
    not be inferred.
docstr_tok: ["Attempts","to","infer","a","Spec","describing","a","Model","'s","constructor","parameters",".","The","Model","base","class","attempts","to","infer","a","Spec","for","the","constructor","using","`","lit_nlp.api.types.infer_spec_for_func","(",")","`",".","If","successful",",","this","function","will","return","a","`","dict","[","str",",","LitType","]","`",".","If","unsucessful","(","i.e.",",","the","inferencer","raises","a","`","TypeError","`","because","it","encounters","a","parameter","that","it","not","supported","by","`","infer_spec_for_func","(",")","`",")",",","this","function","will","return","None",",","log","a","warning","describing","where","and","how","the","inferencing","failed",",","and","LIT","users","*","*","will","not","*","*","be","able","to","load","new","instances","of","this","model","from","the","UI",".","Returns",":","A","Spec","representation","of","the","Model","'s","constructor",",","or","None","if","a","Spec","could","not","be","inferred","."]
code: def init_spec(cls) -> Optional[Spec]:
      """Attempts to infer a Spec describing a Model's constructor parameters.
  
      The Model base class attempts to infer a Spec for the constructor using
      `lit_nlp.api.types.infer_spec_for_func()`.
  
      If successful, this function will return a `dict[str, LitType]`. If
      unsucessful (i.e., the inferencer raises a `TypeError` because it encounters
      a parameter that it not supported by `infer_spec_for_func()`), this function
      will return None, log a warning describing where and how the inferencing
      failed, and LIT users **will not** be able to load new instances of this
      model from the UI.
  
      Returns:
        A Spec representation of the Model's constructor, or None if a Spec could
        not be inferred.
      """
      try:
          spec = types.infer_spec_for_func(cls.__init__)
      except TypeError as e:
          spec = None
          logging.warning(
              "Unable to infer init spec for model '%s'. %s",
              cls.__name__,
              str(e),
          )
      return spec
  
imports: import abc
  from collections.abc import Iterable, Iterator
  import inspect
  import itertools
  import multiprocessing
  from typing import Optional, Union
  from absl import logging
  from lit_nlp.api import dataset
  from lit_nlp.api import types
  from lit_nlp.lib import utils
  import numpy
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj.init_spec(cls) and returns: spec