



import os
from shutil import copyfile
from typing import List, Optional, Tuple

from tokenizers import processors

from ...tokenization_utils import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
	from .tokenization_nllb import NllbTokenizer
else:
	a	:   List[Any]       			=       None


a	:   Tuple       			=       logging.get_logger(__name__)


a	:   Tuple       			=       {'vocab_file': 'sentencepiece.bpe.model', 'tokenizer_file': 'tokenizer.json'}

a	:   Dict       			=       {
    'vocab_file': {
        'facebook/nllb-200-distilled-600M': (
            'https://huggingface.co/facebook/nllb-200-distilled-600M/resolve/main/sentencepiece.bpe.model'
        ),
    },
    'tokenizer_file': {
        'facebook/nllb-200-distilled-600M': (
            'https://huggingface.co/facebook/nllb-200-distilled-600M/resolve/main/tokenizer.json'
        ),
    },
}

a	:   Union[str, Any]       			=       {
    'facebook/nllb-large-en-ro': 1_024,
    'facebook/nllb-200-distilled-600M': 1_024,
}

# fmt: off
a	:   Optional[int]       			=       ['ace_Arab', 'ace_Latn', 'acm_Arab', 'acq_Arab', 'aeb_Arab', 'afr_Latn', 'ajp_Arab', 'aka_Latn', 'amh_Ethi', 'apc_Arab', 'arb_Arab', 'ars_Arab', 'ary_Arab', 'arz_Arab', 'asm_Beng', 'ast_Latn', 'awa_Deva', 'ayr_Latn', 'azb_Arab', 'azj_Latn', 'bak_Cyrl', 'bam_Latn', 'ban_Latn', 'bel_Cyrl', 'bem_Latn', 'ben_Beng', 'bho_Deva', 'bjn_Arab', 'bjn_Latn', 'bod_Tibt', 'bos_Latn', 'bug_Latn', 'bul_Cyrl', 'cat_Latn', 'ceb_Latn', 'ces_Latn', 'cjk_Latn', 'ckb_Arab', 'crh_Latn', 'cym_Latn', 'dan_Latn', 'deu_Latn', 'dik_Latn', 'dyu_Latn', 'dzo_Tibt', 'ell_Grek', 'eng_Latn', 'epo_Latn', 'est_Latn', 'eus_Latn', 'ewe_Latn', 'fao_Latn', 'pes_Arab', 'fij_Latn', 'fin_Latn', 'fon_Latn', 'fra_Latn', 'fur_Latn', 'fuv_Latn', 'gla_Latn', 'gle_Latn', 'glg_Latn', 'grn_Latn', 'guj_Gujr', 'hat_Latn', 'hau_Latn', 'heb_Hebr', 'hin_Deva', 'hne_Deva', 'hrv_Latn', 'hun_Latn', 'hye_Armn', 'ibo_Latn', 'ilo_Latn', 'ind_Latn', 'isl_Latn', 'ita_Latn', 'jav_Latn', 'jpn_Jpan', 'kab_Latn', 'kac_Latn', 'kam_Latn', 'kan_Knda', 'kas_Arab', 'kas_Deva', 'kat_Geor', 'knc_Arab', 'knc_Latn', 'kaz_Cyrl', 'kbp_Latn', 'kea_Latn', 'khm_Khmr', 'kik_Latn', 'kin_Latn', 'kir_Cyrl', 'kmb_Latn', 'kon_Latn', 'kor_Hang', 'kmr_Latn', 'lao_Laoo', 'lvs_Latn', 'lij_Latn', 'lim_Latn', 'lin_Latn', 'lit_Latn', 'lmo_Latn', 'ltg_Latn', 'ltz_Latn', 'lua_Latn', 'lug_Latn', 'luo_Latn', 'lus_Latn', 'mag_Deva', 'mai_Deva', 'mal_Mlym', 'mar_Deva', 'min_Latn', 'mkd_Cyrl', 'plt_Latn', 'mlt_Latn', 'mni_Beng', 'khk_Cyrl', 'mos_Latn', 'mri_Latn', 'zsm_Latn', 'mya_Mymr', 'nld_Latn', 'nno_Latn', 'nob_Latn', 'npi_Deva', 'nso_Latn', 'nus_Latn', 'nya_Latn', 'oci_Latn', 'gaz_Latn', 'ory_Orya', 'pag_Latn', 'pan_Guru', 'pap_Latn', 'pol_Latn', 'por_Latn', 'prs_Arab', 'pbt_Arab', 'quy_Latn', 'ron_Latn', 'run_Latn', 'rus_Cyrl', 'sag_Latn', 'san_Deva', 'sat_Beng', 'scn_Latn', 'shn_Mymr', 'sin_Sinh', 'slk_Latn', 'slv_Latn', 'smo_Latn', 'sna_Latn', 'snd_Arab', 'som_Latn', 'sot_Latn', 'spa_Latn', 'als_Latn', 'srd_Latn', 'srp_Cyrl', 'ssw_Latn', 'sun_Latn', 'swe_Latn', 'swh_Latn', 'szl_Latn', 'tam_Taml', 'tat_Cyrl', 'tel_Telu', 'tgk_Cyrl', 'tgl_Latn', 'tha_Thai', 'tir_Ethi', 'taq_Latn', 'taq_Tfng', 'tpi_Latn', 'tsn_Latn', 'tso_Latn', 'tuk_Latn', 'tum_Latn', 'tur_Latn', 'twi_Latn', 'tzm_Tfng', 'uig_Arab', 'ukr_Cyrl', 'umb_Latn', 'urd_Arab', 'uzn_Latn', 'vec_Latn', 'vie_Latn', 'war_Latn', 'wol_Latn', 'xho_Latn', 'ydd_Hebr', 'yor_Latn', 'yue_Hant', 'zho_Hans', 'zho_Hant', 'zul_Latn']







