

import argparse
import os
import re


lowercase			:				List[str]   =     "src/transformers"

# Pattern that looks at the indentation in a line.
lowercase			:				Any   =     re.compile(r"^(\s*)\S")
# Pattern that matches `"key":" and puts `key` in group 0.
lowercase			:				List[Any]   =     re.compile(r"^\s*\"([^\"]+)\":")
# Pattern that matches `_import_structure["key"]` and puts `key` in group 0.
lowercase			:				Union[str, Any]   =     re.compile(r"^\s*_import_structure\[\"([^\"]+)\"\]")
# Pattern that matches `"key",` and puts `key` in group 0.
lowercase			:				Any   =     re.compile(r"^\s*\"([^\"]+)\",\s*$")
# Pattern that matches any `[stuff]` and puts `stuff` in group 0.
lowercase			:				Dict   =     re.compile(r"\[([^\]]+)\]")






def        snake_case__		(    lowerCamelCase_		):
							A      :					Any      		=					_re_indent.search(lowerCamelCase_		)
							return "" if search is None else search.groups()[0]






def        snake_case__		(    lowerCamelCase_     ,				lowerCamelCase_=""     ,				lowerCamelCase_=None     ,				lowerCamelCase_=None		):
							A      :					str      		=					0
							A      :					Tuple      		=					code.split('''\n'''		)
							if start_prompt is not None:
														while not lines[index].startswith(lowerCamelCase_		):
																					index += 1
														A      :					Dict      		=					['''\n'''.join(lines[:index]		)]
							else:
														A      :					List[str]      		=					[]

							# We split into blocks until we get to the `end_prompt` (or the end of the block).
							A      :					Union[str, Any]      		=					[lines[index]]
							index += 1
							while index < len(lowerCamelCase_		) and (end_prompt is None or not lines[index].startswith(lowerCamelCase_		)):
														if len(lines[index]		) > 0 and get_indent(lines[index]		) == indent_level:
																					if len(lowerCamelCase_		) > 0 and get_indent(current_block[-1]		).startswith(indent_level + ''' '''		):
																												current_block.append(lines[index]		)
																												blocks.append('''\n'''.join(lowerCamelCase_		)		)
																												if index < len(lowerCamelCase_		) - 1:
																																			A      :					int      		=					[lines[index + 1]]
																																			index += 1
																												else:
																																			A      :					Optional[int]      		=					[]
																					else:
																												blocks.append('''\n'''.join(lowerCamelCase_		)		)
																												A      :					Dict      		=					[lines[index]]
														else:
																					current_block.append(lines[index]		)
														index += 1

							# Adds current block if it's nonempty.
							if len(lowerCamelCase_		) > 0:
														blocks.append('''\n'''.join(lowerCamelCase_		)		)

							# Add final block after end_prompt if provided.
							if end_prompt is not None and index < len(lowerCamelCase_		):
														blocks.append('''\n'''.join(lines[index:]		)		)

							return blocks






def        snake_case__		(    lowerCamelCase_		):

							def _inner(lowerCamelCase_		):
														return key(lowerCamelCase_		).lower().replace('''_'''     ,				''''''		)

							return _inner






def        snake_case__		(    lowerCamelCase_     ,				lowerCamelCase_=None		):

							# If no key is provided, we use a noop.
							def noop(lowerCamelCase_		):
														return x

							if key is None:
														A      :					List[Any]      		=					noop
							# Constants are all uppercase, they go first.
							A      :					Dict      		=					[obj for obj in objects if key(lowerCamelCase_		).isupper()]
							# Classes are not all uppercase but start with a capital, they go second.
							A      :					Tuple      		=					[obj for obj in objects if key(lowerCamelCase_		)[0].isupper() and not key(lowerCamelCase_		).isupper()]
							# Functions begin with a lowercase, they go last.
							A      :					Optional[int]      		=					[obj for obj in objects if not key(lowerCamelCase_		)[0].isupper()]

							A      :					List[str]      		=					ignore_underscore(lowerCamelCase_		)
							return sorted(lowerCamelCase_     ,				key=lowerCamelCase_		) + sorted(lowerCamelCase_     ,				key=lowerCamelCase_		) + sorted(lowerCamelCase_     ,				key=lowerCamelCase_		)






