



'''simple docstring'''

from typing import Optional

import torch
import torch.utils.checkpoint
from torch import Tensor, nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_outputs import (
    BaseModelOutputWithNoAttention,
    BaseModelOutputWithPoolingAndNoAttention,
    ImageClassifierOutputWithNoAttention,
)
from ...modeling_utils import PreTrainedModel
from ...utils import logging
from .configuration_regnet import RegNetConfig


__lowerCAmelCase									=   logging.get_logger(__name__)

# General docstring
__lowerCAmelCase									=   '''RegNetConfig'''

# Base docstring
__lowerCAmelCase									=   '''facebook/regnet-y-040'''
__lowerCAmelCase									=   [1, 1_088, 7, 7]

# Image classification docstring
__lowerCAmelCase									=   '''facebook/regnet-y-040'''
__lowerCAmelCase									=   '''tabby, tabby cat'''

__lowerCAmelCase									=   [
    '''facebook/regnet-y-040''',
    # See all regnet models at https://huggingface.co/models?filter=regnet
]

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       Optional[Any]	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int = 3	,_UpperCAmelCase					:       int = 1	,_UpperCAmelCase					:       int = 1	,_UpperCAmelCase					:       Optional[str] = "relu"	,):
									super().__init__()
									_a     :      Optional[int]        =							nn.Convad(
									    _UpperCAmelCase	,_UpperCAmelCase	,kernel_size=_UpperCAmelCase	,stride=_UpperCAmelCase	,padding=kernel_size // 2	,groups=_UpperCAmelCase	,bias=_UpperCAmelCase	,)
									_a     :      Any        =							nn.BatchNormad(_UpperCAmelCase		)
									_a     :      Optional[int]        =							ACTaFN[activation] if activation is not None else nn.Identity()







							def 							__lowercase			(							self					:       int	,_UpperCAmelCase					:       List[str]		):
									_a     :      Dict        =							self.convolution(_UpperCAmelCase		)
									_a     :      List[str]        =							self.normalization(_UpperCAmelCase		)
									_a     :      List[Any]        =							self.activation(_UpperCAmelCase		)
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       Any	,_UpperCAmelCase					:       RegNetConfig		):
									super().__init__()
									_a     :      List[Any]        =							RegNetConvLayer(
									    config.num_channels	,config.embedding_size	,kernel_size=3	,stride=2	,activation=config.hidden_act		)
									_a     :      List[str]        =							config.num_channels







							def 							__lowercase			(							self					:       str	,_UpperCAmelCase					:       Tuple		):
									_a     :      Tuple        =							pixel_values.shape[1]
									if num_channels != self.num_channels:
											raise ValueError(
											    'Make sure that the channel dimension of the pixel values match with the one set in the configuration.'		)
									_a     :      Optional[int]        =							self.embedder(_UpperCAmelCase		)
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       List[Any]	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int = 2		):
									super().__init__()
									_a     :      str        =							nn.Convad(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1	,stride=_UpperCAmelCase	,bias=_UpperCAmelCase		)
									_a     :      Optional[Any]        =							nn.BatchNormad(_UpperCAmelCase		)







							def 							__lowercase			(							self					:       Dict	,_UpperCAmelCase					:       Tensor		):
									_a     :      int        =							self.convolution(_UpperCAmelCase		)
									_a     :      Any        =							self.normalization(_UpperCAmelCase		)
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       Optional[int]	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int		):
									super().__init__()

									_a     :      Optional[int]        =							nn.AdaptiveAvgPoolad((1, 1)		)
									_a     :      int        =							nn.Sequential(
									    nn.Convad(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1		)	,nn.ReLU()	,nn.Convad(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1		)	,nn.Sigmoid()	,)







							def 							__lowercase			(							self					:       Optional[Any]	,_UpperCAmelCase					:       Optional[int]		):
									# b c h w -> b c 1 1
									_a     :      int        =							self.pooler(_UpperCAmelCase		)
									_a     :      Dict        =							self.attention(_UpperCAmelCase		)
									_a     :      List[str]        =							hidden_state * attention
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       List[Any]	,_UpperCAmelCase					:       RegNetConfig	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int = 1		):
									super().__init__()
									_a     :      str        =							in_channels != out_channels or stride != 1
									_a     :      int        =							max(1	,out_channels // config.groups_width		)
									_a     :      Tuple        =							(
									    RegNetShortCut(_UpperCAmelCase	,_UpperCAmelCase	,stride=_UpperCAmelCase		) if should_apply_shortcut else nn.Identity()
									)
									_a     :      Any        =							nn.Sequential(
									    RegNetConvLayer(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1	,activation=config.hidden_act		)	,RegNetConvLayer(_UpperCAmelCase	,_UpperCAmelCase	,stride=_UpperCAmelCase	,groups=_UpperCAmelCase	,activation=config.hidden_act		)	,RegNetConvLayer(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1	,activation=_UpperCAmelCase		)	,)
									_a     :      Any        =							ACTaFN[config.hidden_act]







							def 							__lowercase			(							self					:       List[Any]	,_UpperCAmelCase					:       str		):
									_a     :      str        =							hidden_state
									_a     :      str        =							self.layer(_UpperCAmelCase		)
									_a     :      Tuple        =							self.shortcut(_UpperCAmelCase		)
									hidden_state += residual
									_a     :      Optional[Any]        =							self.activation(_UpperCAmelCase		)
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       Any	,_UpperCAmelCase					:       RegNetConfig	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int = 1		):
									super().__init__()
									_a     :      Optional[int]        =							in_channels != out_channels or stride != 1
									_a     :      str        =							max(1	,out_channels // config.groups_width		)
									_a     :      Dict        =							(
									    RegNetShortCut(_UpperCAmelCase	,_UpperCAmelCase	,stride=_UpperCAmelCase		) if should_apply_shortcut else nn.Identity()
									)
									_a     :      int        =							nn.Sequential(
									    RegNetConvLayer(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1	,activation=config.hidden_act		)	,RegNetConvLayer(_UpperCAmelCase	,_UpperCAmelCase	,stride=_UpperCAmelCase	,groups=_UpperCAmelCase	,activation=config.hidden_act		)	,RegNetSELayer(_UpperCAmelCase	,reduced_channels=int(round(in_channels / 4		)		)		)	,RegNetConvLayer(_UpperCAmelCase	,_UpperCAmelCase	,kernel_size=1	,activation=_UpperCAmelCase		)	,)
									_a     :      Optional[int]        =							ACTaFN[config.hidden_act]







							def 							__lowercase			(							self					:       Dict	,_UpperCAmelCase					:       Any		):
									_a     :      List[str]        =							hidden_state
									_a     :      Tuple        =							self.layer(_UpperCAmelCase		)
									_a     :      Dict        =							self.shortcut(_UpperCAmelCase		)
									hidden_state += residual
									_a     :      List[str]        =							self.activation(_UpperCAmelCase		)
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       Any	,_UpperCAmelCase					:       RegNetConfig	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       int = 2	,_UpperCAmelCase					:       int = 2	,):
									super().__init__()

									_a     :      Dict        =							RegNetXLayer if config.layer_type == 'x' else RegNetYLayer

									_a     :      Any        =							nn.Sequential(
									    # downsampling is done in the first layer with stride of 2
									    layer(
									        _UpperCAmelCase	,_UpperCAmelCase	,_UpperCAmelCase	,stride=_UpperCAmelCase	,)	,*[layer(_UpperCAmelCase	,_UpperCAmelCase	,_UpperCAmelCase		) for _ in range(depth - 1		)]	,)







							def 							__lowercase			(							self					:       Union[str, Any]	,_UpperCAmelCase					:       Optional[Any]		):
									_a     :      Union[str, Any]        =							self.layers(_UpperCAmelCase		)
									return hidden_state

