



'''simple docstring'''





from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType






class __A    (						__UpperCAmelCase		):



	'''simple docstring'''







	__lowerCamelCase					: Optional[Any]    = ['image_processor', 'tokenizer']
	__lowerCamelCase					: Dict    = 'BlipImageProcessor'
	__lowerCamelCase					: List[str]    = 'AutoTokenizer'



	def __init__(self				,     A				,     A )					->  List[str]:


						"""simple docstring"""



						_a											=						False
						super().__init__(A				,     A )
						_a											=						self.image_processor



	def __call__(self				,     A = None				,     A = None				,     A = True				,     A = False				,     A = None				,     A = None				,     A = 0				,     A = None				,     A = None				,     A = False				,     A = False				,     A = False				,     A = False				,     A = False				,     A = True				,     A = None				,     **A				,     )					->  List[str]:


						"""simple docstring"""



						if images is None and text is None:
											raise ValueError('''You have to specify either images or text.''' )

						# Get only text
						if images is None:
											_a											=						self.tokenizer
											_a											=						self.tokenizer(
											    text=A				,     add_special_tokens=A				,     padding=A				,     truncation=A				,     max_length=A				,     stride=A				,     pad_to_multiple_of=A				,     return_attention_mask=A				,     return_overflowing_tokens=A				,     return_special_tokens_mask=A				,     return_offsets_mapping=A				,     return_token_type_ids=A				,     return_length=A				,     verbose=A				,     return_tensors=A				,     **A				,     )
											return text_encoding

						# add pixel_values
						_a											=						self.image_processor(A				,     return_tensors=A )

						if text is not None:
											_a											=						self.tokenizer(
											    text=A				,     add_special_tokens=A				,     padding=A				,     truncation=A				,     max_length=A				,     stride=A				,     pad_to_multiple_of=A				,     return_attention_mask=A				,     return_overflowing_tokens=A				,     return_special_tokens_mask=A				,     return_offsets_mapping=A				,     return_token_type_ids=A				,     return_length=A				,     verbose=A				,     return_tensors=A				,     **A				,     )
						else:
											_a											=						None

						if text_encoding is not None:
											encoding_image_processor.update(A )

						return encoding_image_processor



	def       a__						(self				,     *A				,     **A )					->  Union[str, Any]:


						"""simple docstring"""



						return self.tokenizer.batch_decode(*A				,     **A )



	def       a__						(self				,     *A				,     **A )					->  int:


						"""simple docstring"""



						return self.tokenizer.decode(*A				,     **A )



	@property
	# Copied from transformers.models.blip.processing_blip.BlipProcessor.model_input_names
	def       a__						(self )					->  Dict:


						"""simple docstring"""



						_a											=						self.tokenizer.model_input_names
						_a											=						self.image_processor.model_input_names
						return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names ) )








'''simple docstring'''





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


lowercase_	 =						logging.get_logger(__name__)

lowercase_	 =						{
    "google/pegasus-large": "https://huggingface.co/google/pegasus-large/resolve/main/config.json",
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}






class __A    (						A		):



 '''simple docstring'''







 __lowerCamelCase					: Union[str, Any]    = 'pegasus'
 __lowerCamelCase					: Tuple    = ['past_key_values']
 __lowerCamelCase					: List[Any]    = {'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}



 def __init__(self				,     A=50_265				,     A=1_024				,     A=12				,     A=4_096				,     A=16				,     A=12				,     A=4_096				,     A=16				,     A=0.0				,     A=0.0				,     A=True				,     A=True				,     A="gelu"				,     A=1_024				,     A=0.1				,     A=0.0				,     A=0.0				,     A=0.02				,     A=0				,     A=False				,     A=0				,     A=1				,     A=1				,     **A				,     )					->  str:


      """simple docstring"""



      _a											=						vocab_size
      _a											=						max_position_embeddings
      _a											=						d_model
      _a											=						encoder_ffn_dim
      _a											=						encoder_layers
      _a											=						encoder_attention_heads
      _a											=						decoder_ffn_dim
      _a											=						decoder_layers
      _a											=						decoder_attention_heads
      _a											=						dropout
      _a											=						attention_dropout
      _a											=						activation_dropout
      _a											=						activation_function
      _a											=						init_std
      _a											=						encoder_layerdrop
      _a											=						decoder_layerdrop
      _a											=						use_cache
      _a											=						encoder_layers
      _a											=						scale_embedding  # scale factor will be sqrt(d_model) if True
      super().__init__(
          pad_token_id=A				,     eos_token_id=A				,     is_encoder_decoder=A				,     decoder_start_token_id=A				,     forced_eos_token_id=A				,     **A				,     )



 @property
 def       a__						(self )					->  int:


      """simple docstring"""



      return self.encoder_attention_heads



 @property
 def       a__						(self )					->  int:


      """simple docstring"""



      return self.d_model



