class_docstr: Wrapper to add per-example caching to a LIT model.
docstr: Cache projections from ProjectorModel dimensionality reducers.
code: def fit_transform(self, inputs: Iterable[JsonDict]):
      """Cache projections from ProjectorModel dimensionality reducers."""
      wrapped = self.wrapped
      if not isinstance(wrapped, lit_model.ProjectorModel):
          raise TypeError(
              "Attempted to call fit_transform() on a non-ProjectorModel."
          )
  
      inputs_as_list = list(inputs)
      cache_keys = [self.key_fn(d) for d in inputs_as_list]
      if none_keys := [k for k in cache_keys if k is None]:
          logging.warning(
              "Attmepting to cache %d (of %d) where the cache key is None "
              "- this can be from a missing or empty example id. These"
              " will be recomputed on subsequent attempts.",
              len(none_keys),
              len(cache_keys),
          )
      outputs = list(wrapped.fit_transform(inputs_as_list))
      with self._cache.lock:
          for cache_key, output in zip(
              cache_keys, outputs, strict=True
          ):
              self._cache.put(output, cache_key)
      return outputs
  
imports: from collections.abc import Callable, Iterable
  import os
  import pickle
  import threading
  from typing import Any, Optional, Union
  from absl import logging
  from lit_nlp.api import dataset
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.lib import serialize
label_desc: Use image node_id 6 for calling the CachingModelWrapper obj's underlying member method code with example usage: obj.fit_transform(inputs) and returns: outputs