





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


__lowerCAmelCase 	=      [
    "AutomaticSpeechRecognition",
    "AudioClassification",
    "ImageClassification",
    "LanguageModeling",
    "QuestionAnsweringExtractive",
    "Summarization",
    "TaskTemplate",
    "TextClassification",
]

__lowerCAmelCase 	=      get_logger(__name__)


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

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












from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCAmelCase 	=      {"configuration_visual_bert": ["VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "VisualBertConfig"]}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowerCAmelCase 	=      [
				    "VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST",
				    "VisualBertForMultipleChoice",
				    "VisualBertForPreTraining",
				    "VisualBertForQuestionAnswering",
				    "VisualBertForRegionToPhraseAlignment",
				    "VisualBertForVisualReasoning",
				    "VisualBertLayer",
				    "VisualBertModel",
				    "VisualBertPreTrainedModel",
				]


if TYPE_CHECKING:
				from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_visual_bert import (
								    VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    VisualBertForMultipleChoice,
								    VisualBertForPreTraining,
								    VisualBertForQuestionAnswering,
								    VisualBertForRegionToPhraseAlignment,
								    VisualBertForVisualReasoning,
								    VisualBertLayer,
								    VisualBertModel,
								    VisualBertPreTrainedModel,
								)


else:
				import sys

				__lowerCAmelCase 	=      _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





