





"""simple docstring"""
from typing import TYPE_CHECKING

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


_snake_case	:						List[Any]					=					{
    'configuration_utils': ['GenerationConfig'],
    'streamers': ['TextIteratorStreamer', 'TextStreamer'],
}

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

		_snake_case	:						Tuple					=					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



'''simple docstring'''

import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding




class 		SCREAMING_SNAKE_CASE_					(_UpperCAmelCase      ):



			"""simple docstring"""






			__magic_name__ :				Dict   							=       ["""image_processor""", """tokenizer"""]
			__magic_name__ :				Union[str, Any]   							=       """VideoMAEImageProcessor"""
			__magic_name__ :				List[str]   							=       ("""CLIPTokenizer""", """CLIPTokenizerFast""")



			def __init__(							self				,			snake_case_=None				,			snake_case_=None				,			**snake_case_					):
									snake_case :       int				=    None
									if "feature_extractor" in kwargs:
															warnings.warn(
															    "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
															    " instead."				,			snake_case_				,			)
															snake_case :       Optional[int]				=    kwargs.pop("feature_extractor"					)

									snake_case :       Union[str, Any]				=    image_processor if image_processor is not None else feature_extractor
									if image_processor is None:
															raise ValueError("You need to specify an `image_processor`."					)
									if tokenizer is None:
															raise ValueError("You need to specify a `tokenizer`."					)

									super().__init__(snake_case_				,			snake_case_					)
									snake_case :       List[Any]				=    self.image_processor



			def __call__(							self				,			snake_case_=None				,			snake_case_=None				,			snake_case_=None				,			**snake_case_					):

									if text is None and videos is None:
															raise ValueError("You have to specify either text or videos. Both cannot be none."					)

									if text is not None:
															snake_case :       List[Any]				=    self.tokenizer(snake_case_				,			return_tensors=snake_case_				,			**snake_case_					)

									if videos is not None:
															snake_case :       List[Any]				=    self.image_processor(snake_case_				,			return_tensors=snake_case_				,			**snake_case_					)

									if text is not None and videos is not None:
															snake_case :       Tuple				=    image_features.pixel_values
															return encoding
									elif text is not None:
															return encoding
									else:
															return BatchEncoding(data=dict(**snake_case_					)				,			tensor_type=snake_case_					)



			def   lowerCamelCase (							self				,			*snake_case_				,			**snake_case_					):
									return self.tokenizer.batch_decode(*snake_case_				,			**snake_case_					)



			def   lowerCamelCase (							self				,			*snake_case_				,			**snake_case_					):
									return self.tokenizer.decode(*snake_case_				,			**snake_case_					)



			@property
			def   lowerCamelCase (							self					):
									return ["input_ids", "attention_mask", "position_ids", "pixel_values"]



			@property
			def   lowerCamelCase (							self					):
									warnings.warn(
									    "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."				,			snake_case_				,			)
									return self.image_processor_class






			@property
			def   lowerCamelCase (							self					):
									warnings.warn(
									    "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."				,			snake_case_				,			)
									return self.image_processor





