


'''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 ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer
from .base import PipelineTool
class   __lowerCAmelCase						(lowercase_     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Any  					=							"""philschmid/bart-large-cnn-samsum"""
      lowerCAmelCase__					:     Union[str, Any]  					=							(
          """This is a tool that summarizes an English text. It takes an input `text` containing the text to summarize, """
          """and returns a summary of the text."""
      )
      lowerCAmelCase__					:     Tuple  					=							"""summarizer"""
      lowerCAmelCase__					:     Optional[Any]  					=							AutoTokenizer
      lowerCAmelCase__					:     Dict  					=							AutoModelForSeqaSeqLM

      lowerCAmelCase__					:     Dict  					=							["""text"""]
      lowerCAmelCase__					:     str  					=							["""text"""]



      def       UpperCamelCase__		(self    :    Optional[Any]   ,						UpperCamelCase    :    List[Any] ):

             '''simple docstring'''







             return self.pre_processor(UpperCamelCase   ,						return_tensors='''pt'''   ,						truncation=UpperCamelCase )



      def       UpperCamelCase__		(self    :    Dict   ,						UpperCamelCase    :    Optional[Any] ):

             '''simple docstring'''







             return self.model.generate(**UpperCamelCase )[0]






      def       UpperCamelCase__		(self    :    Tuple   ,						UpperCamelCase    :    int ):

             '''simple docstring'''







             return self.pre_processor.decode(UpperCamelCase   ,						skip_special_tokens=UpperCamelCase   ,						clean_up_tokenization_spaces=UpperCamelCase )








'''simple docstring'''

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase							:   Dict  						=	logging.get_logger(__name__)

lowerCamelCase							:   Union[str, Any]  						=	{
    # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert
}
class   __lowerCAmelCase						(lowercase_     ):





      '''simple docstring'''






      lowerCAmelCase__					:     List[str]  					=							"""megatron-bert"""



      def __init__(self    :    Tuple   ,						UpperCamelCase    :    Optional[int]=29056   ,						UpperCamelCase    :    Optional[Any]=1024   ,						UpperCamelCase    :    Any=24   ,						UpperCamelCase    :    int=16   ,						UpperCamelCase    :    Optional[int]=4096   ,						UpperCamelCase    :    int="gelu"   ,						UpperCamelCase    :    int=0.1   ,						UpperCamelCase    :    Tuple=0.1   ,						UpperCamelCase    :    Any=512   ,						UpperCamelCase    :    int=2   ,						UpperCamelCase    :    Dict=0.02   ,						UpperCamelCase    :    Dict=1E-12   ,						UpperCamelCase    :    List[Any]=0   ,						UpperCamelCase    :    Optional[int]="absolute"   ,						UpperCamelCase    :    List[Any]=True   ,						**UpperCamelCase    :    str   ,						):

             '''simple docstring'''







             super().__init__(pad_token_id=UpperCamelCase   ,						**UpperCamelCase )

             lowercase__      			= vocab_size
             lowercase__      			= hidden_size
             lowercase__      			= num_hidden_layers
             lowercase__      			= num_attention_heads
             lowercase__      			= hidden_act
             lowercase__      			= intermediate_size
             lowercase__      			= hidden_dropout_prob
             lowercase__      			= attention_probs_dropout_prob
             lowercase__      			= max_position_embeddings
             lowercase__      			= type_vocab_size
             lowercase__      			= initializer_range
             lowercase__      			= layer_norm_eps
             lowercase__      			= position_embedding_type
             lowercase__      			= use_cache




