





"""simple docstring"""




import inspect
import math
import tempfile
import unittest

import numpy as np

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

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


if is_torch_available():
			import torch
			from torch import nn

			from transformers import ViTMAEForPreTraining, ViTMAEModel
			from transformers.models.vit.modeling_vit import VIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
			from PIL import Image

			from transformers import ViTImageProcessor

class       a_      :




					def __init__(	self						:     Union[str, Any]  ,						snake_case__						:     int  ,						snake_case__						:     Any=13  ,						snake_case__						:     Optional[int]=30  ,						snake_case__						:     Union[str, Any]=2  ,						snake_case__						:     str=3  ,						snake_case__						:     Tuple=True  ,						snake_case__						:     Dict=True  ,						snake_case__						:     int=32  ,						snake_case__						:     Optional[int]=5  ,						snake_case__						:     Optional[int]=4  ,						snake_case__						:     str=37  ,						snake_case__						:     Any="gelu"  ,						snake_case__						:     Union[str, Any]=0.1  ,						snake_case__						:     List[str]=0.1  ,						snake_case__						:     Optional[int]=10  ,						snake_case__						:     Tuple=0.02  ,						snake_case__						:     str=3  ,						snake_case__						:     Union[str, Any]=0.6  ,						snake_case__						:     Dict=None  ,						):
							lowerCAmelCase__        =   parent
							lowerCAmelCase__        =   batch_size
							lowerCAmelCase__        =   image_size
							lowerCAmelCase__        =   patch_size
							lowerCAmelCase__        =   num_channels
							lowerCAmelCase__        =   is_training
							lowerCAmelCase__        =   use_labels
							lowerCAmelCase__        =   hidden_size
							lowerCAmelCase__        =   num_hidden_layers
							lowerCAmelCase__        =   num_attention_heads
							lowerCAmelCase__        =   intermediate_size
							lowerCAmelCase__        =   hidden_act
							lowerCAmelCase__        =   hidden_dropout_prob
							lowerCAmelCase__        =   attention_probs_dropout_prob
							lowerCAmelCase__        =   type_sequence_label_size
							lowerCAmelCase__        =   initializer_range
							lowerCAmelCase__        =   mask_ratio
							lowerCAmelCase__        =   scope

							# in ViTMAE, the expected sequence length = (num_patches + 1) * (1 - config.mask_ratio), rounded above
							# (we add 1 for the [CLS] token)
							lowerCAmelCase__        =   (image_size // patch_size) ** 2
							lowerCAmelCase__        =   int(math.ceil((1 - mask_ratio) * (num_patches + 1)     )     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     int     ):
							lowerCAmelCase__        =   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]     )

							lowerCAmelCase__        =   None
							if self.use_labels:
									lowerCAmelCase__        =   ids_tensor([self.batch_size]  ,						self.type_sequence_label_size     )

							lowerCAmelCase__        =   self.get_config()

							return config, pixel_values, labels




					def 						_SCREAMING_SNAKE_CASE						(	self						:     str     ):
							return ViTMAEConfig(
							    image_size=self.image_size  ,						patch_size=self.patch_size  ,						num_channels=self.num_channels  ,						hidden_size=self.hidden_size  ,						num_hidden_layers=self.num_hidden_layers  ,						num_attention_heads=self.num_attention_heads  ,						intermediate_size=self.intermediate_size  ,						hidden_act=self.hidden_act  ,						hidden_dropout_prob=self.hidden_dropout_prob  ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob  ,						is_decoder=__A  ,						initializer_range=self.initializer_range  ,						mask_ratio=self.mask_ratio  ,						)




					def 						_SCREAMING_SNAKE_CASE						(	self						:     int  ,						snake_case__						:     List[str]  ,						snake_case__						:     List[str]  ,						snake_case__						:     List[str]     ):
							lowerCAmelCase__        =   ViTMAEModel(config=__A     )
							model.to(__A     )
							model.eval()
							lowerCAmelCase__        =   model(__A     )
							self.parent.assertEqual(result.last_hidden_state.shape  ,						(self.batch_size, self.seq_length, self.hidden_size)     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     str  ,						snake_case__						:     Tuple  ,						snake_case__						:     Dict  ,						snake_case__						:     int     ):
							lowerCAmelCase__        =   ViTMAEForPreTraining(__A     )
							model.to(__A     )
							model.eval()
							lowerCAmelCase__        =   model(__A     )
							lowerCAmelCase__        =   (self.image_size // self.patch_size) ** 2
							lowerCAmelCase__        =   self.patch_size**2 * self.num_channels
							self.parent.assertEqual(result.logits.shape  ,						(self.batch_size, num_patches, expected_num_channels)     )

							# test greyscale images
							lowerCAmelCase__        =   1
							lowerCAmelCase__        =   ViTMAEForPreTraining(__A     )
							model.to(__A     )
							model.eval()
							lowerCAmelCase__        =   floats_tensor([self.batch_size, 1, self.image_size, self.image_size]     )
							lowerCAmelCase__        =   model(__A     )
							lowerCAmelCase__        =   self.patch_size**2
							self.parent.assertEqual(result.logits.shape  ,						(self.batch_size, num_patches, expected_num_channels)     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Any     ):
							lowerCAmelCase__        =   self.prepare_config_and_inputs()
							lowerCAmelCase__   ,					lowerCAmelCase__   ,					lowerCAmelCase__        =   config_and_inputs
							lowerCAmelCase__        =   {"""pixel_values""": pixel_values}
							return config, inputs_dict

@require_torch
class       a_      (     __UpperCamelCase ,		__UpperCamelCase ,		unittest.TestCase			):
					UpperCamelCase_ :	str			=    (ViTMAEModel, ViTMAEForPreTraining) if is_torch_available() else ()
					UpperCamelCase_ :	Optional[int]			=    {"feature-extraction": ViTMAEModel} if is_torch_available() else {}

					UpperCamelCase_ :	str			=    False
					UpperCamelCase_ :	List[Any]			=    False
					UpperCamelCase_ :	List[Any]			=    False
					UpperCamelCase_ :	Tuple			=    False




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[int]     ):
							lowerCAmelCase__        =   ViTMAEModelTester(self     )
							lowerCAmelCase__        =   ConfigTester(self  ,						config_class=__A  ,						has_text_modality=__A  ,						hidden_size=37     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     List[str]     ):
							self.config_tester.run_common_tests()




					@unittest.skip(reason="""ViTMAE does not use inputs_embeds"""     )
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[Any]     ):
							pass




					def 						_SCREAMING_SNAKE_CASE						(	self						:     List[Any]     ):
							lowerCAmelCase__   ,					lowerCAmelCase__        =   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									lowerCAmelCase__        =   model_class(__A     )
									self.assertIsInstance(model.get_input_embeddings()  ,						(nn.Module)     )
									lowerCAmelCase__        =   model.get_output_embeddings()
									self.assertTrue(x is None or isinstance(__A  ,						nn.Linear     )     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[Any]     ):
							lowerCAmelCase__   ,					lowerCAmelCase__        =   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									lowerCAmelCase__        =   model_class(__A     )
									lowerCAmelCase__        =   inspect.signature(model.forward     )
									# signature.parameters is an OrderedDict => so arg_names order is deterministic
									lowerCAmelCase__        =   [*signature.parameters.keys()]

									lowerCAmelCase__        =   ["""pixel_values"""]
									self.assertListEqual(arg_names[:1]  ,						__A     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     str     ):
							lowerCAmelCase__        =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*__A     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[Any]     ):
							lowerCAmelCase__        =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_pretraining(*__A     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Any  ,						snake_case__						:     List[Any]  ,						snake_case__						:     Tuple  ,						snake_case__						:     Optional[int]     ):
							# make masks reproducible
							np.random.seed(2     )

							lowerCAmelCase__        =   int((pt_model.config.image_size // pt_model.config.patch_size) ** 2     )
							lowerCAmelCase__        =   np.random.uniform(size=(self.model_tester.batch_size, num_patches)     )
							lowerCAmelCase__        =   torch.from_numpy(__A     )

							# Add `noise` argument.
							# PT inputs will be prepared in `super().check_pt_tf_models()` with this added `noise` argument
							lowerCAmelCase__        =   pt_noise

							super().check_pt_tf_models(__A  ,						__A  ,						__A     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     int     ):
							lowerCAmelCase__   ,					lowerCAmelCase__        =   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									lowerCAmelCase__        =   model_class(__A     )
									model.to(__A     )
									model.eval()
									# make random mask reproducible
									torch.manual_seed(2     )
									with torch.no_grad():
											lowerCAmelCase__        =   model(**self._prepare_for_class(__A  ,						__A     )     )

									lowerCAmelCase__        =   outputs[0].cpu().numpy()
									lowerCAmelCase__        =   0

									with tempfile.TemporaryDirectory() as tmpdirname:
											model.save_pretrained(__A     )
											lowerCAmelCase__        =   model_class.from_pretrained(__A     )
											model.to(__A     )
											# make random mask reproducible
											torch.manual_seed(2     )
											with torch.no_grad():
													lowerCAmelCase__        =   model(**self._prepare_for_class(__A  ,						__A     )     )

											# Make sure we don't have nans
											lowerCAmelCase__        =   after_outputs[0].cpu().numpy()
											lowerCAmelCase__        =   0
											lowerCAmelCase__        =   np.amax(np.abs(out_a - out_a     )     )
											self.assertLessEqual(__A  ,						1E-5     )




					@unittest.skip(
					    reason="""ViTMAE returns a random mask + ids_restore in each forward pass. See test_save_load
    to get deterministic results."""     )
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Any     ):
							pass




					@unittest.skip(
					    reason="""ViTMAE returns a random mask + ids_restore in each forward pass. See test_save_load
    to get deterministic results."""     )
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Any     ):
							pass




					@unittest.skip(
					    reason="""ViTMAE returns a random mask + ids_restore in each forward pass. See test_save_load
    to get deterministic results."""     )
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Union[str, Any]     ):
							pass




					@unittest.skip(reason="""ViTMAE returns a random mask + ids_restore in each forward pass. See test_save_load"""     )
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[int]     ):
							pass




					@unittest.skip("""Will be fixed soon by reducing the size of the model used for common tests."""     )
					def 						_SCREAMING_SNAKE_CASE						(	self						:     List[Any]     ):
							pass




					@slow
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Union[str, Any]     ):
							for model_name in VIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									lowerCAmelCase__        =   ViTMAEModel.from_pretrained(__A     )
									self.assertIsNotNone(__A     )







