
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_torch_available,
    is_vision_available,
)


SCREAMING_SNAKE_CASE							:Union[str, Any]										=    {'configuration_beit': ['BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BeitConfig', 'BeitOnnxConfig']}

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				SCREAMING_SNAKE_CASE							:str										=    ['BeitFeatureExtractor']
				SCREAMING_SNAKE_CASE							:Union[str, Any]										=    ['BeitImageProcessor']

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				SCREAMING_SNAKE_CASE							:int										=    [
				    'BEIT_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'BeitForImageClassification',
				    'BeitForMaskedImageModeling',
				    'BeitForSemanticSegmentation',
				    'BeitModel',
				    'BeitPreTrainedModel',
				]


try:
				if not is_flax_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				SCREAMING_SNAKE_CASE							:List[Any]										=    [
				    'FlaxBeitForImageClassification',
				    'FlaxBeitForMaskedImageModeling',
				    'FlaxBeitModel',
				    'FlaxBeitPreTrainedModel',
				]

if TYPE_CHECKING:
				from .configuration_beit import BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP, BeitConfig, BeitOnnxConfig

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_beit import BeitFeatureExtractor
								from .image_processing_beit import BeitImageProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_beit import (
								    BEIT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    BeitForImageClassification,
								    BeitForMaskedImageModeling,
								    BeitForSemanticSegmentation,
								    BeitModel,
								    BeitPreTrainedModel,
								)

				try:
								if not is_flax_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_flax_beit import (
								    FlaxBeitForImageClassification,
								    FlaxBeitForMaskedImageModeling,
								    FlaxBeitModel,
								    FlaxBeitPreTrainedModel,
								)


else:
				import sys

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


import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate





@dataclass(frozen=__SCREAMING_SNAKE_CASE  )
class 							UpperCAmelCase				(  __SCREAMING_SNAKE_CASE  ):




	'''simple docstring'''





	snake_case_    =					field(default="automatic-speech-recognition"      ,      metadata={"include_in_asdict_even_if_is_default": True}  )
	snake_case_    =					Features({"audio": Audio()}  )
	snake_case_    =					Features({"transcription": Value("string"  )}  )
	snake_case_    =					"audio"
	snake_case_    =					"transcription"






	def     UpperCamelCase_  (	self :			Optional[int]							,A :			Union[str, Any]			):
					if self.audio_column not in features:
									raise ValueError(f'''Column {self.audio_column} is not present in features.'''			)
					if not isinstance(features[self.audio_column]							,A			):
									raise ValueError(f'''Column {self.audio_column} is not an Audio type.'''			)
					__A             =			copy.deepcopy(self			)
					__A             =			self.input_schema.copy()
					__A             =			features[self.audio_column]
					__A             =			input_schema
					return task_template







	@property
	def     UpperCamelCase_  (	self :			int			):
					return {self.audio_column: "audio", self.transcription_column: "transcription"}