class 							_a							(					_a ):
			A							=     VOCAB_FILES_NAMES
			A							=     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			A							=     PRETRAINED_VOCAB_FILES_MAP
			A							=     ['''input_ids''', '''attention_mask''']
			A							=     NllbTokenizer

			A							=     []
			A							=     []

			def __init__(self,					SCREAMING_SNAKE_CASE_=None,					SCREAMING_SNAKE_CASE_=None,					SCREAMING_SNAKE_CASE_="<s>",					SCREAMING_SNAKE_CASE_="</s>",					SCREAMING_SNAKE_CASE_="</s>",					SCREAMING_SNAKE_CASE_="<s>",					SCREAMING_SNAKE_CASE_="<unk>",					SCREAMING_SNAKE_CASE_="<pad>",					SCREAMING_SNAKE_CASE_="<mask>",					SCREAMING_SNAKE_CASE_=None,					SCREAMING_SNAKE_CASE_=None,					SCREAMING_SNAKE_CASE_=None,					SCREAMING_SNAKE_CASE_=False,					**SCREAMING_SNAKE_CASE_,					)    ->					Optional[Any]:
						# Mask token behave like a normal word, i.e. include the space before it
						UpperCAmelCase_:						Any					=			AddedToken(snake_case_,					lstrip=snake_case_,					rstrip=snake_case_ ) if isinstance(snake_case_,					snake_case_ ) else mask_token
						UpperCAmelCase_:						Union[str, Any]					=			legacy_behaviour
						super().__init__(
						    vocab_file=snake_case_,					tokenizer_file=snake_case_,					bos_token=snake_case_,					eos_token=snake_case_,					sep_token=snake_case_,					cls_token=snake_case_,					unk_token=snake_case_,					pad_token=snake_case_,					mask_token=snake_case_,					src_lang=snake_case_,					tgt_lang=snake_case_,					additional_special_tokens=snake_case_,					legacy_behaviour=snake_case_,					**snake_case_,					)

						UpperCAmelCase_:						Union[str, Any]					=			vocab_file
						UpperCAmelCase_:						Optional[int]					=			False if not self.vocab_file else True

						UpperCAmelCase_:						Tuple					=			FAIRSEQ_LANGUAGE_CODES.copy()

						if additional_special_tokens is not None:
									# Only add those special tokens if they are not already there.
									_additional_special_tokens.extend(
									    [t for t in additional_special_tokens if t not in _additional_special_tokens] )

						self.add_special_tokens({"""additional_special_tokens""": _additional_special_tokens} )
						UpperCAmelCase_:						Optional[Any]					=			{
						    lang_code: self.convert_tokens_to_ids(snake_case_ ) for lang_code in FAIRSEQ_LANGUAGE_CODES
						}

						UpperCAmelCase_:						Tuple					=			src_lang if src_lang is not None else """eng_Latn"""
						UpperCAmelCase_:						Any					=			self.convert_tokens_to_ids(self._src_lang )
						UpperCAmelCase_:						Optional[Any]					=			tgt_lang
						self.set_src_lang_special_tokens(self._src_lang )

			@property
			def 			__snake_case    (self )    ->					Tuple:
						return self._src_lang

			@src_lang.setter
			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_ )    ->					Any:
						UpperCAmelCase_:						int					=			new_src_lang
						self.set_src_lang_special_tokens(self._src_lang )

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_ = None )    ->					Any:
						if token_ids_a is None:
									return self.prefix_tokens + token_ids_a + self.suffix_tokens
						# We don't expect to process pairs, but leave the pair logic for API consistency
						return self.prefix_tokens + token_ids_a + token_ids_a + self.suffix_tokens

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_ = None )    ->					Optional[int]:
						UpperCAmelCase_:						Tuple					=			[self.sep_token_id]
						UpperCAmelCase_:						Optional[Any]					=			[self.cls_token_id]

						if token_ids_a is None:
									return len(cls + token_ids_a + sep ) * [0]
						return len(cls + token_ids_a + sep + sep + token_ids_a + sep ) * [0]

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_,					**SCREAMING_SNAKE_CASE_ )    ->					Any:
						if src_lang is None or tgt_lang is None:
									raise ValueError("""Translation requires a `src_lang` and a `tgt_lang` for this model""" )
						UpperCAmelCase_:						Dict					=			src_lang
						UpperCAmelCase_:						int					=			self(snake_case_,					add_special_tokens=snake_case_,					return_tensors=snake_case_,					**snake_case_ )
						UpperCAmelCase_:						int					=			self.convert_tokens_to_ids(snake_case_ )
						UpperCAmelCase_:						Dict					=			tgt_lang_id
						return inputs

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_ = "eng_Latn",					SCREAMING_SNAKE_CASE_ = None,					SCREAMING_SNAKE_CASE_ = "fra_Latn",					**SCREAMING_SNAKE_CASE_,					)    ->					Optional[int]:
						UpperCAmelCase_:						Dict					=			src_lang
						UpperCAmelCase_:						Dict					=			tgt_lang
						return super().prepare_seqaseq_batch(snake_case_,					snake_case_,					**snake_case_ )

			def 			__snake_case    (self )    ->					List[Any]:
						return self.set_src_lang_special_tokens(self.src_lang )

			def 			__snake_case    (self )    ->					Union[str, Any]:
						return self.set_tgt_lang_special_tokens(self.tgt_lang )

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_ )    ->					int:
						UpperCAmelCase_:						List[Any]					=			self.convert_tokens_to_ids(snake_case_ )

						if self.legacy_behaviour:
									UpperCAmelCase_:						Any					=			[]
									UpperCAmelCase_:						Optional[int]					=			[self.eos_token_id, self.cur_lang_code]
						else:
									UpperCAmelCase_:						Optional[int]					=			[self.cur_lang_code]
									UpperCAmelCase_:						Optional[Any]					=			[self.eos_token_id]

						UpperCAmelCase_:						Dict					=			self.convert_ids_to_tokens(self.prefix_tokens )
						UpperCAmelCase_:						Union[str, Any]					=			self.convert_ids_to_tokens(self.suffix_tokens )

						UpperCAmelCase_:						Dict					=			processors.TemplateProcessing(
						    single=prefix_tokens_str + ["""$A"""] + suffix_tokens_str,					pair=prefix_tokens_str + ["""$A""", """$B"""] + suffix_tokens_str,					special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str,					self.prefix_tokens + self.suffix_tokens ) ),					)

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_ )    ->					Tuple:
						UpperCAmelCase_:						str					=			self.convert_tokens_to_ids(snake_case_ )
						if self.legacy_behaviour:
									UpperCAmelCase_:						Union[str, Any]					=			[]
									UpperCAmelCase_:						int					=			[self.eos_token_id, self.cur_lang_code]
						else:
									UpperCAmelCase_:						Dict					=			[self.cur_lang_code]
									UpperCAmelCase_:						Union[str, Any]					=			[self.eos_token_id]

						UpperCAmelCase_:						Any					=			self.convert_ids_to_tokens(self.prefix_tokens )
						UpperCAmelCase_:						Tuple					=			self.convert_ids_to_tokens(self.suffix_tokens )

						UpperCAmelCase_:						Optional[int]					=			processors.TemplateProcessing(
						    single=prefix_tokens_str + ["""$A"""] + suffix_tokens_str,					pair=prefix_tokens_str + ["""$A""", """$B"""] + suffix_tokens_str,					special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str,					self.prefix_tokens + self.suffix_tokens ) ),					)

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_ = None )    ->					Any:
						if not self.can_save_slow_tokenizer:
									raise ValueError(
									    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
									    """tokenizer.""" )

						if not os.path.isdir(snake_case_ ):
									logger.error(f'Vocabulary path ({save_directory}) should be a directory.' )
									return
						UpperCAmelCase_:						List[Any]					=			os.path.join(
						    snake_case_,					(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""] )

						if os.path.abspath(self.vocab_file ) != os.path.abspath(snake_case_ ):
									copyfile(self.vocab_file,					snake_case_ )

						return (out_vocab_file,)