class 	__magic_name__						(    nn.Module   ):







							def __init__(							self					:       str	,_UpperCAmelCase					:       RegNetConfig		):
									super().__init__()
									_a     :      Dict        =							nn.ModuleList([]		)
									# based on `downsample_in_first_stage`, the first layer of the first stage may or may not downsample the input
									self.stages.append(
									    RegNetStage(
									        _UpperCAmelCase	,config.embedding_size	,config.hidden_sizes[0]	,stride=2 if config.downsample_in_first_stage else 1	,depth=config.depths[0]	,)		)
									_a     :      int        =							zip(config.hidden_sizes	,config.hidden_sizes[1:]		)
									for (in_channels, out_channels), depth in zip(_UpperCAmelCase	,config.depths[1:]		):
											self.stages.append(RegNetStage(_UpperCAmelCase	,_UpperCAmelCase	,_UpperCAmelCase	,depth=_UpperCAmelCase		)		)







							def 							__lowercase			(							self					:       Union[str, Any]	,_UpperCAmelCase					:       Tensor	,_UpperCAmelCase					:       bool = False	,_UpperCAmelCase					:       bool = True		):
									_a     :      Optional[int]        =							() if output_hidden_states else None

									for stage_module in self.stages:
											if output_hidden_states:
													_a     :      str        =							hidden_states + (hidden_state,)

											_a     :      Any        =							stage_module(_UpperCAmelCase		)

									if output_hidden_states:
											_a     :      str        =							hidden_states + (hidden_state,)

									if not return_dict:
											return tuple(v for v in [hidden_state, hidden_states] if v is not None		)

									return BaseModelOutputWithNoAttention(last_hidden_state=_UpperCAmelCase	,hidden_states=_UpperCAmelCase		)