def        snake_case__		(    lowerCamelCase_		):

							# This inner function sort imports between [ ].
							def _replace(lowerCamelCase_		):
														A      :					Union[str, Any]      		=					match.groups()[0]
														if "," not in imports:
																					return F'[{imports}]'
														A      :					Union[str, Any]      		=					[part.strip().replace('''"'''     ,				''''''		) for part in imports.split(''','''		)]
														# We will have a final empty element if the line finished with a comma.
														if len(keys[-1]		) == 0:
																					A      :					Dict      		=					keys[:-1]
														return "[" + ", ".join([F'"{k}"' for k in sort_objects(lowerCamelCase_		)]		) + "]"

							A      :					str      		=					import_statement.split('''\n'''		)
							if len(lowerCamelCase_		) > 3:
														# Here we have to sort internal imports that are on several lines (one per name):
														# key: [
														#     "object1",
														#     "object2",
														#     ...
														# ]

														# We may have to ignore one or two lines on each side.
														A      :					int      		=					2 if lines[1].strip() == '''[''' else 1
														A      :					Optional[int]      		=					[(i, _re_strip_line.search(lowerCamelCase_		).groups()[0]) for i, line in enumerate(lines[idx:-idx]		)]
														A      :					Optional[Any]      		=					sort_objects(lowerCamelCase_     ,				key=lambda lowerCamelCase_		: x[1]		)
														A      :					List[Any]      		=					[lines[x[0] + idx] for x in sorted_indices]
														return "\n".join(lines[:idx] + sorted_lines + lines[-idx:]		)
							elif len(lowerCamelCase_		) == 3:
														# Here we have to sort internal imports that are on one separate line:
														# key: [
														#     "object1", "object2", ...
														# ]
														if _re_bracket_content.search(lines[1]		) is not None:
																					A      :					Any      		=					_re_bracket_content.sub(_replace     ,				lines[1]		)
														else:
																					A      :					Optional[int]      		=					[part.strip().replace('''"'''     ,				''''''		) for part in lines[1].split(''','''		)]
																					# We will have a final empty element if the line finished with a comma.
																					if len(keys[-1]		) == 0:
																												A      :					Optional[int]      		=					keys[:-1]
																					A      :					Union[str, Any]      		=					get_indent(lines[1]		) + ''', '''.join([F'"{k}"' for k in sort_objects(lowerCamelCase_		)]		)
														return "\n".join(lowerCamelCase_		)
							else:
														# Finally we have to deal with imports fitting on one line
														A      :					Tuple      		=					_re_bracket_content.sub(_replace     ,				lowerCamelCase_		)
														return import_statement






