




'''simple docstring'''







import json
import os
import re
import warnings
from pathlib import Path
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple, Union

import sentencepiece

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


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

_lowerCamelCase							:						Any								=  {
    'source_spm': 'source.spm',
    'target_spm': 'target.spm',
    'vocab': 'vocab.json',
    'target_vocab_file': 'target_vocab.json',
    'tokenizer_config_file': 'tokenizer_config.json',
}

_lowerCamelCase							:						Any								=  {
    'source_spm': {
        'Helsinki-NLP/opus-mt-en-de': 'https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/source.spm'
    },
    'target_spm': {
        'Helsinki-NLP/opus-mt-en-de': 'https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/target.spm'
    },
    'vocab': {
        'Helsinki-NLP/opus-mt-en-de': 'https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/vocab.json'
    },
    'tokenizer_config_file': {
        'Helsinki-NLP/opus-mt-en-de': (
            'https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/tokenizer_config.json'
        )
    },
}

_lowerCamelCase							:						List[Any]								=  {'Helsinki-NLP/opus-mt-en-de': 512}
_lowerCamelCase							:						Any								=  {}





class      lowerCamelCase_							(       UpperCAmelCase_							):




					'''simple docstring'''






					lowercase__    = VOCAB_FILES_NAMES
					lowercase__    = PRETRAINED_VOCAB_FILES_MAP
					lowercase__    = PRETRAINED_INIT_CONFIGURATION
					lowercase__    = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					lowercase__    = ["""input_ids""", """attention_mask"""]
					lowercase__    = re.compile(""">>.+<<"""							)  # type: re.Pattern






					def __init__(    self,  __UpperCamelCase,  __UpperCamelCase,  __UpperCamelCase,  __UpperCamelCase=None,  __UpperCamelCase=None,  __UpperCamelCase=None,  __UpperCamelCase="<unk>",  __UpperCamelCase="</s>",  __UpperCamelCase="<pad>",  __UpperCamelCase=512,  __UpperCamelCase = None,  __UpperCamelCase=False,  **__UpperCamelCase,  ):
							_snake_case	       =       {} if sp_model_kwargs is None else sp_model_kwargs

							super().__init__(
							    # bos_token=bos_token,  unused. Start decoding with config.decoder_start_token_id
							    source_lang=__UpperCamelCase,  target_lang=__UpperCamelCase,  unk_token=__UpperCamelCase,  eos_token=__UpperCamelCase,  pad_token=__UpperCamelCase,  model_max_length=__UpperCamelCase,  sp_model_kwargs=self.sp_model_kwargs,  target_vocab_file=__UpperCamelCase,  separate_vocabs=__UpperCamelCase,  **__UpperCamelCase,  )
							assert Path(__UpperCamelCase ).exists(), f'''cannot find spm source {source_spm}'''

							_snake_case	       =       separate_vocabs
							_snake_case	       =       load_json(__UpperCamelCase )
							if self.unk_token not in self.encoder:
									raise KeyError("<unk> token must be in vocab" )
							assert self.pad_token in self.encoder

							if separate_vocabs:
									_snake_case	       =       load_json(__UpperCamelCase )
									_snake_case	       =       {v: k for k, v in self.target_encoder.items()}
									_snake_case	       =       []
							else:
									_snake_case	       =       {v: k for k, v in self.encoder.items()}
									_snake_case	       =       [k for k in self.encoder if k.startswith(">>" ) and k.endswith("<<" )]

							_snake_case	       =       source_lang
							_snake_case	       =       target_lang
							_snake_case	       =       [source_spm, target_spm]

							# load SentencePiece model for pre-processing
							_snake_case	       =       load_spm(__UpperCamelCase,  self.sp_model_kwargs )
							_snake_case	       =       load_spm(__UpperCamelCase,  self.sp_model_kwargs )
							_snake_case	       =       self.spm_source
							_snake_case	       =       self.encoder

							# Multilingual target side: default to using first supported language code.

							self._setup_normalizer()






					def 				__SCREAMING_SNAKE_CASE	(    self ):
							try:
									from sacremoses import MosesPunctNormalizer

									_snake_case	       =       MosesPunctNormalizer(self.source_lang ).normalize
							except (ImportError, FileNotFoundError):
									warnings.warn("Recommended: pip install sacremoses." )
									_snake_case	       =       lambda __UpperCamelCase : x






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							return self.punc_normalizer(__UpperCamelCase ) if x else ""






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							return self.current_encoder.get(__UpperCamelCase,  self.current_encoder[self.unk_token] )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							_snake_case	       =       self.language_code_re.match(__UpperCamelCase )
							_snake_case	       =       [match.group(0 )] if match else []
							return code, self.language_code_re.sub("",  __UpperCamelCase )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							_snake_case       ,    _snake_case	       =       self.remove_language_code(__UpperCamelCase )
							_snake_case	       =       self.current_spm.encode(__UpperCamelCase,  out_type=__UpperCamelCase )
							return code + pieces






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							return self.decoder.get(__UpperCamelCase,  self.unk_token )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase,  **__UpperCamelCase ):
							return super().batch_decode(__UpperCamelCase,  **__UpperCamelCase )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase,  **__UpperCamelCase ):
							return super().decode(__UpperCamelCase,  **__UpperCamelCase )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							_snake_case	       =       self.spm_source if self._decode_use_source_tokenizer else self.spm_target
							_snake_case	       =       []
							_snake_case	       =       ""
							for token in tokens:
									# make sure that special tokens are not decoded using sentencepiece model
									if token in self.all_special_tokens:
											out_string += sp_model.decode_pieces(__UpperCamelCase ) + token + " "
											_snake_case	       =       []
									else:
											current_sub_tokens.append(__UpperCamelCase )
							out_string += sp_model.decode_pieces(__UpperCamelCase )
							return out_string.strip()






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase,  __UpperCamelCase=None ):
							if token_ids_a is None:
									return token_ids_a + [self.eos_token_id]
							# We don't expect to process pairs, but leave the pair logic for API consistency
							return token_ids_a + token_ids_a + [self.eos_token_id]






					def 				__SCREAMING_SNAKE_CASE	(    self ):
							_snake_case	       =       self.spm_source
							_snake_case	       =       self.encoder






					def 				__SCREAMING_SNAKE_CASE	(    self ):
							_snake_case	       =       self.spm_target
							if self.separate_vocabs:
									_snake_case	       =       self.target_encoder






					@property
					def 				__SCREAMING_SNAKE_CASE	(    self ):
							return len(self.encoder )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase,  __UpperCamelCase = None ):
							if not os.path.isdir(__UpperCamelCase ):
									logger.error(f'''Vocabulary path ({save_directory}) should be a directory''' )
									return
							_snake_case	       =       []

							if self.separate_vocabs:
									_snake_case	       =       os.path.join(
									    __UpperCamelCase,  (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab"],  )
									_snake_case	       =       os.path.join(
									    __UpperCamelCase,  (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["target_vocab_file"],  )
									save_json(self.encoder,  __UpperCamelCase )
									save_json(self.target_encoder,  __UpperCamelCase )
									saved_files.append(__UpperCamelCase )
									saved_files.append(__UpperCamelCase )
							else:
									_snake_case	       =       os.path.join(
									    __UpperCamelCase,  (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab"] )
									save_json(self.encoder,  __UpperCamelCase )
									saved_files.append(__UpperCamelCase )

							for spm_save_filename, spm_orig_path, spm_model in zip(
							    [VOCAB_FILES_NAMES["source_spm"], VOCAB_FILES_NAMES["target_spm"]],  self.spm_files,  [self.spm_source, self.spm_target],  ):
									_snake_case	       =       os.path.join(
									    __UpperCamelCase,  (filename_prefix + "-" if filename_prefix else "") + spm_save_filename )
									if os.path.abspath(__UpperCamelCase ) != os.path.abspath(__UpperCamelCase ) and os.path.isfile(__UpperCamelCase ):
											copyfile(__UpperCamelCase,  __UpperCamelCase )
											saved_files.append(__UpperCamelCase )
									elif not os.path.isfile(__UpperCamelCase ):
											with open(__UpperCamelCase,  "wb" ) as fi:
													_snake_case	       =       spm_model.serialized_model_proto()
													fi.write(__UpperCamelCase )
											saved_files.append(__UpperCamelCase )

							return tuple(__UpperCamelCase )






					def 				__SCREAMING_SNAKE_CASE	(    self ):
							return self.get_src_vocab()






					def 				__SCREAMING_SNAKE_CASE	(    self ):
							return dict(self.encoder,  **self.added_tokens_encoder )






					def 				__SCREAMING_SNAKE_CASE	(    self ):
							return dict(self.target_encoder,  **self.added_tokens_decoder )






					def __getstate__(    self ):
							_snake_case	       =       self.__dict__.copy()
							state.update(
							    {k: None for k in ["spm_source", "spm_target", "current_spm", "punc_normalizer", "target_vocab_file"]} )
							return state






					def __setstate__(    self,  __UpperCamelCase ):
							_snake_case	       =       d

							# for backward compatibility
							if not hasattr(self,  "sp_model_kwargs" ):
									_snake_case	       =       {}

							_snake_case       ,    _snake_case	       =       (load_spm(__UpperCamelCase,  self.sp_model_kwargs ) for f in self.spm_files)
							_snake_case	       =       self.spm_source
							self._setup_normalizer()






					def 				__SCREAMING_SNAKE_CASE	(    self,  *__UpperCamelCase,  **__UpperCamelCase ):
							return 1






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							_snake_case	       =       set(self.all_special_ids )  # call it once instead of inside list comp
							all_special_ids.remove(self.unk_token_id )  # <unk> is only sometimes special
							return [1 if x in all_special_ids else 0 for x in seq]






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase,  __UpperCamelCase = None,  __UpperCamelCase = False ):
							if already_has_special_tokens:
									return self._special_token_mask(__UpperCamelCase )
							elif token_ids_a is None:
									return self._special_token_mask(__UpperCamelCase ) + [1]
							else:
									return self._special_token_mask(token_ids_a + token_ids_a ) + [1]






def 		_lowercase		(	lowercase_						,							lowercase_  ):



		'''simple docstring'''







		_snake_case	       =       sentencepiece.SentencePieceProcessor(**lowercase_  )
		spm.Load(lowercase_  )
		return spm






def 		_lowercase		(	lowercase_						,							lowercase_  ):



		'''simple docstring'''







		with open(lowercase_						,							"w"  ) as f:
				json.dump(lowercase_						,							lowercase_						,							indent=2  )






def 		_lowercase		(	lowercase_  ):



		'''simple docstring'''







		with open(lowercase_						,							"r"  ) as f:
				return json.load(lowercase_  )













"""simple docstring"""


import inspect
import unittest

from transformers import SwinaSRConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
   import torch
   from torch import nn

   from transformers import SwinaSRForImageSuperResolution, SwinaSRModel
   from transformers.models.swinasr.modeling_swinasr import SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST

if is_vision_available():
   from PIL import Image

   from transformers import SwinaSRImageProcessor






class 						snake_case  :





    def __init__(							self	:					Tuple				,		A	:					Any				,		A	:					List[Any]=1_3				,		A	:					Union[str, Any]=3_2				,		A	:					Optional[Any]=1				,		A	:					Union[str, Any]=3				,		A	:					List[str]=1_6				,		A	:					Optional[Any]=[1, 2, 1]				,		A	:					Any=[2, 2, 4]				,		A	:					int=2				,		A	:					List[str]=2.0				,		A	:					Dict=True				,		A	:					Union[str, Any]=0.0				,		A	:					Union[str, Any]=0.0				,		A	:					Optional[int]=0.1				,		A	:					Optional[int]="gelu"				,		A	:					Any=False				,		A	:					Dict=True				,		A	:					int=0.02				,		A	:					Tuple=1E-5				,		A	:					List[str]=True				,		A	:					List[str]=None				,		A	:					str=False				,		A	:					Any=2				,		):


      '''simple docstring'''




      a     :			Tuple				=   parent
      a     :			Union[str, Any]				=   batch_size
      a     :			Tuple				=   image_size
      a     :			List[str]				=   patch_size
      a     :			Union[str, Any]				=   num_channels
      a     :			str				=   embed_dim
      a     :			int				=   depths
      a     :			Tuple				=   num_heads
      a     :			Any				=   window_size
      a     :			List[Any]				=   mlp_ratio
      a     :			str				=   qkv_bias
      a     :			Any				=   hidden_dropout_prob
      a     :			List[Any]				=   attention_probs_dropout_prob
      a     :			int				=   drop_path_rate
      a     :			List[Any]				=   hidden_act
      a     :			Union[str, Any]				=   use_absolute_embeddings
      a     :			Dict				=   patch_norm
      a     :			Optional[Any]				=   layer_norm_eps
      a     :			Dict				=   initializer_range
      a     :			Optional[Any]				=   is_training
      a     :			str				=   scope
      a     :			List[Any]				=   use_labels
      a     :			Union[str, Any]				=   upscale

      # here we set some attributes to make tests pass
      a     :			str				=   len(A			)
      a     :			List[Any]				=   embed_dim
      a     :			List[Any]				=   (image_size // patch_size) ** 2





    def 				lowerCamelCase__      (							self	:					str			):


      '''simple docstring'''




      a     :			List[Any]				=   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]			)

      a     :			List[str]				=   None
      if self.use_labels:
        a     :			Tuple				=   ids_tensor([self.batch_size]				,		self.type_sequence_label_size			)

      a     :			Any				=   self.get_config()

      return config, pixel_values, labels





    def 				lowerCamelCase__      (							self	:					str			):


      '''simple docstring'''




      return SwinaSRConfig(
          image_size=self.image_size				,		patch_size=self.patch_size				,		num_channels=self.num_channels				,		embed_dim=self.embed_dim				,		depths=self.depths				,		num_heads=self.num_heads				,		window_size=self.window_size				,		mlp_ratio=self.mlp_ratio				,		qkv_bias=self.qkv_bias				,		hidden_dropout_prob=self.hidden_dropout_prob				,		attention_probs_dropout_prob=self.attention_probs_dropout_prob				,		drop_path_rate=self.drop_path_rate				,		hidden_act=self.hidden_act				,		use_absolute_embeddings=self.use_absolute_embeddings				,		path_norm=self.patch_norm				,		layer_norm_eps=self.layer_norm_eps				,		initializer_range=self.initializer_range				,		upscale=self.upscale				,		)





    def 				lowerCamelCase__      (							self	:					Union[str, Any]				,		A	:					Dict				,		A	:					Union[str, Any]				,		A	:					List[str]			):


      '''simple docstring'''




      a     :			List[Any]				=   SwinaSRModel(config=A			)
      model.to(A			)
      model.eval()
      a     :			Optional[int]				=   model(A			)

      self.parent.assertEqual(
          result.last_hidden_state.shape				,		(self.batch_size, self.embed_dim, self.image_size, self.image_size)			)





    def 				lowerCamelCase__      (							self	:					List[str]				,		A	:					Tuple				,		A	:					str				,		A	:					Tuple			):


      '''simple docstring'''




      a     :			Optional[Any]				=   SwinaSRForImageSuperResolution(A			)
      model.to(A			)
      model.eval()
      a     :			List[str]				=   model(A			)

      a     :			Any				=   self.image_size * self.upscale
      self.parent.assertEqual(
          result.reconstruction.shape				,		(self.batch_size, self.num_channels, expected_image_size, expected_image_size)			)





    def 				lowerCamelCase__      (							self	:					Union[str, Any]			):


      '''simple docstring'''




      a     :			Tuple				=   self.prepare_config_and_inputs()
      a,     a,     a     :			Union[str, Any]				=   config_and_inputs
      a     :			List[str]				=   {'pixel_values': pixel_values}
      return config, inputs_dict






@require_torch
class 						snake_case  (  UpperCAmelCase   , UpperCAmelCase   , unittest.TestCase       ):
    __magic_name__         =     (SwinaSRModel, SwinaSRForImageSuperResolution) if is_torch_available() else ()
    __magic_name__         =     {'''feature-extraction''': SwinaSRModel} if is_torch_available() else {}

    __magic_name__         =     False
    __magic_name__         =     False
    __magic_name__         =     False
    __magic_name__         =     False
    __magic_name__         =     False





    def 				lowerCamelCase__      (							self	:					Optional[int]			):


      '''simple docstring'''




      a     :			List[str]				=   SwinaSRModelTester(self			)
      a     :			int				=   ConfigTester(self				,		config_class=A				,		embed_dim=3_7			)





    def 				lowerCamelCase__      (							self	:					Optional[int]			):


      '''simple docstring'''




      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	:					List[Any]			):


      '''simple docstring'''




      a     :			str				=   self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_model(*A			)





    def 				lowerCamelCase__      (							self	:					Tuple			):


      '''simple docstring'''




      a     :			Any				=   self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_image_super_resolution(*A			)





    @unittest.skip(reason='Got `CUDA error: misaligned address` with PyTorch 2.0.0.'			)
    def 				lowerCamelCase__      (							self	:					str			):


      '''simple docstring'''




      pass





    @unittest.skip(reason='Swin2SR does not use inputs_embeds'			)
    def 				lowerCamelCase__      (							self	:					Tuple			):


      '''simple docstring'''




      pass





    @unittest.skip(reason='Swin2SR does not support training yet'			)
    def 				lowerCamelCase__      (							self	:					Optional[int]			):


      '''simple docstring'''




      pass





    @unittest.skip(reason='Swin2SR does not support training yet'			)
    def 				lowerCamelCase__      (							self	:					int			):


      '''simple docstring'''




      pass





    def 				lowerCamelCase__      (							self	:					int			):


      '''simple docstring'''




      a,     a     :			Optional[int]				=   self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
        a     :			Union[str, Any]				=   model_class(A			)
        self.assertIsInstance(model.get_input_embeddings()				,		(nn.Module)			)
        a     :			Optional[int]				=   model.get_output_embeddings()
        self.assertTrue(x is None or isinstance(A				,		nn.Linear			)			)





    def 				lowerCamelCase__      (							self	:					Optional[int]			):


      '''simple docstring'''




      a,     a     :			int				=   self.model_tester.prepare_config_and_inputs_for_common()

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

        a     :			Tuple				=   ['pixel_values']
        self.assertListEqual(arg_names[:1]				,		A			)





    @slow
    def 				lowerCamelCase__      (							self	:					List[str]			):


      '''simple docstring'''




      for model_name in SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        a     :			Optional[int]				=   SwinaSRModel.from_pretrained(A			)
        self.assertIsNotNone(A			)





    def 				lowerCamelCase__      (							self	:					Dict			):


      '''simple docstring'''




      a,     a     :			str				=   self.model_tester.prepare_config_and_inputs_for_common()

      a     :			int				=   _config_zero_init(A			)
      for model_class in self.all_model_classes:
        a     :			List[str]				=   model_class(config=A			)
        for name, param in model.named_parameters():
          if "logit_scale" in name:
            continue
          if param.requires_grad:
            self.assertIn(
                ((param.data.mean() * 1E9).round() / 1E9).item()				,		[0.0, 1.0]				,		msg=F'''Parameter {name} of model {model_class} seems not properly initialized'''				,		)





    def 				lowerCamelCase__      (							self	:					List[str]			):


      '''simple docstring'''




      a,     a     :			Union[str, Any]				=   self.model_tester.prepare_config_and_inputs_for_common()
      a     :			List[str]				=   True

      for model_class in self.all_model_classes:
        a     :			Dict				=   True
        a     :			int				=   False
        a     :			str				=   True
        a     :			Optional[int]				=   model_class(A			)
        model.to(A			)
        model.eval()
        with torch.no_grad():
          a     :			Tuple				=   model(**self._prepare_for_class(A				,		A			)			)
        a     :			Optional[Any]				=   outputs.attentions
        a     :			int				=   len(self.model_tester.depths			)
        self.assertEqual(len(A			)				,		A			)

        # check that output_attentions also work using config
        del inputs_dict["output_attentions"]
        a     :			List[str]				=   True
        a     :			List[Any]				=   config.window_size**2
        a     :			List[str]				=   model_class(A			)
        model.to(A			)
        model.eval()
        with torch.no_grad():
          a     :			str				=   model(**self._prepare_for_class(A				,		A			)			)
        a     :			int				=   outputs.attentions
        self.assertEqual(len(A			)				,		A			)

        self.assertListEqual(
            list(attentions[0].shape[-3:]			)				,		[self.model_tester.num_heads[0], window_size_squared, window_size_squared]				,		)
        a     :			int				=   len(A			)

        # Check attention is always last and order is fine
        a     :			List[str]				=   True
        a     :			List[Any]				=   True
        a     :			str				=   model_class(A			)
        model.to(A			)
        model.eval()
        with torch.no_grad():
          a     :			List[Any]				=   model(**self._prepare_for_class(A				,		A			)			)

        self.assertEqual(out_len + 1				,		len(A			)			)

        a     :			Tuple				=   outputs.attentions

        self.assertEqual(len(A			)				,		A			)

        self.assertListEqual(
            list(self_attentions[0].shape[-3:]			)				,		[self.model_tester.num_heads[0], window_size_squared, window_size_squared]				,		)






@require_vision
@require_torch
@slow
class 						snake_case  (  unittest.TestCase       ):





    def 				lowerCamelCase__      (							self	:					Optional[int]			):


      '''simple docstring'''




      a     :			Optional[int]				=   SwinaSRImageProcessor()
      a     :			Optional[int]				=   SwinaSRForImageSuperResolution.from_pretrained('caidas/swin2SR-classical-sr-x2-64'			).to(A			)

      a     :			str				=   Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'			)
      a     :			Union[str, Any]				=   processor(images=A				,		return_tensors='pt'			).to(A			)

      # forward pass
      with torch.no_grad():
        a     :			Tuple				=   model(**A			)

      # verify the logits
      a     :			Optional[int]				=   torch.Size([1, 3, 9_7_6, 1_2_9_6]			)
      self.assertEqual(outputs.reconstruction.shape				,		A			)
      a     :			Tuple				=   torch.tensor(
          [[0.54_58, 0.55_46, 0.56_38], [0.55_26, 0.55_65, 0.56_51], [0.53_96, 0.54_26, 0.56_21]]			).to(A			)
      self.assertTrue(torch.allclose(outputs.reconstruction[0, 0, :3, :3]				,		A				,		atol=1E-4			)			)




