




import importlib
import os
import sys


# This is required to make the module import works (when the python process is running from the root of the repo)
sys.path.append(".")







def      lowerCamelCase_						(			UpperCamelCase__							: int )	->			Tuple:





				"""simple docstring"""


				__lowerCamelCase									=       test_file.split(os.path.sep )
				if components[0:2] != ["tests", "models"]:
								raise ValueError(
								    '`test_file` should start with `tests/models/` (with `/` being the OS specific path separator). Got '
								    F"""{test_file} instead.""" )
				__lowerCamelCase									=       components[-1]
				if not test_fn.endswith('py' ):
								raise ValueError(F"""`test_file` should be a python file. Got {test_fn} instead.""" )
				if not test_fn.startswith('test_modeling_' ):
								raise ValueError(
								    F"""`test_file` should point to a file name of the form `test_modeling_*.py`. Got {test_fn} instead.""" )

				__lowerCamelCase									=       components[:-1] + [test_fn.replace('.py'					,	'' )]
				__lowerCamelCase									=       '.'.join(lowerCamelCase_ )

				return test_module_path







def      lowerCamelCase_						(			UpperCamelCase__							: str )	->			Optional[int]:





				"""simple docstring"""


				__lowerCamelCase									=       get_module_path(lowerCamelCase_ )
				__lowerCamelCase									=       importlib.import_module(lowerCamelCase_ )

				return test_module







def      lowerCamelCase_						(			UpperCamelCase__							: Optional[int] )	->			int:





				"""simple docstring"""


				__lowerCamelCase									=       []
				__lowerCamelCase									=       get_test_module(lowerCamelCase_ )
				for attr in dir(lowerCamelCase_ ):
								if attr.endswith('ModelTester' ):
												tester_classes.append(getattr(lowerCamelCase_					,	lowerCamelCase_ ) )

    # sort with class names
				return sorted(lowerCamelCase_					,	key=lambda UpperCamelCase__ : x.__name__ )







def      lowerCamelCase_						(			UpperCamelCase__							: List[Any] )	->			List[Any]:





				"""simple docstring"""


				__lowerCamelCase									=       []
				__lowerCamelCase									=       get_test_module(lowerCamelCase_ )
				for attr in dir(lowerCamelCase_ ):
								__lowerCamelCase									=       getattr(lowerCamelCase_					,	lowerCamelCase_ )
								# (TF/Flax)ModelTesterMixin is also an attribute in specific model test module. Let's exclude them by checking
								# `all_model_classes` is not empty (which also excludes other special classes).
								__lowerCamelCase									=       getattr(lowerCamelCase_					,	'all_model_classes'					,	[] )
								if len(lowerCamelCase_ ) > 0:
												test_classes.append(lowerCamelCase_ )

    # sort with class names
				return sorted(lowerCamelCase_					,	key=lambda UpperCamelCase__ : x.__name__ )







def      lowerCamelCase_						(			UpperCamelCase__							: Any )	->			Optional[int]:





				"""simple docstring"""


				__lowerCamelCase									=       get_test_classes(lowerCamelCase_ )
				__lowerCamelCase									=       set()
				for test_class in test_classes:
								model_classes.update(test_class.all_model_classes )

				# sort with class names
				return sorted(lowerCamelCase_					,	key=lambda UpperCamelCase__ : x.__name__ )







def      lowerCamelCase_						(			UpperCamelCase__							: Dict )	->			Tuple:





				"""simple docstring"""


				__lowerCamelCase									=       test_class()
				if hasattr(lowerCamelCase_					,	'setUp' ):
								test.setUp()

				__lowerCamelCase									=       None
				if hasattr(lowerCamelCase_					,	'model_tester' ):
								# `(TF/Flax)ModelTesterMixin` has this attribute default to `None`. Let's skip this case.
								if test.model_tester is not None:
												__lowerCamelCase									=       test.model_tester.__class__

				return model_tester







def      lowerCamelCase_						(			UpperCamelCase__							: Optional[int]					,	UpperCamelCase__							: Optional[Any] )	->			str:





				"""simple docstring"""


				__lowerCamelCase									=       get_test_classes(lowerCamelCase_ )

				__lowerCamelCase									=       []
				for test_class in test_classes:
								if model_class in test_class.all_model_classes:
												target_test_classes.append(lowerCamelCase_ )

    # sort with class names
				return sorted(lowerCamelCase_					,	key=lambda UpperCamelCase__ : x.__name__ )