class 	__magic_name__						(    _UpperCamelCase   ):
							lowerCAmelCase       :    int   				=					RegNetConfig
							lowerCAmelCase       :    int   				=					'regnet'
							lowerCAmelCase       :    Optional[int]   				=					'pixel_values'
							lowerCAmelCase       :    List[Any]   				=					True







							def 							__lowercase			(							self					:       Dict	,_UpperCAmelCase					:       Dict		):
									if isinstance(_UpperCAmelCase	,nn.Convad		):
											nn.init.kaiming_normal_(module.weight	,mode='fan_out'	,nonlinearity='relu'		)
									elif isinstance(_UpperCAmelCase	,(nn.BatchNormad, nn.GroupNorm)		):
											nn.init.constant_(module.weight	,1		)
											nn.init.constant_(module.bias	,0		)







							def 							__lowercase			(							self					:       Union[str, Any]	,_UpperCAmelCase					:       List[str]	,_UpperCAmelCase					:       Dict=False		):
									if isinstance(_UpperCAmelCase	,_UpperCAmelCase		):
											_a     :      Union[str, Any]        =							value
__lowerCAmelCase									=   r'''
    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it
    as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
    behavior.

    Parameters:
        config ([`RegNetConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
'''

__lowerCAmelCase									=   r'''
    Args:
        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See
            [`ConvNextImageProcessor.__call__`] for details.

        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
'''

@add_start_docstrings(
    'The bare RegNet model outputting raw features without any specific head on top.'			,						_UpperCamelCase			,						)
# Copied from transformers.models.resnet.modeling_resnet.ResNetModel with RESNET->REGNET,ResNet->RegNet
class 	__magic_name__						(    _UpperCamelCase   ):







							def __init__(							self					:       Optional[Any]	,_UpperCAmelCase					:       Any		):
									super().__init__(_UpperCAmelCase		)
									_a     :      List[Any]        =							config
									_a     :      int        =							RegNetEmbeddings(_UpperCAmelCase		)
									_a     :      str        =							RegNetEncoder(_UpperCAmelCase		)
									_a     :      Optional[int]        =							nn.AdaptiveAvgPoolad((1, 1)		)
									# Initialize weights and apply final processing
									self.post_init()







							@add_start_docstrings_to_model_forward(_UpperCAmelCase		)
							@add_code_sample_docstrings(
							    checkpoint=_CHECKPOINT_FOR_DOC	,output_type=_UpperCAmelCase	,config_class=_CONFIG_FOR_DOC	,modality='vision'	,expected_output=_EXPECTED_OUTPUT_SHAPE	,)
							def 							__lowercase			(							self					:       List[str]	,_UpperCAmelCase					:       Tensor	,_UpperCAmelCase					:       Optional[bool] = None	,_UpperCAmelCase					:       Optional[bool] = None		):
									_a     :      Any        =							(
									    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
									)
									_a     :      Optional[int]        =							return_dict if return_dict is not None else self.config.use_return_dict

									_a     :      List[str]        =							self.embedder(_UpperCAmelCase		)

									_a     :      Tuple        =							self.encoder(
									    _UpperCAmelCase	,output_hidden_states=_UpperCAmelCase	,return_dict=_UpperCAmelCase		)

									_a     :      List[Any]        =							encoder_outputs[0]

									_a     :      int        =							self.pooler(_UpperCAmelCase		)

									if not return_dict:
											return (last_hidden_state, pooled_output) + encoder_outputs[1:]

									return BaseModelOutputWithPoolingAndNoAttention(
									    last_hidden_state=_UpperCAmelCase	,pooler_output=_UpperCAmelCase	,hidden_states=encoder_outputs.hidden_states	,)

@add_start_docstrings(
    '\n    RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    '			,						_UpperCamelCase			,						)
