class_docstr: AblationFlip generator.
  
  Ablates tokens in input text to generate counterfactuals that flip the
  prediction.
  
  This generator works for both classification and regression models. In the
  case of classification models, the returned counterfactuals are guaranteed to
  have a different prediction class as the original example. In the case of
  regression models, the returned counterfactuals are guaranteed to be on the
  opposite side of a user-provided threshold as the original example.
  
  The returned counterfactuals are guaranteed to be minimal in the sense that
  no strict subset of the applied ablations would have resulted in a
  prediction flip.
  
  The number of model predictions made by this generator is upper-bounded by
  number of tokens + 2^MAX_ABLATABLE_TOKENS. Since MAX_ABLATABLE_TOKENS is a
  constant, effectively this generator makes O(n) model predictions, where n is
  the total number of tokens across all input fields.
code: def __init__(self):
      # TODO(ataly): Use a more sophisticated tokenizer and detokenizer.
      self.tokenize = str.split
      self.detokenize = " ".join
  
imports: import collections
  from collections.abc import Iterator
  import itertools
  from typing import Any, Optional
  from absl import logging
  from lit_nlp.api import components
  from lit_nlp.api import dataset
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.components import cf_utils
  from lit_nlp.lib import utils
label_desc: Use image node_id 1 to create a new AblationFlip object from inherited base classes: lit_components with example: obj = AblationFlip()