



'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast
from ...utils import logging


a  :     Dict       =       logging.get_logger(__name__)

a  :     int       =       {
    """uclanlp/plbart-base""": """https://huggingface.co/uclanlp/plbart-base/resolve/main/config.json""",
    # See all PLBART models at https://huggingface.co/models?filter=plbart
}

class      UpperCamelCase_					(				__magic_name__     ):
	lowercase		=					'plbart'
	lowercase		=					['past_key_values']
	lowercase		=					{'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}





	def __init__(    self						,						A=50005						,						A=1024						,						A=6						,						A=3072						,						A=12						,						A=6						,						A=3072						,						A=12						,						A=0.0						,						A=0.0						,						A=True						,						A=True						,						A="gelu"						,						A=768						,						A=0.1						,						A=0.1						,						A=0.0						,						A=0.0_2						,						A=0.0						,						A=True						,						A=1						,						A=0						,						A=2						,						A=2						,						**A						,						)     ->     Any:
								UpperCAmelCase	:						List[Any]					=						vocab_size
								UpperCAmelCase	:						List[str]					=						max_position_embeddings
								UpperCAmelCase	:						Tuple					=						d_model
								UpperCAmelCase	:						List[str]					=						encoder_ffn_dim
								UpperCAmelCase	:						Dict					=						encoder_layers
								UpperCAmelCase	:						Dict					=						encoder_attention_heads
								UpperCAmelCase	:						Union[str, Any]					=						decoder_ffn_dim
								UpperCAmelCase	:						Any					=						decoder_layers
								UpperCAmelCase	:						Any					=						decoder_attention_heads
								UpperCAmelCase	:						List[Any]					=						dropout
								UpperCAmelCase	:						Tuple					=						attention_dropout
								UpperCAmelCase	:						Optional[Any]					=						activation_dropout
								UpperCAmelCase	:						int					=						activation_function
								UpperCAmelCase	:						Optional[Any]					=						init_std
								UpperCAmelCase	:						List[str]					=						encoder_layerdrop
								UpperCAmelCase	:						Optional[Any]					=						decoder_layerdrop
								UpperCAmelCase	:						Optional[int]					=						classifier_dropout
								UpperCAmelCase	:						List[str]					=						use_cache
								UpperCAmelCase	:						Any					=						encoder_layers
								UpperCAmelCase	:						int					=						scale_embedding  # scale factor will be sqrt(d_model) if True
								super().__init__(
								    pad_token_id=A						,						bos_token_id=A						,						eos_token_id=A						,						is_encoder_decoder=A						,						forced_eos_token_id=A						,						**A						,						)




class      UpperCamelCase_					(				__magic_name__     ):





	@property
	def 					_lowercase(    self       )     ->     Mapping[str, Mapping[int, str]]:
								return OrderedDict(
								    [
								        ("""input_ids""", {0: """batch""", 1: """sequence"""}),
								        ("""attention_mask""", {0: """batch""", 1: """sequence"""}),
								    ]       )






	@property
	def 					_lowercase(    self       )     ->     Mapping[str, Mapping[int, str]]:
								if self.use_past:
															return OrderedDict(
															    [
															        ("""last_hidden_state""", {0: """batch""", 1: """sequence"""}),
															        ("""past_keys""", {0: """batch""", 2: """sequence"""}),
															        ("""encoder_last_hidden_state""", {0: """batch""", 1: """sequence"""}),
															    ]       )
								else:
															return OrderedDict(
															    [
															        ("""last_hidden_state""", {0: """batch""", 1: """sequence"""}),
															        ("""encoder_last_hidden_state""", {0: """batch""", 1: """sequence"""}),
															    ]       )






'''simple docstring'''




# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

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


a  :     Optional[Any]       =       {
    """agents""": ["""Agent""", """AzureOpenAiAgent""", """HfAgent""", """LocalAgent""", """OpenAiAgent"""],
    """base""": ["""PipelineTool""", """RemoteTool""", """Tool""", """launch_gradio_demo""", """load_tool"""],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a  :     Dict       =       ["""DocumentQuestionAnsweringTool"""]
							a  :     List[str]       =       ["""ImageCaptioningTool"""]
							a  :     Tuple       =       ["""ImageQuestionAnsweringTool"""]
							a  :     Tuple       =       ["""ImageSegmentationTool"""]
							a  :     List[str]       =       ["""SpeechToTextTool"""]
							a  :     Dict       =       ["""TextClassificationTool"""]
							a  :     Union[str, Any]       =       ["""TextQuestionAnsweringTool"""]
							a  :     List[str]       =       ["""TextSummarizationTool"""]
							a  :     Optional[Any]       =       ["""TextToSpeechTool"""]
							a  :     str       =       ["""TranslationTool"""]

if TYPE_CHECKING:
							from .agents import Agent, AzureOpenAiAgent, HfAgent, LocalAgent, OpenAiAgent
							from .base import PipelineTool, RemoteTool, Tool, launch_gradio_demo, load_tool

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .document_question_answering import DocumentQuestionAnsweringTool
														from .image_captioning import ImageCaptioningTool
														from .image_question_answering import ImageQuestionAnsweringTool
														from .image_segmentation import ImageSegmentationTool
														from .speech_to_text import SpeechToTextTool
														from .text_classification import TextClassificationTool
														from .text_question_answering import TextQuestionAnsweringTool
														from .text_summarization import TextSummarizationTool
														from .text_to_speech import TextToSpeechTool
														from .translation import TranslationTool
else:
							import sys

							a  :     Dict       =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

