code: 
  
  
  
  """simple docstring"""
  
  
  
  
  from typing import TYPE_CHECKING
  
  from ..utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available
  
  
  _lowerCAmelCase       :      List[Any]							=							{
      "configuration_utils": ["GenerationConfig"],
      "streamers": ["TextIteratorStreamer", "TextStreamer"],
  }
  
  try:
   if not is_torch_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   _lowerCAmelCase       :      Tuple							=							[
       "Constraint",
       "ConstraintListState",
       "DisjunctiveConstraint",
       "PhrasalConstraint",
   ]
   _lowerCAmelCase       :      List[str]							=							[
       "BeamHypotheses",
       "BeamScorer",
       "BeamSearchScorer",
       "ConstrainedBeamSearchScorer",
   ]
   _lowerCAmelCase       :      Optional[Any]							=							[
       "EpsilonLogitsWarper",
       "EtaLogitsWarper",
       "ForcedBOSTokenLogitsProcessor",
       "ForcedEOSTokenLogitsProcessor",
       "HammingDiversityLogitsProcessor",
       "InfNanRemoveLogitsProcessor",
       "LogitsProcessor",
       "LogitsProcessorList",
       "LogitsWarper",
       "MinLengthLogitsProcessor",
       "MinNewTokensLengthLogitsProcessor",
       "NoBadWordsLogitsProcessor",
       "NoRepeatNGramLogitsProcessor",
       "PrefixConstrainedLogitsProcessor",
       "RepetitionPenaltyLogitsProcessor",
       "SequenceBiasLogitsProcessor",
       "EncoderRepetitionPenaltyLogitsProcessor",
       "TemperatureLogitsWarper",
       "TopKLogitsWarper",
       "TopPLogitsWarper",
       "TypicalLogitsWarper",
       "EncoderNoRepeatNGramLogitsProcessor",
       "ExponentialDecayLengthPenalty",
       "LogitNormalization",
   ]
   _lowerCAmelCase       :      Optional[Any]							=							[
       "MaxNewTokensCriteria",
       "MaxLengthCriteria",
       "MaxTimeCriteria",
       "StoppingCriteria",
       "StoppingCriteriaList",
       "validate_stopping_criteria",
   ]
   _lowerCAmelCase       :      str							=							[
       "GenerationMixin",
       "top_k_top_p_filtering",
       "GreedySearchEncoderDecoderOutput",
       "GreedySearchDecoderOnlyOutput",
       "SampleEncoderDecoderOutput",
       "SampleDecoderOnlyOutput",
       "BeamSearchEncoderDecoderOutput",
       "BeamSearchDecoderOnlyOutput",
       "BeamSampleEncoderDecoderOutput",
       "BeamSampleDecoderOnlyOutput",
       "ContrastiveSearchEncoderDecoderOutput",
       "ContrastiveSearchDecoderOnlyOutput",
   ]
  
  try:
   if not is_tf_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   _lowerCAmelCase       :      str							=							[
       "TFForcedBOSTokenLogitsProcessor",
       "TFForcedEOSTokenLogitsProcessor",
       "TFLogitsProcessor",
       "TFLogitsProcessorList",
       "TFLogitsWarper",
       "TFMinLengthLogitsProcessor",
       "TFNoBadWordsLogitsProcessor",
       "TFNoRepeatNGramLogitsProcessor",
       "TFRepetitionPenaltyLogitsProcessor",
       "TFTemperatureLogitsWarper",
       "TFTopKLogitsWarper",
       "TFTopPLogitsWarper",
       "TFForceTokensLogitsProcessor",
       "TFSuppressTokensAtBeginLogitsProcessor",
       "TFSuppressTokensLogitsProcessor",
   ]
   _lowerCAmelCase       :      Optional[Any]							=							[
       "TFGenerationMixin",
       "tf_top_k_top_p_filtering",
       "TFGreedySearchDecoderOnlyOutput",
       "TFGreedySearchEncoderDecoderOutput",
       "TFSampleEncoderDecoderOutput",
       "TFSampleDecoderOnlyOutput",
       "TFBeamSearchEncoderDecoderOutput",
       "TFBeamSearchDecoderOnlyOutput",
       "TFBeamSampleEncoderDecoderOutput",
       "TFBeamSampleDecoderOnlyOutput",
       "TFContrastiveSearchEncoderDecoderOutput",
       "TFContrastiveSearchDecoderOnlyOutput",
   ]
  
  try:
   if not is_flax_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   _lowerCAmelCase       :      Tuple							=							[
       "FlaxForcedBOSTokenLogitsProcessor",
       "FlaxForcedEOSTokenLogitsProcessor",
       "FlaxLogitsProcessor",
       "FlaxLogitsProcessorList",
       "FlaxLogitsWarper",
       "FlaxMinLengthLogitsProcessor",
       "FlaxTemperatureLogitsWarper",
       "FlaxTopKLogitsWarper",
       "FlaxTopPLogitsWarper",
   ]
   _lowerCAmelCase       :      Dict							=							[
       "FlaxGenerationMixin",
       "FlaxGreedySearchOutput",
       "FlaxSampleOutput",
       "FlaxBeamSearchOutput",
   ]
  
  if TYPE_CHECKING:
   from .configuration_utils import GenerationConfig
   from .streamers import TextIteratorStreamer, TextStreamer
  
   try:
    if not is_torch_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from .beam_constraints import Constraint, ConstraintListState, DisjunctiveConstraint, PhrasalConstraint
    from .beam_search import BeamHypotheses, BeamScorer, BeamSearchScorer, ConstrainedBeamSearchScorer
    from .logits_process import (
        EncoderNoRepeatNGramLogitsProcessor,
        EncoderRepetitionPenaltyLogitsProcessor,
        EpsilonLogitsWarper,
        EtaLogitsWarper,
        ExponentialDecayLengthPenalty,
        ForcedBOSTokenLogitsProcessor,
        ForcedEOSTokenLogitsProcessor,
        HammingDiversityLogitsProcessor,
        InfNanRemoveLogitsProcessor,
        LogitNormalization,
        LogitsProcessor,
        LogitsProcessorList,
        LogitsWarper,
        MinLengthLogitsProcessor,
        MinNewTokensLengthLogitsProcessor,
        NoBadWordsLogitsProcessor,
        NoRepeatNGramLogitsProcessor,
        PrefixConstrainedLogitsProcessor,
        RepetitionPenaltyLogitsProcessor,
        SequenceBiasLogitsProcessor,
        TemperatureLogitsWarper,
        TopKLogitsWarper,
        TopPLogitsWarper,
        TypicalLogitsWarper,
    )
    from .stopping_criteria import (
        MaxLengthCriteria,
        MaxNewTokensCriteria,
        MaxTimeCriteria,
        StoppingCriteria,
        StoppingCriteriaList,
        validate_stopping_criteria,
    )
    from .utils import (
        BeamSampleDecoderOnlyOutput,
        BeamSampleEncoderDecoderOutput,
        BeamSearchDecoderOnlyOutput,
        BeamSearchEncoderDecoderOutput,
        ContrastiveSearchDecoderOnlyOutput,
        ContrastiveSearchEncoderDecoderOutput,
        GenerationMixin,
        GreedySearchDecoderOnlyOutput,
        GreedySearchEncoderDecoderOutput,
        SampleDecoderOnlyOutput,
        SampleEncoderDecoderOutput,
        top_k_top_p_filtering,
    )
  
   try:
    if not is_tf_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from .tf_logits_process import (
        TFForcedBOSTokenLogitsProcessor,
        TFForcedEOSTokenLogitsProcessor,
        TFForceTokensLogitsProcessor,
        TFLogitsProcessor,
        TFLogitsProcessorList,
        TFLogitsWarper,
        TFMinLengthLogitsProcessor,
        TFNoBadWordsLogitsProcessor,
        TFNoRepeatNGramLogitsProcessor,
        TFRepetitionPenaltyLogitsProcessor,
        TFSuppressTokensAtBeginLogitsProcessor,
        TFSuppressTokensLogitsProcessor,
        TFTemperatureLogitsWarper,
        TFTopKLogitsWarper,
        TFTopPLogitsWarper,
    )
    from .tf_utils import (
        TFBeamSampleDecoderOnlyOutput,
        TFBeamSampleEncoderDecoderOutput,
        TFBeamSearchDecoderOnlyOutput,
        TFBeamSearchEncoderDecoderOutput,
        TFContrastiveSearchDecoderOnlyOutput,
        TFContrastiveSearchEncoderDecoderOutput,
        TFGenerationMixin,
        TFGreedySearchDecoderOnlyOutput,
        TFGreedySearchEncoderDecoderOutput,
        TFSampleDecoderOnlyOutput,
        TFSampleEncoderDecoderOutput,
        tf_top_k_top_p_filtering,
    )
  
   try:
    if not is_flax_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from .flax_logits_process import (
        FlaxForcedBOSTokenLogitsProcessor,
        FlaxForcedEOSTokenLogitsProcessor,
        FlaxLogitsProcessor,
        FlaxLogitsProcessorList,
        FlaxLogitsWarper,
        FlaxMinLengthLogitsProcessor,
        FlaxTemperatureLogitsWarper,
        FlaxTopKLogitsWarper,
        FlaxTopPLogitsWarper,
    )
    from .flax_utils import FlaxBeamSearchOutput, FlaxGenerationMixin, FlaxGreedySearchOutput, FlaxSampleOutput
  else:
   import sys
  
   _lowerCAmelCase       :      Union[str, Any]							=							_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
  
