




'''simple docstring'''




import unittest

from transformers import ErnieMConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch

							from transformers import (
							    ErnieMForInformationExtraction,
							    ErnieMForMultipleChoice,
							    ErnieMForQuestionAnswering,
							    ErnieMForSequenceClassification,
							    ErnieMForTokenClassification,
							    ErnieMModel,
							)
							from transformers.models.ernie_m.modeling_ernie_m import ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST






class      UpperCamelCase_  :







						"""simple docstring"""


						def __init__(  self   :							Any				,			_lowerCamelCase   :							str				,			_lowerCamelCase   :							Optional[Any]=13				,			_lowerCamelCase   :							Tuple=7				,			_lowerCamelCase   :							Optional[int]=True				,			_lowerCamelCase   :							Tuple=True				,			_lowerCamelCase   :							Tuple=True				,			_lowerCamelCase   :							List[str]=99				,			_lowerCamelCase   :							Optional[int]=32				,			_lowerCamelCase   :							Optional[int]=5				,			_lowerCamelCase   :							Union[str, Any]=4				,			_lowerCamelCase   :							Any=37				,			_lowerCamelCase   :							Tuple="gelu"				,			_lowerCamelCase   :							Optional[int]=0.1				,			_lowerCamelCase   :							Tuple=0.1				,			_lowerCamelCase   :							Tuple=512				,			_lowerCamelCase   :							int=16				,			_lowerCamelCase   :							Optional[int]=2				,			_lowerCamelCase   :							Union[str, Any]=0.02				,			_lowerCamelCase   :							Any=3				,			_lowerCamelCase   :							Union[str, Any]=4				,			_lowerCamelCase   :							Tuple=None				,			):





											"""simple docstring"""







											A_			:  str			=				parent
											A_			:  Optional[int]			=				batch_size
											A_			:  Optional[Any]			=				seq_length
											A_			:  Union[str, Any]			=				is_training
											A_			:  Tuple			=				use_input_mask
											A_			:  Optional[int]			=				use_labels
											A_			:  Dict			=				vocab_size
											A_			:  Tuple			=				hidden_size
											A_			:  List[str]			=				num_hidden_layers
											A_			:  Dict			=				num_attention_heads
											A_			:  int			=				intermediate_size
											A_			:  List[Any]			=				hidden_act
											A_			:  Dict			=				hidden_dropout_prob
											A_			:  Optional[Any]			=				attention_probs_dropout_prob
											A_			:  Union[str, Any]			=				max_position_embeddings
											A_			:  List[Any]			=				type_vocab_size
											A_			:  str			=				type_sequence_label_size
											A_			:  str			=				initializer_range
											A_			:  Tuple			=				num_labels
											A_			:  List[str]			=				num_choices
											A_			:  Optional[int]			=				scope







						def    _a     (  self   :							List[str]     ):





											"""simple docstring"""







											A_			:  str			=				ids_tensor([self.batch_size, self.seq_length]				,			self.vocab_size     )

											A_			:  Optional[Any]			=				None
											if self.use_input_mask:
																A_			:  Optional[Any]			=				random_attention_mask([self.batch_size, self.seq_length]     )

											A_			:  List[Any]			=				None
											A_			:  str			=				None
											A_			:  int			=				None
											if self.use_labels:
																A_			:  Dict			=				ids_tensor([self.batch_size]				,			self.type_sequence_label_size     )
																A_			:  Optional[Any]			=				ids_tensor([self.batch_size, self.seq_length]				,			self.num_labels     )
																A_			:  Any			=				ids_tensor([self.batch_size]				,			self.num_choices     )

											A_			:  str			=				self.get_config()

											return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels







						def    _a     (  self   :							int     ):





											"""simple docstring"""







											A_			:  Dict			=				ids_tensor([self.batch_size, self.seq_length]				,			self.vocab_size     )

											A_			:  List[str]			=				None
											if self.use_input_mask:
																A_			:  Optional[int]			=				random_attention_mask([self.batch_size, self.seq_length]     )
											A_			:  Tuple			=				self.get_config()

											return config, input_ids, input_mask







						def    _a     (  self   :							int     ):





											"""simple docstring"""







											return ErnieMConfig(
											    vocab_size=self.vocab_size				,			hidden_size=self.hidden_size				,			num_hidden_layers=self.num_hidden_layers				,			num_attention_heads=self.num_attention_heads				,			intermediate_size=self.intermediate_size				,			hidden_act=self.hidden_act				,			hidden_dropout_prob=self.hidden_dropout_prob				,			attention_probs_dropout_prob=self.attention_probs_dropout_prob				,			max_position_embeddings=self.max_position_embeddings				,			type_vocab_size=self.type_vocab_size				,			initializer_range=self.initializer_range				,			)







						def    _a     (  self   :							List[Any]				,			_lowerCamelCase   :							Tuple				,			_lowerCamelCase   :							List[str]				,			_lowerCamelCase   :							Union[str, Any]				,			_lowerCamelCase   :							Optional[int]				,			_lowerCamelCase   :							str				,			_lowerCamelCase   :							Tuple     ):





											"""simple docstring"""







											A_			:  str			=				ErnieMModel(config=_lowerCamelCase     )
											model.to(_lowerCamelCase     )
											model.eval()
											A_			:  Tuple			=				model(_lowerCamelCase				,			return_dict=_lowerCamelCase     )
											self.parent.assertEqual(result.last_hidden_state.shape				,			(self.batch_size, self.seq_length, self.hidden_size)     )







						def    _a     (  self   :							int				,			_lowerCamelCase   :							List[str]				,			_lowerCamelCase   :							Optional[Any]				,			_lowerCamelCase   :							int				,			_lowerCamelCase   :							List[str]				,			_lowerCamelCase   :							Tuple				,			_lowerCamelCase   :							Union[str, Any]     ):





											"""simple docstring"""







											A_			:  Dict			=				ErnieMForQuestionAnswering(config=_lowerCamelCase     )
											model.to(_lowerCamelCase     )
											model.eval()
											A_			:  str			=				model(
											    _lowerCamelCase				,			attention_mask=_lowerCamelCase				,			start_positions=_lowerCamelCase				,			end_positions=_lowerCamelCase				,			)
											self.parent.assertEqual(result.start_logits.shape				,			(self.batch_size, self.seq_length)     )
											self.parent.assertEqual(result.end_logits.shape				,			(self.batch_size, self.seq_length)     )







						def    _a     (  self   :							Optional[Any]				,			_lowerCamelCase   :							Any				,			_lowerCamelCase   :							int				,			_lowerCamelCase   :							Optional[Any]				,			_lowerCamelCase   :							Tuple				,			_lowerCamelCase   :							Tuple				,			_lowerCamelCase   :							int     ):





											"""simple docstring"""







											A_			:  Any			=				ErnieMForInformationExtraction(config=_lowerCamelCase     )
											model.to(_lowerCamelCase     )
											model.eval()
											A_			:  Union[str, Any]			=				torch.ones_like(_lowerCamelCase				,			dtype=torch.floataa     )
											A_			:  Optional[Any]			=				model(
											    _lowerCamelCase				,			attention_mask=_lowerCamelCase				,			start_positions=_lowerCamelCase				,			end_positions=_lowerCamelCase				,			)
											self.parent.assertEqual(result.start_logits.shape				,			(self.batch_size, self.seq_length)     )
											self.parent.assertEqual(result.end_logits.shape				,			(self.batch_size, self.seq_length)     )







						def    _a     (  self   :							Optional[int]				,			_lowerCamelCase   :							List[Any]				,			_lowerCamelCase   :							Optional[Any]				,			_lowerCamelCase   :							Optional[int]				,			_lowerCamelCase   :							Any				,			_lowerCamelCase   :							List[Any]				,			_lowerCamelCase   :							List[str]     ):





											"""simple docstring"""







											A_			:  Optional[Any]			=				self.num_labels
											A_			:  Tuple			=				ErnieMForSequenceClassification(_lowerCamelCase     )
											model.to(_lowerCamelCase     )
											model.eval()
											A_			:  Union[str, Any]			=				model(_lowerCamelCase				,			attention_mask=_lowerCamelCase				,			labels=_lowerCamelCase     )
											self.parent.assertEqual(result.logits.shape				,			(self.batch_size, self.num_labels)     )







						def    _a     (  self   :							Optional[Any]				,			_lowerCamelCase   :							List[str]				,			_lowerCamelCase   :							int				,			_lowerCamelCase   :							List[str]				,			_lowerCamelCase   :							str				,			_lowerCamelCase   :							List[Any]				,			_lowerCamelCase   :							Optional[int]     ):





											"""simple docstring"""







											A_			:  Dict			=				self.num_labels
											A_			:  List[Any]			=				ErnieMForTokenClassification(config=_lowerCamelCase     )
											model.to(_lowerCamelCase     )
											model.eval()
											input_ids.to(_lowerCamelCase     )
											input_mask.to(_lowerCamelCase     )
											token_labels.to(_lowerCamelCase     )

											A_			:  Any			=				model(_lowerCamelCase				,			attention_mask=_lowerCamelCase				,			labels=_lowerCamelCase     )

											self.parent.assertEqual(result.logits.shape				,			(self.batch_size, self.seq_length, self.num_labels)     )







						def    _a     (  self   :							int				,			_lowerCamelCase   :							List[Any]				,			_lowerCamelCase   :							Any				,			_lowerCamelCase   :							Union[str, Any]				,			_lowerCamelCase   :							int				,			_lowerCamelCase   :							List[str]				,			_lowerCamelCase   :							Union[str, Any]     ):





											"""simple docstring"""







											A_			:  Optional[int]			=				self.num_choices
											A_			:  Dict			=				ErnieMForMultipleChoice(config=_lowerCamelCase     )
											model.to(_lowerCamelCase     )
											model.eval()
											A_			:  Dict			=				input_ids.unsqueeze(1     ).expand(-1				,			self.num_choices				,			-1     ).contiguous()
											A_			:  Dict			=				input_mask.unsqueeze(1     ).expand(-1				,			self.num_choices				,			-1     ).contiguous()
											A_			:  Tuple			=				model(
											    _lowerCamelCase				,			attention_mask=_lowerCamelCase				,			labels=_lowerCamelCase				,			)
											self.parent.assertEqual(result.logits.shape				,			(self.batch_size, self.num_choices)     )







						def    _a     (  self   :							str     ):





											"""simple docstring"""







											A_			:  Optional[Any]			=				self.prepare_config_and_inputs()
											(
											    (
											    A_
											)			,(
											    A_
											)			,(
											    A_
											)			,(
											    A_
											)			,(
											    A_
											)			,(
											    A_
											)			,
											)			:  Union[str, Any]			=				config_and_inputs
											A_			:  Tuple			=				{'''input_ids''': input_ids, '''attention_mask''': input_mask}
											return config, inputs_dict