def        snake_case__		(    lowerCamelCase_     ,				lowerCamelCase_=True		):
							with open(lowerCamelCase_     ,				encoding='''utf-8'''		) as f:
														A      :					int      		=					f.read()

							if "_import_structure" not in code:
														return

							# Blocks of indent level 0
							A      :					Dict      		=					split_code_in_indented_blocks(
							    lowerCamelCase_     ,				start_prompt='''_import_structure = {'''     ,				end_prompt='''if TYPE_CHECKING:'''		)

							# We ignore block 0 (everything untils start_prompt) and the last block (everything after end_prompt).
							for block_idx in range(1     ,				len(lowerCamelCase_		) - 1		):
														# Check if the block contains some `_import_structure`s thingy to sort.
														A      :					Optional[int]      		=					main_blocks[block_idx]
														A      :					List[str]      		=					block.split('''\n'''		)

														# Get to the start of the imports.
														A      :					Optional[int]      		=					0
														while line_idx < len(lowerCamelCase_		) and "_import_structure" not in block_lines[line_idx]:
																					# Skip dummy import blocks
																					if "import dummy" in block_lines[line_idx]:
																												A      :					Optional[int]      		=					len(lowerCamelCase_		)
																					else:
																												line_idx += 1
														if line_idx >= len(lowerCamelCase_		):
																					continue

														# Ignore beginning and last line: they don't contain anything.
														A      :					Tuple      		=					'''\n'''.join(block_lines[line_idx:-1]		)
														A      :					List[str]      		=					get_indent(block_lines[1]		)
														# Slit the internal block into blocks of indent level 1.
														A      :					Tuple      		=					split_code_in_indented_blocks(lowerCamelCase_     ,				indent_level=lowerCamelCase_		)
														# We have two categories of import key: list or _import_structure[key].append/extend
														A      :					Any      		=					_re_direct_key if '''_import_structure = {''' in block_lines[0] else _re_indirect_key
														# Grab the keys, but there is a trap: some lines are empty or just comments.
														A      :					Any      		=					[(pattern.search(lowerCamelCase_		).groups()[0] if pattern.search(lowerCamelCase_		) is not None else None) for b in internal_blocks]
														# We only sort the lines with a key.
														A      :					Any      		=					[(i, key) for i, key in enumerate(lowerCamelCase_		) if key is not None]
														A      :					Tuple      		=					[x[0] for x in sorted(lowerCamelCase_     ,				key=lambda lowerCamelCase_		: x[1]		)]

														# We reorder the blocks by leaving empty lines/comments as they were and reorder the rest.
														A      :					int      		=					0
														A      :					Union[str, Any]      		=					[]
														for i in range(len(lowerCamelCase_		)		):
																					if keys[i] is None:
																												reorderded_blocks.append(internal_blocks[i]		)
																					else:
																												A      :					Optional[Any]      		=					sort_objects_in_import(internal_blocks[sorted_indices[count]]		)
																												reorderded_blocks.append(lowerCamelCase_		)
																												count += 1

        # And we put our main block back together with its first and last line.
														A      :					str      		=					'''\n'''.join(block_lines[:line_idx] + reorderded_blocks + [block_lines[-1]]		)

							if code != "\n".join(lowerCamelCase_		):
														if check_only:
																					return True
														else:
																					print(F'Overwriting {file}.'		)
																					with open(lowerCamelCase_     ,				'''w'''     ,				encoding='''utf-8'''		) as f:
																												f.write('''\n'''.join(lowerCamelCase_		)		)






def        snake_case__		(    lowerCamelCase_=True		):
							A      :					Optional[Any]      		=					[]
							for root, _, files in os.walk(lowerCamelCase_		):
														if "__init__.py" in files:
																					A      :					List[Any]      		=					sort_imports(os.path.join(lowerCamelCase_     ,				'''__init__.py'''		)     ,				check_only=lowerCamelCase_		)
																					if result:
																												A      :					Dict      		=					[os.path.join(lowerCamelCase_     ,				'''__init__.py'''		)]
							if len(lowerCamelCase_		) > 0:
														raise ValueError(F'Would overwrite {len(lowerCamelCase_		)} files, run `make style`.'		)