style_context: 
  
  
  
  """simple docstring"""
  
  
  
  
  def 		__snake_case		(   SCREAMING_SNAKE_CASE__			:		list       )						->     bool:
  
  
  
  
  
       '''simple docstring'''
  
       if not isinstance(SCREAMING_SNAKE_CASE__		,						SCREAMING_SNAKE_CASE__       ):
            raise ValueError("Input series is not valid, valid series - [1, 2/3, 2]"       )
       if len(SCREAMING_SNAKE_CASE__       ) == 0:
            raise ValueError("Input list must be a non empty list"       )
       if len(SCREAMING_SNAKE_CASE__       ) == 1 and series[0] != 0:
            return True
       _UpperCAmelCase    :			Tuple              =					[]
       _UpperCAmelCase    :			Any              =					len(SCREAMING_SNAKE_CASE__       )
       for i in range(0		,						SCREAMING_SNAKE_CASE__       ):
            if series[i] == 0:
                 raise ValueError("Input series cannot have 0 as an element"       )
            rec_series.append(1 / series[i]       )
       _UpperCAmelCase    :			Dict              =					rec_series[1] - rec_series[0]
       for index in range(2		,						SCREAMING_SNAKE_CASE__       ):
            if rec_series[index] - rec_series[index - 1] != common_diff:
                 return False
       return True
  
  def 		__snake_case		(   SCREAMING_SNAKE_CASE__			:		list       )						->     float:
  
  
  
  
  
       '''simple docstring'''
  
       if not isinstance(SCREAMING_SNAKE_CASE__		,						SCREAMING_SNAKE_CASE__       ):
            raise ValueError("Input series is not valid, valid series - [2, 4, 6]"       )
       if len(SCREAMING_SNAKE_CASE__       ) == 0:
            raise ValueError("Input list must be a non empty list"       )
       _UpperCAmelCase    :			Any              =					0
       for val in series:
            answer += 1 / val
       return len(SCREAMING_SNAKE_CASE__       ) / answer
  
  
  if __name__ == "__main__":
   import doctest
  
   doctest.testmod()
  