def      lowerCamelCase_						(			UpperCamelCase__							: Tuple					,	UpperCamelCase__							: Tuple )	->			Optional[int]:





				"""simple docstring"""


				__lowerCamelCase									=       get_test_classes_for_model(lowerCamelCase_					,	lowerCamelCase_ )

				__lowerCamelCase									=       []
				for test_class in test_classes:
								__lowerCamelCase									=       get_model_tester_from_test_class(lowerCamelCase_ )
								if tester_class is not None:
												tester_classes.append(lowerCamelCase_ )

    # sort with class names
				return sorted(lowerCamelCase_					,	key=lambda UpperCamelCase__ : x.__name__ )







def      lowerCamelCase_						(			UpperCamelCase__							: List[Any] )	->			Dict:





				"""simple docstring"""


				__lowerCamelCase									=       get_test_classes(lowerCamelCase_ )
				__lowerCamelCase									=       {test_class: get_model_tester_from_test_class(lowerCamelCase_ ) for test_class in test_classes}
				return test_tester_mapping







def      lowerCamelCase_						(			UpperCamelCase__							: int )	->			Tuple:





				"""simple docstring"""


				__lowerCamelCase									=       get_model_classes(lowerCamelCase_ )
				__lowerCamelCase									=       {
				    model_class: get_test_classes_for_model(lowerCamelCase_					,	lowerCamelCase_ ) for model_class in model_classes
				}
				return model_test_mapping







def      lowerCamelCase_						(			UpperCamelCase__							: Any )	->			int:





				"""simple docstring"""


				__lowerCamelCase									=       get_model_classes(lowerCamelCase_ )
				__lowerCamelCase									=       {
				    model_class: get_tester_classes_for_model(lowerCamelCase_					,	lowerCamelCase_ ) for model_class in model_classes
				}
				return model_to_tester_mapping







def      lowerCamelCase_						(			UpperCamelCase__							: Dict )	->			str:





				"""simple docstring"""


				if isinstance(lowerCamelCase_					,	lowerCamelCase_ ):
								return o
				elif isinstance(lowerCamelCase_					,	lowerCamelCase_ ):
								return o.__name__
				elif isinstance(lowerCamelCase_					,	(list, tuple) ):
								return [to_json(lowerCamelCase_ ) for x in o]
				elif isinstance(lowerCamelCase_					,	lowerCamelCase_ ):
								return {to_json(lowerCamelCase_ ): to_json(lowerCamelCase_ ) for k, v in o.items()}
				else:
								return o








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCamelCase__ :   Optional[Any]						=							{
    '''configuration_whisper''': ['''WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''WhisperConfig''', '''WhisperOnnxConfig'''],
    '''feature_extraction_whisper''': ['''WhisperFeatureExtractor'''],
    '''processing_whisper''': ['''WhisperProcessor'''],
    '''tokenization_whisper''': ['''WhisperTokenizer'''],
}

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   str						=							['''WhisperTokenizerFast''']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   List[Any]						=							[
						    '''WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''WhisperForConditionalGeneration''',
						    '''WhisperModel''',
						    '''WhisperPreTrainedModel''',
						    '''WhisperForAudioClassification''',
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   Tuple						=							[
						    '''TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''TFWhisperForConditionalGeneration''',
						    '''TFWhisperModel''',
						    '''TFWhisperPreTrainedModel''',
						]

try:
						if not is_flax_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   List[str]						=							[
						    '''FlaxWhisperForConditionalGeneration''',
						    '''FlaxWhisperModel''',
						    '''FlaxWhisperPreTrainedModel''',
						    '''FlaxWhisperForAudioClassification''',
						]


if TYPE_CHECKING:
						from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
						from .feature_extraction_whisper import WhisperFeatureExtractor
						from .processing_whisper import WhisperProcessor
						from .tokenization_whisper import WhisperTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_whisper_fast import WhisperTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_whisper import (
												    WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    WhisperForAudioClassification,
												    WhisperForConditionalGeneration,
												    WhisperModel,
												    WhisperPreTrainedModel,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_whisper import (
												    TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFWhisperForConditionalGeneration,
												    TFWhisperModel,
												    TFWhisperPreTrainedModel,
												)

						try:
												if not is_flax_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_flax_whisper import (
												    FlaxWhisperForAudioClassification,
												    FlaxWhisperForConditionalGeneration,
												    FlaxWhisperModel,
												    FlaxWhisperPreTrainedModel,
												)

else:
						import sys

						UpperCamelCase__ :   Optional[Any]						=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