def 							_UpperCAmelCase		(       ):





		"""simple docstring"""




		lowerCAmelCase__        =   Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""     )
		return image






@require_torch
@require_vision
class       a_      (     unittest.TestCase			):




					@cached_property
					def 						_SCREAMING_SNAKE_CASE						(	self						:     Union[str, Any]     ):
							return ViTImageProcessor.from_pretrained("""facebook/vit-mae-base"""     ) if is_vision_available() else None




					@slow
					def 						_SCREAMING_SNAKE_CASE						(	self						:     int     ):
							# make random mask reproducible across the PT and TF model
							np.random.seed(2     )

							lowerCAmelCase__        =   ViTMAEForPreTraining.from_pretrained("""facebook/vit-mae-base"""     ).to(__A     )

							lowerCAmelCase__        =   self.default_image_processor
							lowerCAmelCase__        =   prepare_img()
							lowerCAmelCase__        =   image_processor(images=__A  ,						return_tensors="""pt"""     ).to(__A     )

							# prepare a noise vector that will be also used for testing the TF model
							# (this way we can ensure that the PT and TF models operate on the same inputs)
							lowerCAmelCase__        =   ViTMAEConfig()
							lowerCAmelCase__        =   int((vit_mae_config.image_size // vit_mae_config.patch_size) ** 2     )
							lowerCAmelCase__        =   np.random.uniform(size=(1, num_patches)     )

							# forward pass
							with torch.no_grad():
									lowerCAmelCase__        =   model(**__A  ,						noise=torch.from_numpy(__A     ).to(device=__A     )     )

							# verify the logits
							lowerCAmelCase__        =   torch.Size((1, 196, 768)     )
							self.assertEqual(outputs.logits.shape  ,						__A     )

							lowerCAmelCase__        =   torch.tensor(
							    [[-0.0548, -1.7023, -0.9325], [0.3721, -0.5670, -0.2233], [0.8235, -1.3878, -0.3524]]     )

							self.assertTrue(torch.allclose(outputs.logits[0, :3, :3]  ,						expected_slice.to(__A     )  ,						atol=1E-4     )     )





"""simple docstring"""




import json
import sys
import tempfile
import unittest
from pathlib import Path

import transformers
from transformers import (
    CONFIG_MAPPING,
    IMAGE_PROCESSOR_MAPPING,
    AutoConfig,
    AutoImageProcessor,
    CLIPConfig,
    CLIPImageProcessor,
)
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER


sys.path.append(str(Path(__file__).parent.parent.parent.parent / "utils"))

from test_module.custom_configuration import CustomConfig  # noqa E402
from test_module.custom_image_processing import CustomImageProcessor  # noqa E402

class       a_      (     unittest.TestCase			):




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[int]     ):
							lowerCAmelCase__        =   0




					def 						_SCREAMING_SNAKE_CASE						(	self						:     List[Any]     ):
							lowerCAmelCase__        =   AutoImageProcessor.from_pretrained("""openai/clip-vit-base-patch32"""     )
							self.assertIsInstance(snake_case__  ,						snake_case__     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Tuple     ):
							with tempfile.TemporaryDirectory() as tmpdirname:
									lowerCAmelCase__        =   Path(snake_case__     ) / """preprocessor_config.json"""
									lowerCAmelCase__        =   Path(snake_case__     ) / """config.json"""
									json.dump(
									    {"""image_processor_type""": """CLIPImageProcessor""", """processor_class""": """CLIPProcessor"""}  ,						open(snake_case__  ,						"""w"""     )  ,						)
									json.dump({"""model_type""": """clip"""}  ,						open(snake_case__  ,						"""w"""     )     )

									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__     )
									self.assertIsInstance(snake_case__  ,						snake_case__     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Union[str, Any]     ):
							# Ensure we can load the image processor from the feature extractor config
							with tempfile.TemporaryDirectory() as tmpdirname:
									lowerCAmelCase__        =   Path(snake_case__     ) / """preprocessor_config.json"""
									lowerCAmelCase__        =   Path(snake_case__     ) / """config.json"""
									json.dump(
									    {"""feature_extractor_type""": """CLIPFeatureExtractor""", """processor_class""": """CLIPProcessor"""}  ,						open(snake_case__  ,						"""w"""     )  ,						)
									json.dump({"""model_type""": """clip"""}  ,						open(snake_case__  ,						"""w"""     )     )

									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__     )
									self.assertIsInstance(snake_case__  ,						snake_case__     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[int]     ):
							with tempfile.TemporaryDirectory() as tmpdirname:
									lowerCAmelCase__        =   CLIPConfig()

									# Create a dummy config file with image_proceesor_type
									lowerCAmelCase__        =   Path(snake_case__     ) / """preprocessor_config.json"""
									lowerCAmelCase__        =   Path(snake_case__     ) / """config.json"""
									json.dump(
									    {"""image_processor_type""": """CLIPImageProcessor""", """processor_class""": """CLIPProcessor"""}  ,						open(snake_case__  ,						"""w"""     )  ,						)
									json.dump({"""model_type""": """clip"""}  ,						open(snake_case__  ,						"""w"""     )     )

									# remove image_processor_type to make sure config.json alone is enough to load image processor locally
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__     ).to_dict()

									config_dict.pop("""image_processor_type"""     )
									lowerCAmelCase__        =   CLIPImageProcessor(**snake_case__     )

									# save in new folder
									model_config.save_pretrained(snake_case__     )
									config.save_pretrained(snake_case__     )

									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__     )

									# make sure private variable is not incorrectly saved
									lowerCAmelCase__        =   json.loads(config.to_json_string()     )
									self.assertTrue("""_processor_class""" not in dict_as_saved     )

							self.assertIsInstance(snake_case__  ,						snake_case__     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Dict     ):
							with tempfile.TemporaryDirectory() as tmpdirname:
									lowerCAmelCase__        =   Path(snake_case__     ) / """preprocessor_config.json"""
									json.dump(
									    {"""image_processor_type""": """CLIPImageProcessor""", """processor_class""": """CLIPProcessor"""}  ,						open(snake_case__  ,						"""w"""     )  ,						)

									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__     )
									self.assertIsInstance(snake_case__  ,						snake_case__     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[int]     ):
							with self.assertRaisesRegex(
							    snake_case__  ,						"""clip-base is not a local folder and is not a valid model identifier"""     ):
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained("""clip-base"""     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Union[str, Any]     ):
							with self.assertRaisesRegex(
							    snake_case__  ,						R"""aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"""     ):
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__  ,						revision="""aaaaaa"""     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[Any]     ):
							with self.assertRaisesRegex(
							    snake_case__  ,						"""hf-internal-testing/config-no-model does not appear to have a file named preprocessor_config.json."""  ,						):
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained("""hf-internal-testing/config-no-model"""     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Any     ):
							# If remote code is not set, we will time out when asking whether to load the model.
							with self.assertRaises(snake_case__     ):
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained("""hf-internal-testing/test_dynamic_image_processor"""     )
							# If remote code is disabled, we can't load this config.
							with self.assertRaises(snake_case__     ):
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(
									    """hf-internal-testing/test_dynamic_image_processor"""  ,						trust_remote_code=snake_case__     )

							lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(
							    """hf-internal-testing/test_dynamic_image_processor"""  ,						trust_remote_code=snake_case__     )
							self.assertEqual(image_processor.__class__.__name__  ,						"""NewImageProcessor"""     )

							# Test image processor can be reloaded.
							with tempfile.TemporaryDirectory() as tmp_dir:
									image_processor.save_pretrained(snake_case__     )
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__  ,						trust_remote_code=snake_case__     )
							self.assertEqual(reloaded_image_processor.__class__.__name__  ,						"""NewImageProcessor"""     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Dict     ):
							try:
									AutoConfig.register("""custom"""  ,						snake_case__     )
									AutoImageProcessor.register(snake_case__  ,						snake_case__     )
									# Trying to register something existing in the Transformers library will raise an error
									with self.assertRaises(snake_case__     ):
											AutoImageProcessor.register(snake_case__  ,						snake_case__     )

									with tempfile.TemporaryDirectory() as tmpdirname:
											lowerCAmelCase__        =   Path(snake_case__     ) / """preprocessor_config.json"""
											lowerCAmelCase__        =   Path(snake_case__     ) / """config.json"""
											json.dump(
											    {"""feature_extractor_type""": """CLIPFeatureExtractor""", """processor_class""": """CLIPProcessor"""}  ,						open(snake_case__  ,						"""w"""     )  ,						)
											json.dump({"""model_type""": """clip"""}  ,						open(snake_case__  ,						"""w"""     )     )

											lowerCAmelCase__        =   CustomImageProcessor.from_pretrained(snake_case__     )

									# Now that the config is registered, it can be used as any other config with the auto-API
									with tempfile.TemporaryDirectory() as tmp_dir:
											image_processor.save_pretrained(snake_case__     )
											lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(snake_case__     )
											self.assertIsInstance(snake_case__  ,						snake_case__     )

							finally:
									if "custom" in CONFIG_MAPPING._extra_content:
											del CONFIG_MAPPING._extra_content["custom"]
									if CustomConfig in IMAGE_PROCESSOR_MAPPING._extra_content:
											del IMAGE_PROCESSOR_MAPPING._extra_content[CustomConfig]




					def 						_SCREAMING_SNAKE_CASE						(	self						:     List[str]     ):

							class       a_      (     __UpperCamelCase			):
												UpperCamelCase_ :	Tuple			=    True

							try:
									AutoConfig.register("""custom"""  ,						snake_case__     )
									AutoImageProcessor.register(snake_case__  ,						snake_case__     )
									# If remote code is not set, the default is to use local
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained("""hf-internal-testing/test_dynamic_image_processor"""     )
									self.assertEqual(image_processor.__class__.__name__  ,						"""NewImageProcessor"""     )
									self.assertTrue(image_processor.is_local     )

									# If remote code is disabled, we load the local one.
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(
									    """hf-internal-testing/test_dynamic_image_processor"""  ,						trust_remote_code=snake_case__     )
									self.assertEqual(image_processor.__class__.__name__  ,						"""NewImageProcessor"""     )
									self.assertTrue(image_processor.is_local     )

									# If remote is enabled, we load from the Hub
									lowerCAmelCase__        =   AutoImageProcessor.from_pretrained(
									    """hf-internal-testing/test_dynamic_image_processor"""  ,						trust_remote_code=snake_case__     )
									self.assertEqual(image_processor.__class__.__name__  ,						"""NewImageProcessor"""     )
									self.assertTrue(not hasattr(snake_case__  ,						"""is_local"""     )     )

							finally:
									if "custom" in CONFIG_MAPPING._extra_content:
											del CONFIG_MAPPING._extra_content["custom"]
									if CustomConfig in IMAGE_PROCESSOR_MAPPING._extra_content:
											del IMAGE_PROCESSOR_MAPPING._extra_content[CustomConfig]