@require_torch
class      UpperCamelCase_  (a__,   a__,   unittest.TestCase  ):







						"""simple docstring"""


						_lowerCAmelCase         =       (
						    (
						        ErnieMModel,
						        ErnieMForMultipleChoice,
						        ErnieMForQuestionAnswering,
						        ErnieMForSequenceClassification,
						        ErnieMForTokenClassification,
						    )
						    if is_torch_available()
						    else ()
						)
						_lowerCAmelCase         =       ()
						_lowerCAmelCase         =       (
						    {
						        'feature-extraction': ErnieMModel,
						        'question-answering': ErnieMForQuestionAnswering,
						        'text-classification': ErnieMForSequenceClassification,
						        'token-classification': ErnieMForTokenClassification,
						        'zero-shot': ErnieMForSequenceClassification,
						    }
						    if is_torch_available()
						    else {}
						)
						_lowerCAmelCase         =       False







						def    _a     (  self   :							Optional[Any]				,			_lowerCamelCase   :							Union[str, Any]				,			_lowerCamelCase   :							str				,			_lowerCamelCase   :							Dict				,			_lowerCamelCase   :							int				,			_lowerCamelCase   :							List[Any]     ):





											"""simple docstring"""







											if pipeline_test_casse_name == "QAPipelineTests":
																return True

											return False







						def    _a     (  self   :							Dict     ):





											"""simple docstring"""







											A_			:  List[str]			=				ErnieMModelTester(self     )
											A_			:  Union[str, Any]			=				ConfigTester(self				,			config_class=_lowerCamelCase				,			hidden_size=37     )







						def    _a     (  self   :							List[Any]     ):





											"""simple docstring"""







											self.config_tester.run_common_tests()







						def    _a     (  self   :							Optional[int]     ):





											"""simple docstring"""







											A_			:  Tuple			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*_lowerCamelCase     )







						def    _a     (  self   :							Optional[int]     ):





											"""simple docstring"""







											A_			:  Tuple			=				self.model_tester.prepare_config_and_inputs()
											for type in ["absolute", "relative_key", "relative_key_query"]:
																A_			:  Union[str, Any]			=				type
																self.model_tester.create_and_check_model(*_lowerCamelCase     )







						def    _a     (  self   :							Union[str, Any]     ):





											"""simple docstring"""







											A_			:  List[str]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_multiple_choice(*_lowerCamelCase     )







						def    _a     (  self   :							Any     ):





											"""simple docstring"""







											A_			:  str			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_question_answering(*_lowerCamelCase     )







						def    _a     (  self   :							Optional[int]     ):





											"""simple docstring"""







											A_			:  List[str]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_sequence_classification(*_lowerCamelCase     )







						def    _a     (  self   :							Optional[int]     ):





											"""simple docstring"""







											A_			:  str			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_information_extraction(*_lowerCamelCase     )







						def    _a     (  self   :							Any     ):





											"""simple docstring"""







											A_			:  Optional[Any]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_token_classification(*_lowerCamelCase     )







						@slow
						def    _a     (  self   :							List[str]     ):





											"""simple docstring"""







											for model_name in ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																A_			:  Any			=				ErnieMModel.from_pretrained(_lowerCamelCase     )
																self.assertIsNotNone(_lowerCamelCase     )






