"""simple docstring"""


from typing import TYPE_CHECKING

from ..utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available


a							={
    'configuration_utils': ['GenerationConfig'],
    'streamers': ['TextIteratorStreamer', 'TextStreamer'],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a							=[
	    'Constraint',
	    'ConstraintListState',
	    'DisjunctiveConstraint',
	    'PhrasalConstraint',
	]
	a							=[
	    'BeamHypotheses',
	    'BeamScorer',
	    'BeamSearchScorer',
	    'ConstrainedBeamSearchScorer',
	]
	a							=[
	    'EpsilonLogitsWarper',
	    'EtaLogitsWarper',
	    'ForcedBOSTokenLogitsProcessor',
	    'ForcedEOSTokenLogitsProcessor',
	    'HammingDiversityLogitsProcessor',
	    'InfNanRemoveLogitsProcessor',
	    'LogitsProcessor',
	    'LogitsProcessorList',
	    'LogitsWarper',
	    'MinLengthLogitsProcessor',
	    'MinNewTokensLengthLogitsProcessor',
	    'NoBadWordsLogitsProcessor',
	    'NoRepeatNGramLogitsProcessor',
	    'PrefixConstrainedLogitsProcessor',
	    'RepetitionPenaltyLogitsProcessor',
	    'SequenceBiasLogitsProcessor',
	    'EncoderRepetitionPenaltyLogitsProcessor',
	    'TemperatureLogitsWarper',
	    'TopKLogitsWarper',
	    'TopPLogitsWarper',
	    'TypicalLogitsWarper',
	    'EncoderNoRepeatNGramLogitsProcessor',
	    'ExponentialDecayLengthPenalty',
	    'LogitNormalization',
	]
	a							=[
	    'MaxNewTokensCriteria',
	    'MaxLengthCriteria',
	    'MaxTimeCriteria',
	    'StoppingCriteria',
	    'StoppingCriteriaList',
	    'validate_stopping_criteria',
	]
	a							=[
	    '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:
	a							=[
	    'TFForcedBOSTokenLogitsProcessor',
	    'TFForcedEOSTokenLogitsProcessor',
	    'TFLogitsProcessor',
	    'TFLogitsProcessorList',
	    'TFLogitsWarper',
	    'TFMinLengthLogitsProcessor',
	    'TFNoBadWordsLogitsProcessor',
	    'TFNoRepeatNGramLogitsProcessor',
	    'TFRepetitionPenaltyLogitsProcessor',
	    'TFTemperatureLogitsWarper',
	    'TFTopKLogitsWarper',
	    'TFTopPLogitsWarper',
	    'TFForceTokensLogitsProcessor',
	    'TFSuppressTokensAtBeginLogitsProcessor',
	    'TFSuppressTokensLogitsProcessor',
	]
	a							=[
	    '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:
	a							=[
	    'FlaxForcedBOSTokenLogitsProcessor',
	    'FlaxForcedEOSTokenLogitsProcessor',
	    'FlaxLogitsProcessor',
	    'FlaxLogitsProcessorList',
	    'FlaxLogitsWarper',
	    'FlaxMinLengthLogitsProcessor',
	    'FlaxTemperatureLogitsWarper',
	    'FlaxTopKLogitsWarper',
	    'FlaxTopPLogitsWarper',
	]
	a							=[
	    '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

	a							=_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



"""simple docstring"""


from __future__ import annotations

from enum import Enum






class        __UpperCAmelCase						(     __lowerCAmelCase     ):
				A__				:       List[Any]  							=	2_4
				A__				:       List[str]  							=	2_1
				A__				:       List[Any]  							=	1_8
				A__				:       Optional[Any]  							=	1_5
				A__				:       List[Any]  							=	1_2
				A__				:       Optional[int]  							=	9
				A__				:       List[Any]  							=	6
				A__				:       int  							=	3
				A__				:       Optional[int]  							=	2
				A__				:       int  							=	1
				A__				:       Optional[int]  							=	-1
				A__				:       Dict  							=	-2
				A__				:       Optional[Any]  							=	-3
				A__				:       str  							=	-6
				A__				:       Union[str, Any]  							=	-9
				A__				:       Optional[Any]  							=	-1_2
				A__				:       int  							=	-1_5
				A__				:       Union[str, Any]  							=	-1_8
				A__				:       Any  							=	-2_1
				A__				:       Union[str, Any]  							=	-2_4






class        __UpperCAmelCase						(     __lowerCAmelCase     ):
				A__				:       Optional[int]  							=	8
				A__				:       Any  							=	7
				A__				:       Any  							=	6
				A__				:       Tuple  							=	5
				A__				:       Optional[Any]  							=	4
				A__				:       str  							=	3
				A__				:       Dict  							=	2
				A__				:       Tuple  							=	1





def       lowerCamelCase_			( __lowerCAmelCase       ,   __lowerCAmelCase       ,   __lowerCAmelCase       ,   )							-> float:




						'''simple docstring'''



						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =SIUnit[known_prefix.lower()]
						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =SIUnit[unknown_prefix.lower()]
						lowerCamelCase__ =known_amount * (
						    10 ** (known_prefix.value - unknown_prefix.value)
						)
						return unknown_amount





def       lowerCamelCase_			( __lowerCAmelCase       ,   __lowerCAmelCase       ,   __lowerCAmelCase       ,   )							-> float:




						'''simple docstring'''



						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =BinaryUnit[known_prefix.lower()]
						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =BinaryUnit[unknown_prefix.lower()]
						lowerCamelCase__ =known_amount * (
						    2 ** ((known_prefix.value - unknown_prefix.value) * 10)
						)
						return unknown_amount


if __name__ == "__main__":
	import doctest

	doctest.testmod()