# Copied from transformers.models.resnet.modeling_resnet.ResNetForImageClassification with RESNET->REGNET,ResNet->RegNet,resnet->regnet
class 	__magic_name__						(    _UpperCamelCase   ):







							def __init__(							self					:       Union[str, Any]	,_UpperCAmelCase					:       Dict		):
									super().__init__(_UpperCAmelCase		)
									_a     :      List[Any]        =							config.num_labels
									_a     :      Any        =							RegNetModel(_UpperCAmelCase		)
									# classification head
									_a     :      Union[str, Any]        =							nn.Sequential(
									    nn.Flatten()	,nn.Linear(config.hidden_sizes[-1]	,config.num_labels		) if config.num_labels > 0 else nn.Identity()	,)
									# initialize weights and apply final processing
									self.post_init()







							@add_start_docstrings_to_model_forward(_UpperCAmelCase		)
							@add_code_sample_docstrings(
							    checkpoint=_IMAGE_CLASS_CHECKPOINT	,output_type=_UpperCAmelCase	,config_class=_CONFIG_FOR_DOC	,expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT	,)
							def 							__lowercase			(							self					:       Dict	,_UpperCAmelCase					:       Optional[torch.FloatTensor] = None	,_UpperCAmelCase					:       Optional[torch.LongTensor] = None	,_UpperCAmelCase					:       Optional[bool] = None	,_UpperCAmelCase					:       Optional[bool] = None	,):
									_a     :      Any        =							return_dict if return_dict is not None else self.config.use_return_dict

									_a     :      Optional[int]        =							self.regnet(_UpperCAmelCase	,output_hidden_states=_UpperCAmelCase	,return_dict=_UpperCAmelCase		)

									_a     :      Optional[int]        =							outputs.pooler_output if return_dict else outputs[1]

									_a     :      List[Any]        =							self.classifier(_UpperCAmelCase		)

									_a     :      Dict        =							None

									if labels is not None:
											if self.config.problem_type is None:
													if self.num_labels == 1:
															_a     :      Tuple        =							'regression'
													elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
															_a     :      Any        =							'single_label_classification'
													else:
															_a     :      Union[str, Any]        =							'multi_label_classification'
											if self.config.problem_type == "regression":
													_a     :      List[str]        =							MSELoss()
													if self.num_labels == 1:
															_a     :      int        =							loss_fct(logits.squeeze()	,labels.squeeze()		)
													else:
															_a     :      Union[str, Any]        =							loss_fct(_UpperCAmelCase	,_UpperCAmelCase		)
											elif self.config.problem_type == "single_label_classification":
													_a     :      List[Any]        =							CrossEntropyLoss()
													_a     :      Tuple        =							loss_fct(logits.view(-1	,self.num_labels		)	,labels.view(-1		)		)
											elif self.config.problem_type == "multi_label_classification":
													_a     :      List[Any]        =							BCEWithLogitsLoss()
													_a     :      int        =							loss_fct(_UpperCAmelCase	,_UpperCAmelCase		)

									if not return_dict:
											_a     :      int        =							(logits,) + outputs[2:]
											return (loss,) + output if loss is not None else output

									return ImageClassifierOutputWithNoAttention(loss=_UpperCAmelCase	,logits=_UpperCAmelCase	,hidden_states=outputs.hidden_states		)











'''simple docstring'''




import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers.testing_utils import require_vision
from transformers.utils import is_vision_available


if is_vision_available():
  from PIL import Image

  from transformers import AutoProcessor, BertTokenizer, BlipImageProcessor, BlipProcessor, PreTrainedTokenizerFast


