

# 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 				lowercase       ( lowercase_    ):
				__SCREAMING_SNAKE_CASE      :				Tuple     =    '''philschmid/bart-large-cnn-samsum'''
				__SCREAMING_SNAKE_CASE      :				Optional[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.'''
				)
				__SCREAMING_SNAKE_CASE      :				List[Any]     =    '''summarizer'''
				__SCREAMING_SNAKE_CASE      :				List[str]     =    AutoTokenizer
				__SCREAMING_SNAKE_CASE      :				List[str]     =    AutoModelForSeqaSeqLM

				__SCREAMING_SNAKE_CASE      :				Dict     =    ['''text''']
				__SCREAMING_SNAKE_CASE      :				Optional[Any]     =    ['''text''']




				def 					a							(      self   ,     snake_case ):
											return self.pre_processor(snake_case   ,     return_tensors='pt'   ,     truncation=snake_case )




				def 					a							(      self   ,     snake_case ):
											return self.model.generate(**snake_case )[0]




				def 					a							(      self   ,     snake_case ):
											return self.pre_processor.decode(snake_case   ,     skip_special_tokens=snake_case   ,     clean_up_tokenization_spaces=snake_case )







from collections import OrderedDict
from typing import Mapping

from packaging import version

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


_UpperCAmelCase	:     int		       = logging.get_logger(__name__)

_UpperCAmelCase	:     Any		       = {
    """facebook/levit-128S""": """https://huggingface.co/facebook/levit-128S/resolve/main/config.json""",
    # See all LeViT models at https://huggingface.co/models?filter=levit
}







class 				lowercase       ( lowercase_    ):
				__SCREAMING_SNAKE_CASE      :				int     =    '''levit'''




				def __init__(      self   ,     snake_case=224   ,     snake_case=3   ,     snake_case=3   ,     snake_case=2   ,     snake_case=1   ,     snake_case=16   ,     snake_case=[128, 256, 384]   ,     snake_case=[4, 8, 12]   ,     snake_case=[4, 4, 4]   ,     snake_case=[16, 16, 16]   ,     snake_case=0   ,     snake_case=[2, 2, 2]   ,     snake_case=[2, 2, 2]   ,     snake_case=0.02   ,     **snake_case   ,     ):
											super().__init__(**snake_case )
											snake_case_           =					image_size
											snake_case_           =					num_channels
											snake_case_           =					kernel_size
											snake_case_           =					stride
											snake_case_           =					padding
											snake_case_           =					hidden_sizes
											snake_case_           =					num_attention_heads
											snake_case_           =					depths
											snake_case_           =					key_dim
											snake_case_           =					drop_path_rate
											snake_case_           =					patch_size
											snake_case_           =					attention_ratio
											snake_case_           =					mlp_ratio
											snake_case_           =					initializer_range
											snake_case_           =					[
											    ['Subsample', key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
											    ['Subsample', key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
											]







class 				lowercase       ( lowercase_    ):
				__SCREAMING_SNAKE_CASE      :				Dict     =    version.parse('''1.11'''    )




				@property
				def 					a							(      self ):
											return OrderedDict(
											    [
											        ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
											    ] )




				@property
				def 					a							(      self ):
											return 1e-4