'''simple docstring'''





from __future__ import annotations

import inspect
import unittest

import numpy as np

from transformers import ResNetConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
       import tensorflow as tf

       from transformers import TFResNetForImageClassification, TFResNetModel
       from transformers.models.resnet.modeling_tf_resnet import TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
       from PIL import Image

       from transformers import AutoImageProcessor







class     UpperCAmelCase_       :
    """simple docstring"""







    def __init__(    self					:     int ,     snake_case_					:     Tuple ,     snake_case_					:     List[str]=3 ,     snake_case_					:     Tuple=32 ,     snake_case_					:     List[Any]=3 ,     snake_case_					:     List[str]=10 ,     snake_case_					:     List[str]=[10, 20, 30, 40] ,     snake_case_					:     Tuple=[1, 1, 2, 1] ,     snake_case_					:     Tuple=True ,     snake_case_					:     str=True ,     snake_case_					:     int="relu" ,     snake_case_					:     List[Any]=3 ,     snake_case_					:     str=None ,     ):
          snake_case__  :    List[Any]    						=      parent
          snake_case__  :    List[Any]    						=      batch_size
          snake_case__  :    int    						=      image_size
          snake_case__  :    List[Any]    						=      num_channels
          snake_case__  :    Optional[Any]    						=      embeddings_size
          snake_case__  :    Optional[int]    						=      hidden_sizes
          snake_case__  :    Tuple    						=      depths
          snake_case__  :    Any    						=      is_training
          snake_case__  :    Optional[int]    						=      use_labels
          snake_case__  :    Optional[int]    						=      hidden_act
          snake_case__  :    Optional[int]    						=      num_labels
          snake_case__  :    int    						=      scope
          snake_case__  :    Tuple    						=      len(snake_case_						)




    def lowerCamelCase       (    self					:     Any						):
          snake_case__  :    Union[str, Any]    						=      floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

          snake_case__  :    Union[str, Any]    						=      None
          if self.use_labels:
                snake_case__  :    Optional[Any]    						=      ids_tensor([self.batch_size] ,     self.num_labels						)

          snake_case__  :    List[str]    						=      self.get_config()

          return config, pixel_values, labels




    def lowerCamelCase       (    self					:     int						):
          return ResNetConfig(
              num_channels=self.num_channels ,     embeddings_size=self.embeddings_size ,     hidden_sizes=self.hidden_sizes ,     depths=self.depths ,     hidden_act=self.hidden_act ,     num_labels=self.num_labels ,     image_size=self.image_size ,     )




    def lowerCamelCase       (    self					:     Tuple ,     snake_case_					:     Tuple ,     snake_case_					:     List[Any] ,     snake_case_					:     Optional[int]						):
          snake_case__  :    Optional[Any]    						=      TFResNetModel(config=snake_case_						)
          snake_case__  :    int    						=      model(snake_case_						)
          # expected last hidden states: B, C, H // 32, W // 32
          self.parent.assertEqual(
              result.last_hidden_state.shape ,     (self.batch_size, self.hidden_sizes[-1], self.image_size // 32, self.image_size // 32) ,     )




    def lowerCamelCase       (    self					:     List[str] ,     snake_case_					:     List[str] ,     snake_case_					:     str ,     snake_case_					:     Union[str, Any]						):
          snake_case__  :    str    						=      self.num_labels
          snake_case__  :    Optional[int]    						=      TFResNetForImageClassification(snake_case_						)
          snake_case__  :    Tuple    						=      model(snake_case_ ,     labels=snake_case_						)
          self.parent.assertEqual(result.logits.shape ,     (self.batch_size, self.num_labels)						)




    def lowerCamelCase       (    self					:     Tuple						):
          snake_case__  :    List[Any]    						=      self.prepare_config_and_inputs()
          snake_case__						,				snake_case__						,				snake_case__  :    str    						=      config_and_inputs
          snake_case__  :    int    						=      {"""pixel_values""": pixel_values}
          return config, inputs_dict







@require_tf
class     UpperCAmelCase_       (       _a		,		_a		,		unittest.TestCase	):
    """simple docstring"""







    lowercase					=		(TFResNetModel, TFResNetForImageClassification) if is_tf_available() else ()
    lowercase					=		(
        {"feature-extraction": TFResNetModel, "image-classification": TFResNetForImageClassification}
        if is_tf_available()
        else {}
    )

    lowercase					=		False
    lowercase					=		False
    lowercase					=		False
    lowercase					=		False
    lowercase					=		False




    def lowerCamelCase       (    self					:     Optional[int]						):
          snake_case__  :    Tuple    						=      TFResNetModelTester(self						)
          snake_case__  :    List[str]    						=      ConfigTester(self ,     config_class=snake_case_ ,     has_text_modality=snake_case_						)




    def lowerCamelCase       (    self					:     Dict						):
          self.create_and_test_config_common_properties()
          self.config_tester.create_and_test_config_to_json_string()
          self.config_tester.create_and_test_config_to_json_file()
          self.config_tester.create_and_test_config_from_and_save_pretrained()
          self.config_tester.create_and_test_config_with_num_labels()
          self.config_tester.check_config_can_be_init_without_params()
          self.config_tester.check_config_arguments_init()




    def lowerCamelCase       (    self					:     str						):
          return




    @unittest.skip(reason="""ResNet does not use inputs_embeds"""						)
    def lowerCamelCase       (    self					:     int						):
          pass




    @unittest.skip(reason="""ResNet does not support input and output embeddings"""						)
    def lowerCamelCase       (    self					:     List[Any]						):
          pass




    def lowerCamelCase       (    self					:     List[Any]						):
          snake_case__						,				snake_case__  :    List[Any]    						=      self.model_tester.prepare_config_and_inputs_for_common()

          for model_class in self.all_model_classes:
                snake_case__  :    Dict    						=      model_class(snake_case_						)
                snake_case__  :    Optional[Any]    						=      inspect.signature(model.call						)
                # signature.parameters is an OrderedDict => so arg_names order is deterministic
                snake_case__  :    Union[str, Any]    						=      [*signature.parameters.keys()]

                snake_case__  :    Optional[int]    						=      ["""pixel_values"""]
                self.assertListEqual(arg_names[:1] ,     snake_case_						)




    def lowerCamelCase       (    self					:     Union[str, Any]						):
          snake_case__  :    Optional[int]    						=      self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_model(*snake_case_						)




    def lowerCamelCase       (    self					:     List[str]						):
          def check_hidden_states_output(snake_case_					:     Any ,     snake_case_					:     Any ,     snake_case_					:     List[str]						):
                snake_case__  :    List[Any]    						=      model_class(snake_case_						)
                snake_case__  :    Dict    						=      model(**self._prepare_for_class(snake_case_ ,     snake_case_						)						)

                snake_case__  :    str    						=      outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

                snake_case__  :    List[Any]    						=      self.model_tester.num_stages
                self.assertEqual(len(snake_case_						) ,     expected_num_stages + 1						)

                # ResNet's feature maps are of shape (batch_size, num_channels, height, width)
                self.assertListEqual(
                    list(hidden_states[0].shape[-2:]						) ,     [self.model_tester.image_size // 4, self.model_tester.image_size // 4] ,     )

          snake_case__						,				snake_case__  :    Any    						=      self.model_tester.prepare_config_and_inputs_for_common()
          snake_case__  :    List[Any]    						=      ["""basic""", """bottleneck"""]
          for model_class in self.all_model_classes:
                for layer_type in layers_type:
                      snake_case__  :    Dict    						=      layer_type
                      snake_case__  :    Optional[int]    						=      True
                      check_hidden_states_output(snake_case_ ,     snake_case_ ,     snake_case_						)

                      # check that output_hidden_states also work using config
                      del inputs_dict["output_hidden_states"]
                      snake_case__  :    List[Any]    						=      True

                      check_hidden_states_output(snake_case_ ,     snake_case_ ,     snake_case_						)




    def lowerCamelCase       (    self					:     Optional[Any]						):
          snake_case__  :    Tuple    						=      self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_image_classification(*snake_case_						)




    @slow
    def lowerCamelCase       (    self					:     Optional[Any]						):
          for model_name in TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                snake_case__  :    str    						=      TFResNetModel.from_pretrained(snake_case_						)
                self.assertIsNotNone(snake_case_						)





def 						__snake_case(				)		-> Optional[int]:
      snake_case__  :    Optional[Any]    						=      Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""		)
      return image







@require_tf
@require_vision
class     UpperCAmelCase_       (       unittest.TestCase	):
    """simple docstring"""







    @cached_property
    def lowerCamelCase       (    self					:     List[Any]						):
          return (
              AutoImageProcessor.from_pretrained(TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST[0]						)
              if is_vision_available()
              else None
          )




    @slow
    def lowerCamelCase       (    self					:     Optional[int]						):
          snake_case__  :    List[str]    						=      TFResNetForImageClassification.from_pretrained(TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST[0]						)

          snake_case__  :    List[Any]    						=      self.default_image_processor
          snake_case__  :    List[Any]    						=      prepare_img()
          snake_case__  :    List[str]    						=      image_processor(images=snake_case_ ,     return_tensors="""tf"""						)

          # forward pass
          snake_case__  :    Optional[Any]    						=      model(**snake_case_						)

          # verify the logits
          snake_case__  :    Union[str, Any]    						=      tf.TensorShape((1, 1_000)						)
          self.assertEqual(outputs.logits.shape ,     snake_case_						)

          snake_case__  :    List[str]    						=      tf.constant([-11.1069, -9.7877, -8.3777]						)

          self.assertTrue(np.allclose(outputs.logits[0, :3].numpy() ,     snake_case_ ,     atol=1E-4						)						)
