



import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


_lowerCamelCase    :		List[str]		      =    logging.get_logger(__name__)


_lowerCamelCase    :		List[Any]		      =    """▁"""

_lowerCamelCase    :		List[str]		      =    {"""vocab_file""": """spiece.model"""}

_lowerCamelCase    :		Dict		      =    {
    """vocab_file""": {
        """google/reformer-crime-and-punishment""": (
            """https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/spiece.model"""
        )
    }
}

_lowerCamelCase    :		List[str]		      =    {
    """google/reformer-crime-and-punishment""": 524_288,
}


class 						lowercase    (							SCREAMING_SNAKE_CASE_):
						'''simple docstring'''


						UpperCAmelCase			:		Tuple		=		VOCAB_FILES_NAMES
						UpperCAmelCase			:		Optional[Any]		=		PRETRAINED_VOCAB_FILES_MAP
						UpperCAmelCase			:		Dict		=		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						UpperCAmelCase			:		List[str]		=		['input_ids', 'attention_mask']







						def __init__(  self    :				Any       ,	snake_case    :				List[str]       ,	snake_case    :				Any="</s>"       ,	snake_case    :				List[Any]="<unk>"       ,	snake_case    :				Optional[int]=[]       ,	snake_case    :				Optional[Dict[str, Any]] = None       ,	**snake_case    :				Any       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				{} if sp_model_kwargs is None else sp_model_kwargs

											super().__init__(
											    eos_token=snake_case       ,	unk_token=snake_case       ,	additional_special_tokens=snake_case       ,	sp_model_kwargs=self.sp_model_kwargs       ,	**snake_case       ,	)

											SCREAMING_SNAKE_CASE							:     Tuple						=				vocab_file
											SCREAMING_SNAKE_CASE							:     Dict						=				spm.SentencePieceProcessor(**self.sp_model_kwargs	)
											self.sp_model.Load(snake_case	)







						@property
						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											return self.sp_model.get_piece_size()







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     List[Any]						=				{self.convert_ids_to_tokens(snake_case	): i for i in range(self.vocab_size	)}
											vocab.update(self.added_tokens_encoder	)
											return vocab







						def __getstate__(  self    :				List[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Any						=				self.__dict__.copy()
											SCREAMING_SNAKE_CASE							:     int						=				None
											return state







						def __setstate__(  self    :				str       ,	snake_case    :				Tuple	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				d

											# for backward compatibility
											if not hasattr(self       ,	'sp_model_kwargs'	):
																SCREAMING_SNAKE_CASE							:     List[Any]						=				{}

											SCREAMING_SNAKE_CASE							:     Optional[int]						=				spm.SentencePieceProcessor(**self.sp_model_kwargs	)
											self.sp_model.Load(self.vocab_file	)







						def       lowerCamelCase_				(  self    :				List[Any]       ,	snake_case    :				str	):



											'''simple docstring'''


											return self.sp_model.encode(snake_case       ,	out_type=snake_case	)







						def       lowerCamelCase_				(  self    :				int       ,	snake_case    :				Union[str, Any]	):



											'''simple docstring'''


											return self.sp_model.piece_to_id(snake_case	)







						def       lowerCamelCase_				(  self    :				int       ,	snake_case    :				Any	):



											'''simple docstring'''


											if index < self.sp_model.get_piece_size():
																SCREAMING_SNAKE_CASE							:     Dict						=				self.sp_model.IdToPiece(snake_case	)
											return token







						def       lowerCamelCase_				(  self    :				int       ,	snake_case    :				Dict	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Any						=				[]
											SCREAMING_SNAKE_CASE							:     List[str]						=				''
											for token in tokens:
																# make sure that special tokens are not decoded using sentencepiece model
																if token in self.all_special_tokens:
																					out_string += self.sp_model.decode(snake_case	) + token
																					SCREAMING_SNAKE_CASE							:     Dict						=				[]
																else:
																					current_sub_tokens.append(snake_case	)
											out_string += self.sp_model.decode(snake_case	)
											return out_string.strip()







						def       lowerCamelCase_				(  self    :				Union[str, Any]       ,	snake_case    :				str       ,	snake_case    :				Optional[str] = None	):



											'''simple docstring'''


											if not os.path.isdir(snake_case	):
																logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''	)
																return
											SCREAMING_SNAKE_CASE							:     int						=				os.path.join(
											    snake_case       ,	(filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']	)

											if os.path.abspath(self.vocab_file	) != os.path.abspath(snake_case	) and os.path.isfile(self.vocab_file	):
																copyfile(self.vocab_file       ,	snake_case	)
											elif not os.path.isfile(self.vocab_file	):
																with open(snake_case       ,	'wb'	) as fi:
																					SCREAMING_SNAKE_CASE							:     List[str]						=				self.sp_model.serialized_model_proto()
																					fi.write(snake_case	)

											return (out_vocab_file,)




from __future__ import annotations

import unittest

from transformers import FunnelConfig, is_tf_available
from transformers.testing_utils import require_tf

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
			import tensorflow as tf

			from transformers import (
			    TFFunnelBaseModel,
			    TFFunnelForMaskedLM,
			    TFFunnelForMultipleChoice,
			    TFFunnelForPreTraining,
			    TFFunnelForQuestionAnswering,
			    TFFunnelForSequenceClassification,
			    TFFunnelForTokenClassification,
			    TFFunnelModel,
			)


class 						lowercase    :
						'''simple docstring'''


						def __init__(  self    :				List[Any]       ,	snake_case    :				Optional[Any]       ,	snake_case    :				int=13       ,	snake_case    :				int=7       ,	snake_case    :				Dict=True       ,	snake_case    :				Union[str, Any]=True       ,	snake_case    :				Union[str, Any]=True       ,	snake_case    :				List[Any]=True       ,	snake_case    :				Tuple=99       ,	snake_case    :				Any=[1, 1, 2]       ,	snake_case    :				Dict=1       ,	snake_case    :				Optional[int]=32       ,	snake_case    :				Union[str, Any]=4       ,	snake_case    :				Optional[Any]=8       ,	snake_case    :				Dict=37       ,	snake_case    :				int="gelu_new"       ,	snake_case    :				Optional[Any]=0.1       ,	snake_case    :				List[str]=0.1       ,	snake_case    :				Any=0.0       ,	snake_case    :				Dict=512       ,	snake_case    :				List[str]=3       ,	snake_case    :				Any=0.02       ,	snake_case    :				List[str]=3       ,	snake_case    :				Optional[Any]=4       ,	snake_case    :				Dict=None       ,	snake_case    :				Any=False       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				parent
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				batch_size
											SCREAMING_SNAKE_CASE							:     List[str]						=				seq_length
											SCREAMING_SNAKE_CASE							:     int						=				is_training
											SCREAMING_SNAKE_CASE							:     Any						=				use_input_mask
											SCREAMING_SNAKE_CASE							:     Tuple						=				use_token_type_ids
											SCREAMING_SNAKE_CASE							:     Dict						=				use_labels
											SCREAMING_SNAKE_CASE							:     Dict						=				vocab_size
											SCREAMING_SNAKE_CASE							:     Dict						=				block_sizes
											SCREAMING_SNAKE_CASE							:     Dict						=				num_decoder_layers
											SCREAMING_SNAKE_CASE							:     int						=				d_model
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				n_head
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				d_head
											SCREAMING_SNAKE_CASE							:     int						=				d_inner
											SCREAMING_SNAKE_CASE							:     List[Any]						=				hidden_act
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				hidden_dropout
											SCREAMING_SNAKE_CASE							:     Any						=				attention_dropout
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				activation_dropout
											SCREAMING_SNAKE_CASE							:     str						=				max_position_embeddings
											SCREAMING_SNAKE_CASE							:     int						=				type_vocab_size
											SCREAMING_SNAKE_CASE							:     str						=				2
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				num_labels
											SCREAMING_SNAKE_CASE							:     Tuple						=				num_choices
											SCREAMING_SNAKE_CASE							:     str						=				scope
											SCREAMING_SNAKE_CASE							:     int						=				initializer_std

											# Used in the tests to check the size of the first attention layer
											SCREAMING_SNAKE_CASE							:     int						=				n_head
											# Used in the tests to check the size of the first hidden state
											SCREAMING_SNAKE_CASE							:     List[str]						=				self.d_model
											# Used in the tests to check the number of output hidden states/attentions
											SCREAMING_SNAKE_CASE							:     List[str]						=				sum(self.block_sizes	) + (0 if base else self.num_decoder_layers)
											# FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
											# the last hidden state of the first block (which is the first hidden state of the decoder).
											if not base:
																SCREAMING_SNAKE_CASE							:     Dict						=				self.num_hidden_layers + 2







						def       lowerCamelCase_				(  self    :				int	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Any						=				ids_tensor([self.batch_size, self.seq_length]       ,	self.vocab_size	)

											SCREAMING_SNAKE_CASE							:     Dict						=				None
											if self.use_input_mask:
																SCREAMING_SNAKE_CASE							:     Optional[int]						=				random_attention_mask([self.batch_size, self.seq_length]	)

											SCREAMING_SNAKE_CASE							:     Optional[int]						=				None
											if self.use_token_type_ids:
																SCREAMING_SNAKE_CASE							:     Optional[int]						=				ids_tensor([self.batch_size, self.seq_length]       ,	self.type_vocab_size	)

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

											SCREAMING_SNAKE_CASE							:     Dict						=				FunnelConfig(
											    vocab_size=self.vocab_size       ,	block_sizes=self.block_sizes       ,	num_decoder_layers=self.num_decoder_layers       ,	d_model=self.d_model       ,	n_head=self.n_head       ,	d_head=self.d_head       ,	d_inner=self.d_inner       ,	hidden_act=self.hidden_act       ,	hidden_dropout=self.hidden_dropout       ,	attention_dropout=self.attention_dropout       ,	activation_dropout=self.activation_dropout       ,	max_position_embeddings=self.max_position_embeddings       ,	type_vocab_size=self.type_vocab_size       ,	initializer_std=self.initializer_std       ,	)

											return (
											    config,
											    input_ids,
											    token_type_ids,
											    input_mask,
											    sequence_labels,
											    token_labels,
											    choice_labels,
											)







						def       lowerCamelCase_				(  self    :				Dict       ,	snake_case    :				List[str]       ,	snake_case    :				Tuple       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				Any       ,	snake_case    :				Dict       ,	snake_case    :				Any       ,	snake_case    :				Union[str, Any]       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     List[str]						=				TFFunnelModel(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Dict						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				model(snake_case	)

											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				[input_ids, input_mask]
											SCREAMING_SNAKE_CASE							:     List[Any]						=				model(snake_case	)

											SCREAMING_SNAKE_CASE							:     int						=				model(snake_case	)
											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, self.seq_length, self.d_model)	)

											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				False
											SCREAMING_SNAKE_CASE							:     Any						=				TFFunnelModel(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Dict						=				model(snake_case	)
											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, self.seq_length, self.d_model)	)

											SCREAMING_SNAKE_CASE							:     Any						=				False
											SCREAMING_SNAKE_CASE							:     int						=				TFFunnelModel(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     List[Any]						=				model(snake_case	)
											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, self.seq_length, self.d_model)	)







						def       lowerCamelCase_				(  self    :				str       ,	snake_case    :				Any       ,	snake_case    :				Dict       ,	snake_case    :				Any       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Tuple       ,	snake_case    :				Dict       ,	snake_case    :				Optional[Any]       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				TFFunnelBaseModel(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     List[str]						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				model(snake_case	)

											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				[input_ids, input_mask]
											SCREAMING_SNAKE_CASE							:     Tuple						=				model(snake_case	)

											SCREAMING_SNAKE_CASE							:     Any						=				model(snake_case	)
											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, 2, self.d_model)	)

											SCREAMING_SNAKE_CASE							:     Optional[int]						=				False
											SCREAMING_SNAKE_CASE							:     int						=				TFFunnelBaseModel(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Any						=				model(snake_case	)
											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, 3, self.d_model)	)

											SCREAMING_SNAKE_CASE							:     int						=				False
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				TFFunnelBaseModel(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				model(snake_case	)
											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, 2, self.d_model)	)







						def       lowerCamelCase_				(  self    :				Optional[int]       ,	snake_case    :				Any       ,	snake_case    :				str       ,	snake_case    :				Optional[int]       ,	snake_case    :				List[str]       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				List[Any]       ,	snake_case    :				Dict       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Any						=				TFFunnelForPreTraining(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     str						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     List[str]						=				model(snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.seq_length)	)







						def       lowerCamelCase_				(  self    :				List[str]       ,	snake_case    :				Any       ,	snake_case    :				int       ,	snake_case    :				List[str]       ,	snake_case    :				Tuple       ,	snake_case    :				int       ,	snake_case    :				str       ,	snake_case    :				List[Any]       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Dict						=				TFFunnelForMaskedLM(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Tuple						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     Tuple						=				model(snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.seq_length, self.vocab_size)	)







						def       lowerCamelCase_				(  self    :				Any       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Optional[int]       ,	snake_case    :				Dict       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Dict       ,	snake_case    :				Tuple       ,	snake_case    :				str       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Tuple						=				self.num_labels
											SCREAMING_SNAKE_CASE							:     Any						=				TFFunnelForSequenceClassification(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Tuple						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     Tuple						=				model(snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.num_labels)	)







						def       lowerCamelCase_				(  self    :				Optional[Any]       ,	snake_case    :				List[Any]       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Any       ,	snake_case    :				Dict       ,	snake_case    :				Dict       ,	snake_case    :				int       ,	snake_case    :				Tuple       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Dict						=				self.num_choices
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				TFFunnelForMultipleChoice(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				tf.tile(tf.expand_dims(snake_case       ,	1	)       ,	(1, self.num_choices, 1)	)
											SCREAMING_SNAKE_CASE							:     Tuple						=				tf.tile(tf.expand_dims(snake_case       ,	1	)       ,	(1, self.num_choices, 1)	)
											SCREAMING_SNAKE_CASE							:     Tuple						=				tf.tile(tf.expand_dims(snake_case       ,	1	)       ,	(1, self.num_choices, 1)	)
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				{
											    'input_ids': multiple_choice_inputs_ids,
											    'attention_mask': multiple_choice_input_mask,
											    'token_type_ids': multiple_choice_token_type_ids,
											}
											SCREAMING_SNAKE_CASE							:     List[str]						=				model(snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.num_choices)	)







						def       lowerCamelCase_				(  self    :				Any       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Dict       ,	snake_case    :				Any       ,	snake_case    :				int       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				Any       ,	snake_case    :				Optional[Any]       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     int						=				self.num_labels
											SCREAMING_SNAKE_CASE							:     List[Any]						=				TFFunnelForTokenClassification(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     Tuple						=				model(snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.seq_length, self.num_labels)	)







						def       lowerCamelCase_				(  self    :				str       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Any       ,	snake_case    :				Dict       ,	snake_case    :				Any       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				List[Any]       ,	snake_case    :				Dict       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Tuple						=				TFFunnelForQuestionAnswering(config=snake_case	)
											SCREAMING_SNAKE_CASE							:     List[str]						=				{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
											SCREAMING_SNAKE_CASE							:     Dict						=				model(snake_case	)
											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       lowerCamelCase_				(  self    :				Optional[Any]	):



											'''simple docstring'''


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


@require_tf
class 						lowercase    (							SCREAMING_SNAKE_CASE_      ,    SCREAMING_SNAKE_CASE_      ,    unittest.TestCase):
						'''simple docstring'''


						UpperCAmelCase			:		int		=		(
						    (
						        TFFunnelModel,
						        TFFunnelForMaskedLM,
						        TFFunnelForPreTraining,
						        TFFunnelForQuestionAnswering,
						        TFFunnelForTokenClassification,
						    )
						    if is_tf_available()
						    else ()
						)
						UpperCAmelCase			:		Optional[Any]		=		(
						    {
						        'feature-extraction': (TFFunnelBaseModel, TFFunnelModel),
						        'fill-mask': TFFunnelForMaskedLM,
						        'question-answering': TFFunnelForQuestionAnswering,
						        'text-classification': TFFunnelForSequenceClassification,
						        'token-classification': TFFunnelForTokenClassification,
						        'zero-shot': TFFunnelForSequenceClassification,
						    }
						    if is_tf_available()
						    else {}
						)
						UpperCAmelCase			:		Any		=		False
						UpperCAmelCase			:		Tuple		=		False







						def       lowerCamelCase_				(  self    :				str	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     int						=				TFFunnelModelTester(self	)
											SCREAMING_SNAKE_CASE							:     Any						=				ConfigTester(self       ,	config_class=snake_case	)







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											self.config_tester.run_common_tests()







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*snake_case	)







						def       lowerCamelCase_				(  self    :				str	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_pretraining(*snake_case	)







						def       lowerCamelCase_				(  self    :				List[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Tuple						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_lm(*snake_case	)







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



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_token_classification(*snake_case	)







						def       lowerCamelCase_				(  self    :				List[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     int						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_question_answering(*snake_case	)


@require_tf
class 						lowercase    (							SCREAMING_SNAKE_CASE_      ,    unittest.TestCase):
						'''simple docstring'''


						UpperCAmelCase			:		Any		=		(
						    (TFFunnelBaseModel, TFFunnelForMultipleChoice, TFFunnelForSequenceClassification) if is_tf_available() else ()
						)
						UpperCAmelCase			:		List[str]		=		False
						UpperCAmelCase			:		Tuple		=		False







						def       lowerCamelCase_				(  self    :				Optional[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				TFFunnelModelTester(self       ,	base=snake_case	)
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				ConfigTester(self       ,	config_class=snake_case	)







						def       lowerCamelCase_				(  self    :				int	):



											'''simple docstring'''


											self.config_tester.run_common_tests()







						def       lowerCamelCase_				(  self    :				int	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_base_model(*snake_case	)







						def       lowerCamelCase_				(  self    :				Dict	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_sequence_classification(*snake_case	)







						def       lowerCamelCase_				(  self    :				int	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_multiple_choice(*snake_case	)