if __name__ == "__main__":
		lowercase			:				Any   =     argparse.ArgumentParser()
		parser.add_argument("--check_only", action="store_true", help="Whether to only check or fix style.")
		lowercase			:				Optional[Any]   =     parser.parse_args()

		sort_imports_in_all_inits(check_only=args.check_only)









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    ,						__UpperCAmelCase    ,						__UpperCAmelCase=13    ,						__UpperCAmelCase=7    ,						__UpperCAmelCase=True    ,						__UpperCAmelCase=True    ,						__UpperCAmelCase=True    ,						__UpperCAmelCase=True    ,						__UpperCAmelCase=99    ,						__UpperCAmelCase=[1, 1, 2]    ,						__UpperCAmelCase=1    ,						__UpperCAmelCase=32    ,						__UpperCAmelCase=4    ,						__UpperCAmelCase=8    ,						__UpperCAmelCase=37    ,						__UpperCAmelCase="gelu_new"    ,						__UpperCAmelCase=0.1    ,						__UpperCAmelCase=0.1    ,						__UpperCAmelCase=0.0    ,						__UpperCAmelCase=5_12    ,						__UpperCAmelCase=3    ,						__UpperCAmelCase=0.0_2    ,						__UpperCAmelCase=3    ,						__UpperCAmelCase=4    ,						__UpperCAmelCase=None    ,						__UpperCAmelCase=False    ,						)		->       Tuple:
														A      :					Optional[int]      		=					parent
														A      :					int      		=					batch_size
														A      :					Union[str, Any]      		=					seq_length
														A      :					Optional[Any]      		=					is_training
														A      :					int      		=					use_input_mask
														A      :					List[Any]      		=					use_token_type_ids
														A      :					Optional[int]      		=					use_labels
														A      :					List[Any]      		=					vocab_size
														A      :					int      		=					block_sizes
														A      :					Optional[int]      		=					num_decoder_layers
														A      :					int      		=					d_model
														A      :					Dict      		=					n_head
														A      :					Tuple      		=					d_head
														A      :					int      		=					d_inner
														A      :					Tuple      		=					hidden_act
														A      :					Tuple      		=					hidden_dropout
														A      :					Any      		=					attention_dropout
														A      :					Any      		=					activation_dropout
														A      :					List[Any]      		=					max_position_embeddings
														A      :					int      		=					type_vocab_size
														A      :					Dict      		=					2
														A      :					List[str]      		=					num_labels
														A      :					Optional[int]      		=					num_choices
														A      :					int      		=					scope
														A      :					int      		=					initializer_std

														# Used in the tests to check the size of the first attention layer
														A      :					Optional[int]      		=					n_head
														# Used in the tests to check the size of the first hidden state
														A      :					List[Any]      		=					self.d_model
														# Used in the tests to check the number of output hidden states/attentions
														A      :					Dict      		=					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:
																					A      :					Union[str, Any]      		=					self.num_hidden_layers + 2




							def       snake_case			(					self						)		->       List[Any]:
														A      :					int      		=					ids_tensor([self.batch_size, self.seq_length]    ,						self.vocab_size						)

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

														A      :					List[str]      		=					None
														if self.use_token_type_ids:
																					A      :					List[Any]      		=					ids_tensor([self.batch_size, self.seq_length]    ,						self.type_vocab_size						)

														A      :					Any      		=					None
														A      :					Union[str, Any]      		=					None
														A      :					Optional[Any]      		=					None
														if self.use_labels:
																					A      :					Tuple      		=					ids_tensor([self.batch_size]    ,						self.type_sequence_label_size						)
																					A      :					Union[str, Any]      		=					ids_tensor([self.batch_size, self.seq_length]    ,						self.num_labels						)
																					A      :					List[Any]      		=					ids_tensor([self.batch_size]    ,						self.num_choices						)

														A      :					List[str]      		=					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       snake_case			(					self    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						)		->       Optional[int]:
														A      :					str      		=					TFFunnelModel(config=__UpperCAmelCase						)
														A      :					str      		=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
														A      :					Tuple      		=					model(__UpperCAmelCase						)

														A      :					str      		=					[input_ids, input_mask]
														A      :					Optional[Any]      		=					model(__UpperCAmelCase						)

														A      :					List[str]      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, self.seq_length, self.d_model)						)

														A      :					str      		=					False
														A      :					List[str]      		=					TFFunnelModel(config=__UpperCAmelCase						)
														A      :					str      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, self.seq_length, self.d_model)						)

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




							def       snake_case			(					self    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						)		->       Union[str, Any]:
														A      :					Dict      		=					TFFunnelBaseModel(config=__UpperCAmelCase						)
														A      :					Optional[int]      		=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
														A      :					List[str]      		=					model(__UpperCAmelCase						)

														A      :					Union[str, Any]      		=					[input_ids, input_mask]
														A      :					Optional[Any]      		=					model(__UpperCAmelCase						)

														A      :					Union[str, Any]      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, 2, self.d_model)						)

														A      :					List[Any]      		=					False
														A      :					Union[str, Any]      		=					TFFunnelBaseModel(config=__UpperCAmelCase						)
														A      :					Union[str, Any]      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, 3, self.d_model)						)

														A      :					int      		=					False
														A      :					Tuple      		=					TFFunnelBaseModel(config=__UpperCAmelCase						)
														A      :					Tuple      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, 2, self.d_model)						)




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




							def       snake_case			(					self    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						)		->       List[Any]:
														A      :					str      		=					TFFunnelForMaskedLM(config=__UpperCAmelCase						)
														A      :					int      		=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
														A      :					str      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.seq_length, self.vocab_size)						)




							def       snake_case			(					self    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						)		->       Union[str, Any]:
														A      :					Tuple      		=					self.num_labels
														A      :					List[Any]      		=					TFFunnelForSequenceClassification(config=__UpperCAmelCase						)
														A      :					List[str]      		=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
														A      :					Any      		=					model(__UpperCAmelCase						)
														self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.num_labels)						)




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




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




							def       snake_case			(					self    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						__UpperCAmelCase    ,						)		->       Any:
														A      :					Dict      		=					TFFunnelForQuestionAnswering(config=__UpperCAmelCase						)
														A      :					str      		=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
														A      :					List[Any]      		=					model(__UpperCAmelCase						)
														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       snake_case			(					self						)		->       str:
														A      :					Union[str, Any]      		=					self.prepare_config_and_inputs()
														(
														    (
														    A
														)		,		(
														    A
														)		,		(
														    A
														)		,		(
														    A
														)		,		(
														    A
														)		,		(
														    A
														)		,		(
														    A
														)		,		
														)      :					Optional[Any]      		=					config_and_inputs
														A      :					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_						:		Any								=	(
							    (
							        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_						:		Optional[Any]								=	False
							UpperCAmelCase_						:		Optional[Any]								=	False




							def       snake_case			(					self						)		->       str:
														A      :					Dict      		=					TFFunnelModelTester(self						)
														A      :					int      		=					ConfigTester(self    ,						config_class=__UpperCAmelCase						)




							def       snake_case			(					self						)		->       Tuple:
														self.config_tester.run_common_tests()




							def       snake_case			(					self						)		->       List[str]:
														A      :					Tuple      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_model(*__UpperCAmelCase						)




							def       snake_case			(					self						)		->       Union[str, Any]:
														A      :					Optional[Any]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_for_pretraining(*__UpperCAmelCase						)




							def       snake_case			(					self						)		->       Optional[Any]:
														A      :					List[Any]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_for_masked_lm(*__UpperCAmelCase						)




							def       snake_case			(					self						)		->       Optional[Any]:
														A      :					List[Any]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_for_token_classification(*__UpperCAmelCase						)






							def       snake_case			(					self						)		->       Optional[int]:
														A      :					List[str]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_for_question_answering(*__UpperCAmelCase						)







@require_tf
class 					__lowercase  (						_SCREAMING_SNAKE_CASE		,       unittest.TestCase				):





							"""simple docstring"""

							UpperCAmelCase_						:		Any								=	(
							    (TFFunnelBaseModel, TFFunnelForMultipleChoice, TFFunnelForSequenceClassification) if is_tf_available() else ()
							)
							UpperCAmelCase_						:		str								=	False
							UpperCAmelCase_						:		Union[str, Any]								=	False




							def       snake_case			(					self						)		->       int:
														A      :					Optional[int]      		=					TFFunnelModelTester(self    ,						base=__UpperCAmelCase						)
														A      :					Optional[Any]      		=					ConfigTester(self    ,						config_class=__UpperCAmelCase						)




							def       snake_case			(					self						)		->       str:
														self.config_tester.run_common_tests()




							def       snake_case			(					self						)		->       Tuple:
														A      :					Optional[Any]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_base_model(*__UpperCAmelCase						)




							def       snake_case			(					self						)		->       int:
														A      :					Union[str, Any]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_for_sequence_classification(*__UpperCAmelCase						)






							def       snake_case			(					self						)		->       Tuple:
														A      :					List[str]      		=					self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_for_multiple_choice(*__UpperCAmelCase						)






