


"""simple docstring"""





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


snake_case__		:     List[Any]    				=				logging.get_logger(__name__)

snake_case__		:     List[Any]    				=				{
    '''tiiuae/falcon-40b''': '''https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json''',
    '''tiiuae/falcon-7b''': '''https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json''',
}



class 		snake_case_(       a__			):
     __UpperCamelCase  =					'''falcon'''
     __UpperCamelCase  =					['''past_key_values''']






     def __init__(	self  :					Union[str, Any]					,				UpperCamelCase_  :					Optional[Any]=6_5_0_2_4					,				UpperCamelCase_  :					List[Any]=4_5_4_4					,				UpperCamelCase_  :					Tuple=3_2					,				UpperCamelCase_  :					Optional[Any]=7_1					,				UpperCamelCase_  :					Tuple=1E-5					,				UpperCamelCase_  :					Dict=0.02					,				UpperCamelCase_  :					List[str]=True					,				UpperCamelCase_  :					Tuple=0.0					,				UpperCamelCase_  :					int=0.0					,				UpperCamelCase_  :					Any=None					,				UpperCamelCase_  :					str=False					,				UpperCamelCase_  :					Optional[int]=False					,				UpperCamelCase_  :					Optional[Any]=True					,				UpperCamelCase_  :					Any=True					,				UpperCamelCase_  :					List[Any]=False					,				UpperCamelCase_  :					Optional[Any]=1_1					,				UpperCamelCase_  :					Optional[int]=1_1					,				**UpperCamelCase_  :					List[str]					,				):
           lowerCAmelCase					:	str       =   vocab_size
           # Backward compatibility with n_embed kwarg
           lowerCAmelCase					:	List[Any]       =   kwargs.pop('''n_embed'''					,				UpperCamelCase_				)
           lowerCAmelCase					:	str       =   hidden_size if n_embed is None else n_embed
           lowerCAmelCase					:	int       =   num_hidden_layers
           lowerCAmelCase					:	Any       =   num_attention_heads
           lowerCAmelCase					:	str       =   layer_norm_epsilon
           lowerCAmelCase					:	str       =   initializer_range
           lowerCAmelCase					:	Optional[int]       =   use_cache
           lowerCAmelCase					:	Dict       =   hidden_dropout
           lowerCAmelCase					:	List[Any]       =   attention_dropout

           lowerCAmelCase					:	List[Any]       =   bos_token_id
           lowerCAmelCase					:	Optional[Any]       =   eos_token_id
           lowerCAmelCase					:	Union[str, Any]       =   num_attention_heads if num_kv_heads is None else num_kv_heads
           lowerCAmelCase					:	Optional[int]       =   alibi
           lowerCAmelCase					:	Union[str, Any]       =   new_decoder_architecture
           lowerCAmelCase					:	List[Any]       =   multi_query  # Ignored when new_decoder_architecture is True
           lowerCAmelCase					:	Any       =   parallel_attn
           lowerCAmelCase					:	Union[str, Any]       =   bias

           super().__init__(bos_token_id=UpperCamelCase_					,				eos_token_id=UpperCamelCase_					,				**UpperCamelCase_				)






     @property
     def      lowerCamelCase__     (	self  :					Optional[Any]				):
           return self.hidden_size // self.num_attention_heads






     @property
     def      lowerCamelCase__     (	self  :					Dict				):
           return not self.alibi






"""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 		snake_case_(       a__			):
     __UpperCamelCase  =					'''philschmid/bart-large-cnn-samsum'''
     __UpperCamelCase  =					(
         '''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.'''
     )
     __UpperCamelCase  =					'''summarizer'''
     __UpperCamelCase  =					AutoTokenizer
     __UpperCamelCase  =					AutoModelForSeqaSeqLM

     __UpperCamelCase  =					['''text''']
     __UpperCamelCase  =					['''text''']






     def      lowerCamelCase__     (	self  :					Dict					,				UpperCamelCase_  :					int				):
           return self.pre_processor(UpperCamelCase_					,				return_tensors='''pt'''					,				truncation=UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					Optional[int]					,				UpperCamelCase_  :					str				):
           return self.model.generate(**UpperCamelCase_				)[0]






     def      lowerCamelCase__     (	self  :					Any					,				UpperCamelCase_  :					Tuple				):
           return self.pre_processor.decode(UpperCamelCase_					,				skip_special_tokens=UpperCamelCase_					,				clean_up_tokenization_spaces=UpperCamelCase_				)