@require_torch
class      UpperCamelCase_  (unittest.TestCase  ):







						"""simple docstring"""


						@slow
						def    _a     (  self   :							Union[str, Any]     ):





											"""simple docstring"""







											A_			:  Tuple			=				ErnieMModel.from_pretrained('''susnato/ernie-m-base_pytorch'''     )
											model.eval()
											A_			:  str			=				torch.tensor([[0, 1, 2, 3, 4, 5]]     )
											A_			:  Tuple			=				model(_lowerCamelCase     )[0]

											# TODO Replace vocab size
											A_			:  List[str]			=				768

											A_			:  int			=				torch.Size((1, 6, hidden_size)     )
											self.assertEqual(output.shape				,			_lowerCamelCase     )

											A_			:  str			=				torch.tensor(
											    [[[-0.00_12, 0.12_45, -0.02_14], [-0.07_42, 0.02_44, -0.07_71], [-0.03_33, 0.11_64, -0.15_54]]]     )

											self.assertTrue(torch.allclose(output[:, :3, :3]				,			_lowerCamelCase				,			atol=1E-3     )     )









'''simple docstring'''




from typing import TYPE_CHECKING

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


snake_case__ 							=    {
    """configuration_utils""": ["""GenerationConfig"""],
    """streamers""": ["""TextIteratorStreamer""", """TextStreamer"""],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							snake_case__ 							=    [
							    """Constraint""",
							    """ConstraintListState""",
							    """DisjunctiveConstraint""",
							    """PhrasalConstraint""",
							]
							snake_case__ 							=    [
							    """BeamHypotheses""",
							    """BeamScorer""",
							    """BeamSearchScorer""",
							    """ConstrainedBeamSearchScorer""",
							]
							snake_case__ 							=    [
							    """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__ 							=    [
							    """MaxNewTokensCriteria""",
							    """MaxLengthCriteria""",
							    """MaxTimeCriteria""",
							    """StoppingCriteria""",
							    """StoppingCriteriaList""",
							    """validate_stopping_criteria""",
							]
							snake_case__ 							=    [
							    """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__ 							=    [
							    """TFForcedBOSTokenLogitsProcessor""",
							    """TFForcedEOSTokenLogitsProcessor""",
							    """TFLogitsProcessor""",
							    """TFLogitsProcessorList""",
							    """TFLogitsWarper""",
							    """TFMinLengthLogitsProcessor""",
							    """TFNoBadWordsLogitsProcessor""",
							    """TFNoRepeatNGramLogitsProcessor""",
							    """TFRepetitionPenaltyLogitsProcessor""",
							    """TFTemperatureLogitsWarper""",
							    """TFTopKLogitsWarper""",
							    """TFTopPLogitsWarper""",
							    """TFForceTokensLogitsProcessor""",
							    """TFSuppressTokensAtBeginLogitsProcessor""",
							    """TFSuppressTokensLogitsProcessor""",
							]
							snake_case__ 							=    [
							    """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__ 							=    [
							    """FlaxForcedBOSTokenLogitsProcessor""",
							    """FlaxForcedEOSTokenLogitsProcessor""",
							    """FlaxLogitsProcessor""",
							    """FlaxLogitsProcessorList""",
							    """FlaxLogitsWarper""",
							    """FlaxMinLengthLogitsProcessor""",
							    """FlaxTemperatureLogitsWarper""",
							    """FlaxTopKLogitsWarper""",
							    """FlaxTopPLogitsWarper""",
							]
							snake_case__ 							=    [
							    """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__ 							=    _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