@require_vision
class  SCREAMING_SNAKE_CASE    (unittest.TestCase							):


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: Dict      =       tempfile.mkdtemp()

          __A						: Optional[int]      =       BlipImageProcessor()
          __A						: List[str]      =       BertTokenizer.from_pretrained('hf-internal-testing/tiny-random-BertModel')

          __A						: Any      =       BlipProcessor(_UpperCAmelCase						,	_UpperCAmelCase)

          processor.save_pretrained(self.tmpdirname)


     def 							SCREAMING_SNAKE_CASE  (						self						,	**_UpperCAmelCase):

          '''simple docstring'''






          return AutoProcessor.from_pretrained(self.tmpdirname						,	**_UpperCAmelCase).tokenizer


     def 							SCREAMING_SNAKE_CASE  (						self						,	**_UpperCAmelCase):

          '''simple docstring'''






          return AutoProcessor.from_pretrained(self.tmpdirname						,	**_UpperCAmelCase).image_processor


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          shutil.rmtree(self.tmpdirname)


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: int      =       [np.random.randint(255						,	size=(3, 30, 400)						,	dtype=np.uinta)]

          __A						: Union[str, Any]      =       [Image.fromarray(np.moveaxis(_UpperCAmelCase						,	0						,	-1)) for x in image_inputs]

          return image_inputs


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: int      =       BlipProcessor(tokenizer=self.get_tokenizer()						,	image_processor=self.get_image_processor())
          processor.save_pretrained(self.tmpdirname)

          __A						: int      =       self.get_tokenizer(bos_token='(BOS)'						,	eos_token='(EOS)')
          __A						: List[Any]      =       self.get_image_processor(do_normalize=_UpperCAmelCase						,	padding_value=1.0)

          __A						: Tuple      =       BlipProcessor.from_pretrained(
              self.tmpdirname						,	bos_token='(BOS)'						,	eos_token='(EOS)'						,	do_normalize=_UpperCAmelCase						,	padding_value=1.0)

          self.assertEqual(processor.tokenizer.get_vocab()						,	tokenizer_add_kwargs.get_vocab())
          self.assertIsInstance(processor.tokenizer						,	_UpperCAmelCase)

          self.assertEqual(processor.image_processor.to_json_string()						,	image_processor_add_kwargs.to_json_string())
          self.assertIsInstance(processor.image_processor						,	_UpperCAmelCase)


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: List[str]      =       self.get_image_processor()
          __A						: str      =       self.get_tokenizer()

          __A						: int      =       BlipProcessor(tokenizer=_UpperCAmelCase						,	image_processor=_UpperCAmelCase)

          __A						: List[str]      =       self.prepare_image_inputs()

          __A						: str      =       image_processor(_UpperCAmelCase						,	return_tensors='np')
          __A						: str      =       processor(images=_UpperCAmelCase						,	return_tensors='np')

          for key in input_feat_extract.keys():
               self.assertAlmostEqual(input_feat_extract[key].sum()						,	input_processor[key].sum()						,	delta=1e-2)


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: Any      =       self.get_image_processor()
          __A						: Tuple      =       self.get_tokenizer()

          __A						: Union[str, Any]      =       BlipProcessor(tokenizer=_UpperCAmelCase						,	image_processor=_UpperCAmelCase)

          __A						: str      =       'lower newer'

          __A						: Dict      =       processor(text=_UpperCAmelCase)

          __A						: Tuple      =       tokenizer(_UpperCAmelCase						,	return_token_type_ids=_UpperCAmelCase)

          for key in encoded_tok.keys():
               self.assertListEqual(encoded_tok[key]						,	encoded_processor[key])


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: List[Any]      =       self.get_image_processor()
          __A						: Optional[Any]      =       self.get_tokenizer()

          __A						: Optional[Any]      =       BlipProcessor(tokenizer=_UpperCAmelCase						,	image_processor=_UpperCAmelCase)

          __A						: Dict      =       'lower newer'
          __A						: int      =       self.prepare_image_inputs()

          __A						: List[Any]      =       processor(text=_UpperCAmelCase						,	images=_UpperCAmelCase)

          self.assertListEqual(list(inputs.keys())						,	['pixel_values', 'input_ids', 'attention_mask'])

          # test if it raises when no input is passed
          with pytest.raises(_UpperCAmelCase):
               processor()


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: Union[str, Any]      =       self.get_image_processor()
          __A						: Optional[Any]      =       self.get_tokenizer()

          __A						: Union[str, Any]      =       BlipProcessor(tokenizer=_UpperCAmelCase						,	image_processor=_UpperCAmelCase)

          __A						: Tuple      =       [[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]

          __A						: List[str]      =       processor.batch_decode(_UpperCAmelCase)
          __A						: List[str]      =       tokenizer.batch_decode(_UpperCAmelCase)

          self.assertListEqual(_UpperCAmelCase						,	_UpperCAmelCase)


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						: Any      =       self.get_image_processor()
          __A						: Union[str, Any]      =       self.get_tokenizer()

          __A						: Optional[Any]      =       BlipProcessor(tokenizer=_UpperCAmelCase						,	image_processor=_UpperCAmelCase)

          __A						: str      =       'lower newer'
          __A						: str      =       self.prepare_image_inputs()

          __A						: Optional[int]      =       processor(text=_UpperCAmelCase						,	images=_UpperCAmelCase)

          # For now the processor supports only ['pixel_values', 'input_ids', 'attention_mask']
          self.assertListEqual(list(inputs.keys())						,	['pixel_values', 'input_ids', 'attention_mask'])