class_docstr: Implements lit.Model interface for a set of pre-computed predictions.
class_docstr_tok: ["Implements","lit.Model","interface","for","a","set","of","pre-computed","predictions","."]
docstr: Build a static index.
  
  Args:
    inputs: a lit Dataset
    preds: a lit Dataset, parallel to inputs
    input_identifier_keys: (optional), list of keys to treat as identifiers
      for matching inputs. If None, will use all fields in inputs.spec()
docstr_tok: ["Build","a","static","index",".","Args",":","inputs",":","a","lit","Dataset","preds",":","a","lit","Dataset",",","parallel","to","inputs","input_identifier_keys",":","(","optional",")",",","list","of","keys","to","treat","as","identifiers","for","matching","inputs",".","If","None",",","will","use","all","fields","in","inputs.spec","(",")"]
code: def __init__(
      self,
      inputs: lit_dataset.Dataset,
      preds: lit_dataset.Dataset,
      input_identifier_keys: Optional[list[str]] = None,
  ):
      """Build a static index.
  
      Args:
        inputs: a lit Dataset
        preds: a lit Dataset, parallel to inputs
        input_identifier_keys: (optional), list of keys to treat as identifiers
          for matching inputs. If None, will use all fields in inputs.spec()
      """
      self._all_inputs = inputs
      self._input_spec = inputs.spec()
      self._output_spec = preds.spec()
      self._description = preds.description()
      self.input_identifier_keys = (
          input_identifier_keys or self._input_spec.keys()
      )
      # Filter to only the identifier keys
      self._input_spec = {
          k: self._input_spec[k] for k in self.input_identifier_keys
      }
  
      # Build the index for prediction lookups
      self._index = {
          self.key_fn(ex): pred
          for ex, pred in zip(inputs.examples, preds.examples)
      }
  
file_path: lit/lit_nlp/components/static_preds.py
imports: from collections.abc import Iterable, Iterator
  from typing import Optional
  from lit_nlp.api import dataset
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.lib import caching
label_desc: Use image node_id 4 to create a new StaticPredictions object from inherited base classes: lit_model with example: obj = StaticPredictions(inputs, preds, input_identifier_keys)