
from typing import TYPE_CHECKING

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


UpperCAmelCase__				:  List[str]       					=				{'''configuration_hubert''': ['''HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''HubertConfig''']}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__				:  Any       					=				[
							    '''HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''HubertForCTC''',
							    '''HubertForSequenceClassification''',
							    '''HubertModel''',
							    '''HubertPreTrainedModel''',
							]


try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__				:  int       					=				[
							    '''TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''TFHubertForCTC''',
							    '''TFHubertModel''',
							    '''TFHubertPreTrainedModel''',
							]

if TYPE_CHECKING:
							from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_hubert import (
														    HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    HubertForCTC,
														    HubertForSequenceClassification,
														    HubertModel,
														    HubertPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_hubert import (
														    TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFHubertForCTC,
														    TFHubertModel,
														    TFHubertPreTrainedModel,
														)


else:
							import sys

							UpperCAmelCase__				:  Dict       					=				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





from typing import Optional

from ..utils.logging import get_logger
from .audio_classificiation import AudioClassification
from .automatic_speech_recognition import AutomaticSpeechRecognition
from .base import TaskTemplate
from .image_classification import ImageClassification
from .language_modeling import LanguageModeling
from .question_answering import QuestionAnsweringExtractive
from .summarization import Summarization
from .text_classification import TextClassification


UpperCAmelCase__				:  Tuple       					=				[
    '''AutomaticSpeechRecognition''',
    '''AudioClassification''',
    '''ImageClassification''',
    '''LanguageModeling''',
    '''QuestionAnsweringExtractive''',
    '''Summarization''',
    '''TaskTemplate''',
    '''TextClassification''',
]

UpperCAmelCase__				:  Dict       					=				get_logger(__name__)


UpperCAmelCase__				:  Dict       					=				{
    AutomaticSpeechRecognition.task: AutomaticSpeechRecognition,
    AudioClassification.task: AudioClassification,
    ImageClassification.task: ImageClassification,
    LanguageModeling.task: LanguageModeling,
    QuestionAnsweringExtractive.task: QuestionAnsweringExtractive,
    Summarization.task: Summarization,
    TextClassification.task: TextClassification,
}



def       _lowercase					(      __SCREAMING_SNAKE_CASE )	->     Optional[TaskTemplate]:
			UpperCamelCase__    :		Any     =				task_template_dict.get('task' )
			if task_name is None:
						logger.warning(F"""Couldn't find template for task '{task_name}'. Available templates: {list(__SCREAMING_SNAKE_CASE )}""" )
						return None
			UpperCamelCase__    :		Any     =				NAMEaTEMPLATE.get(__SCREAMING_SNAKE_CASE )
			return template.from_dict(__SCREAMING_SNAKE_CASE )



