


import json
import os
import unittest

from transformers import MgpstrTokenizer
from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin

@require_tokenizers
class 							lowercase  (						_UpperCAmelCase    ,       unittest.TestCase			):
     lowerCamelCase			:			Union[str, Any]      = MgpstrTokenizer
     lowerCamelCase			:			Tuple      = False
     lowerCamelCase			:			str      = {}
     lowerCamelCase			:			Dict      = False







     def 							lowercase__       (						self :						Dict      ):
           super().setUp()

           # fmt: off
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		['''[GO]''', '''[s]''', '''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''', '''a''', '''b''', '''c''', '''d''', '''e''', '''f''', '''g''', '''h''', '''i''', '''j''', '''k''', '''l''', '''m''', '''n''', '''o''', '''p''', '''q''', '''r''', '''s''', '''t''', '''u''', '''v''', '''w''', '''x''', '''y''', '''z''']
           # fmt: on
           SCREAMING_SNAKE_CASE__       :  str						     =		dict(zip(_lowercase   ,   range(len(_lowercase      )      )      )      )

           SCREAMING_SNAKE_CASE__       :  List[str]						     =		os.path.join(self.tmpdirname   ,   VOCAB_FILES_NAMES['''vocab_file''']      )
           with open(self.vocab_file   ,   '''w'''   ,   encoding='''utf-8'''      ) as fp:
                 fp.write(json.dumps(_lowercase      ) + '''\n'''      )







     def 							lowercase__       (						self :						Any   ,   **_lowercase :						List[Any]      ):
           return MgpstrTokenizer.from_pretrained(self.tmpdirname   ,   **_lowercase      )







     def 							lowercase__       (						self :						int   ,   _lowercase :						List[str]      ):
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		'''tester'''
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		'''tester'''
           return input_text, output_text







     @unittest.skip('''MGP-STR always lower cases letters.'''      )
     def 							lowercase__       (						self :						Dict      ):
           pass







     def 							lowercase__       (						self :						str      ):
           SCREAMING_SNAKE_CASE__       :  Dict						     =		self.get_tokenizers(do_lower_case=_lowercase      )
           for tokenizer in tokenizers:
                 with self.subTest(f"""{tokenizer.__class__.__name__}"""      ):
                       SCREAMING_SNAKE_CASE__       :  List[str]						     =		'''[SPECIAL_TOKEN]'''

                       tokenizer.add_special_tokens({'''cls_token''': special_token}      )
                       SCREAMING_SNAKE_CASE__       :  List[Any]						     =		tokenizer.encode([special_token]   ,   add_special_tokens=_lowercase      )
                       self.assertEqual(len(_lowercase      )   ,   1      )

                       SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		tokenizer.decode(_lowercase   ,   skip_special_tokens=_lowercase      )
                       self.assertTrue(special_token not in decoded      )







     def 							lowercase__       (						self :						Dict      ):
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		self.get_tokenizers()
           for tokenizer in tokenizers:
                 with self.subTest(f"""{tokenizer.__class__.__name__}"""      ):
                       SCREAMING_SNAKE_CASE__     ,       SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		self.get_input_output_texts(_lowercase      )

                       SCREAMING_SNAKE_CASE__       :  Any						     =		tokenizer.tokenize(_lowercase      )
                       SCREAMING_SNAKE_CASE__       :  List[Any]						     =		tokenizer.convert_tokens_to_ids(_lowercase      )
                       SCREAMING_SNAKE_CASE__       :  str						     =		tokenizer.encode(_lowercase   ,   add_special_tokens=_lowercase      )
                       self.assertListEqual(_lowercase   ,   _lowercase      )

                       SCREAMING_SNAKE_CASE__       :  int						     =		tokenizer.convert_ids_to_tokens(_lowercase      )
                       self.assertNotEqual(len(_lowercase      )   ,   0      )
                       SCREAMING_SNAKE_CASE__       :  str						     =		tokenizer.decode(_lowercase      )
                       self.assertIsInstance(_lowercase   ,   _lowercase      )

                       self.assertEqual(text_a.replace(''' '''   ,   ''''''      )   ,   _lowercase      )







     @unittest.skip('''MGP-STR tokenizer only handles one sequence.'''      )
     def 							lowercase__       (						self :						Optional[int]      ):
           pass







     @unittest.skip('''inputs cannot be pretokenized in MgpstrTokenizer'''      )
     def 							lowercase__       (						self :						int      ):
           pass












import inspect
import unittest

import numpy as np

from tests.test_modeling_common import floats_tensor
from transformers import MaskaFormerConfig, is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch

							from transformers import MaskaFormerForUniversalSegmentation, MaskaFormerModel

							if is_vision_available():
														from transformers import MaskaFormerImageProcessor

if is_vision_available():
							from PIL import Image




class 		__A   :

						def __init__(		self :int     ,			__snake_case :List[Any]     ,			__snake_case :List[Any]=2     ,			__snake_case :Dict=True     ,			__snake_case :Tuple=False     ,			__snake_case :List[str]=10     ,			__snake_case :List[str]=3     ,			__snake_case :Union[str, Any]=32 * 8     ,			__snake_case :Optional[int]=32 * 8     ,			__snake_case :Any=4     ,			__snake_case :Union[str, Any]=64     ,			):
										'''simple docstring'''

										__magic_name__						:						Optional[int]										=parent
										__magic_name__						:						List[Any]										=batch_size
										__magic_name__						:						List[str]										=is_training
										__magic_name__						:						List[str]										=use_auxiliary_loss
										__magic_name__						:						Union[str, Any]										=num_queries
										__magic_name__						:						str										=num_channels
										__magic_name__						:						Union[str, Any]										=min_size
										__magic_name__						:						Union[str, Any]										=max_size
										__magic_name__						:						Optional[int]										=num_labels
										__magic_name__						:						Tuple										=hidden_dim
										__magic_name__						:						Any										=hidden_dim

						def      A__    (		self :Optional[Any]			):
										'''simple docstring'''

										__magic_name__						:						Optional[Any]										=floats_tensor([self.batch_size, self.num_channels, self.min_size, self.max_size]			).to(
										    __snake_case			)

										__magic_name__						:						List[Any]										=torch.ones([self.batch_size, self.min_size, self.max_size]     ,			device=__snake_case			)

										__magic_name__						:						List[str]										=(
										    torch.rand([self.batch_size, self.num_labels, self.min_size, self.max_size]     ,			device=__snake_case			) > 0.5
										).float()
										__magic_name__						:						Union[str, Any]										=(torch.rand((self.batch_size, self.num_labels)     ,			device=__snake_case			) > 0.5).long()

										__magic_name__						:						str										=self.get_config()
										return config, pixel_values, pixel_mask, mask_labels, class_labels

						def      A__    (		self :Any			):
										'''simple docstring'''

										__magic_name__						:						Dict										=MaskaFormerConfig(
										    hidden_size=self.hidden_dim     ,			)
										__magic_name__						:						str										=self.num_queries
										__magic_name__						:						Dict										=self.num_labels

										__magic_name__						:						int										=[1, 1, 1, 1]
										__magic_name__						:						List[str]										=self.num_channels

										__magic_name__						:						str										=64
										__magic_name__						:						List[str]										=1_28
										__magic_name__						:						Optional[Any]										=self.hidden_dim
										__magic_name__						:						Tuple										=self.hidden_dim
										__magic_name__						:						Optional[int]										=self.hidden_dim
										return config

						def      A__    (		self :Any			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__					,			__magic_name__					,			__magic_name__					,			__magic_name__						:						Tuple										=self.prepare_config_and_inputs()
										__magic_name__						:						Optional[Any]										={"""pixel_values""": pixel_values, """pixel_mask""": pixel_mask}
										return config, inputs_dict

						def      A__    (		self :Union[str, Any]     ,			__snake_case :Tuple     ,			__snake_case :Dict			):
										'''simple docstring'''

										__magic_name__						:						int										=output.encoder_hidden_states
										__magic_name__						:						List[str]										=output.pixel_decoder_hidden_states
										__magic_name__						:						int										=output.transformer_decoder_hidden_states

										self.parent.assertTrue(len(__snake_case			)     ,			len(config.backbone_config.depths			)			)
										self.parent.assertTrue(len(__snake_case			)     ,			len(config.backbone_config.depths			)			)
										self.parent.assertTrue(len(__snake_case			)     ,			config.decoder_layers			)

						def      A__    (		self :List[Any]     ,			__snake_case :Optional[Any]     ,			__snake_case :int     ,			__snake_case :str     ,			__snake_case :str=False			):
										'''simple docstring'''

										with torch.no_grad():
														__magic_name__						:						List[str]										=MaskaFormerModel(config=__snake_case			)
														model.to(__snake_case			)
														model.eval()

														__magic_name__						:						Union[str, Any]										=model(pixel_values=__snake_case     ,			pixel_mask=__snake_case			)
														__magic_name__						:						int										=model(__snake_case     ,			output_hidden_states=__snake_case			)

										self.parent.assertEqual(
										    output.transformer_decoder_last_hidden_state.shape     ,			(self.batch_size, self.num_queries, self.hidden_dim)     ,			)
										# let's ensure the other two hidden state exists
										self.parent.assertTrue(output.pixel_decoder_last_hidden_state is not None			)
										self.parent.assertTrue(output.encoder_last_hidden_state is not None			)

										if output_hidden_states:
														self.check_output_hidden_state(__snake_case     ,			__snake_case			)


						def      A__    (		self :Optional[Any]     ,			__snake_case :List[str]     ,			__snake_case :List[Any]     ,			__snake_case :int     ,			__snake_case :Any     ,			__snake_case :Union[str, Any]			):
										'''simple docstring'''

										__magic_name__						:						str										=MaskaFormerForUniversalSegmentation(config=__snake_case			)
										model.to(__snake_case			)
										model.eval()

										def comm_check_on_output(__snake_case :List[str]			):
														# let's still check that all the required stuff is there
														self.parent.assertTrue(result.transformer_decoder_last_hidden_state is not None			)
														self.parent.assertTrue(result.pixel_decoder_last_hidden_state is not None			)
														self.parent.assertTrue(result.encoder_last_hidden_state is not None			)
														# okay, now we need to check the logits shape
														# due to the encoder compression, masks have a //4 spatial size
														self.parent.assertEqual(
														    result.masks_queries_logits.shape     ,			(self.batch_size, self.num_queries, self.min_size // 4, self.max_size // 4)     ,			)
														# + 1 for null class
														self.parent.assertEqual(
														    result.class_queries_logits.shape     ,			(self.batch_size, self.num_queries, self.num_labels + 1)			)

										with torch.no_grad():
														__magic_name__						:						int										=model(pixel_values=__snake_case     ,			pixel_mask=__snake_case			)
														__magic_name__						:						List[str]										=model(__snake_case			)

														comm_check_on_output(__snake_case			)

														__magic_name__						:						Any										=model(
														    pixel_values=__snake_case     ,			pixel_mask=__snake_case     ,			mask_labels=__snake_case     ,			class_labels=__snake_case			)

										comm_check_on_output(__snake_case			)

										self.parent.assertTrue(result.loss is not None			)
										self.parent.assertEqual(result.loss.shape     ,			torch.Size([1]			)			)




@require_torch
class 		__A   (      UpperCamelCase__       ,    UpperCamelCase__       ,    unittest.TestCase      ):
						UpperCamelCase      =       (MaskaFormerModel, MaskaFormerForUniversalSegmentation) if is_torch_available() else ()
						UpperCamelCase      =       {"""feature-extraction""": MaskaFormerModel} if is_torch_available() else {}

						UpperCamelCase      =       False
						UpperCamelCase      =       False
						UpperCamelCase      =       False
						UpperCamelCase      =       False

						def      A__    (		self :str			):
										'''simple docstring'''

										__magic_name__						:						Any										=MaskaFormerModelTester(self			)
										__magic_name__						:						Union[str, Any]										=ConfigTester(self     ,			config_class=__snake_case     ,			has_text_modality=__snake_case			)

						def      A__    (		self :Dict			):
										'''simple docstring'''

										self.config_tester.run_common_tests()

						def      A__    (		self :Tuple			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__						:						Union[str, Any]										=self.model_tester.prepare_config_and_inputs_for_common()
										self.model_tester.create_and_check_maskaformer_model(__snake_case     ,			**__snake_case     ,			output_hidden_states=__snake_case			)

						def      A__    (		self :List[str]			):
										'''simple docstring'''

										__magic_name__						:						Any										=self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_maskaformer_instance_segmentation_head_model(*__snake_case			)

						@unittest.skip(reason="""Mask2Former does not use inputs_embeds"""			)
						def      A__    (		self :List[Any]			):
										'''simple docstring'''

										pass

						@unittest.skip(reason="""Mask2Former does not have a get_input_embeddings method"""			)
						def      A__    (		self :Dict			):
										'''simple docstring'''

										pass

						@unittest.skip(reason="""Mask2Former is not a generative model"""			)
						def      A__    (		self :Optional[Any]			):
										'''simple docstring'''

										pass

						@unittest.skip(reason="""Mask2Former does not use token embeddings"""			)
						def      A__    (		self :int			):
										'''simple docstring'''

										pass

						@require_torch_multi_gpu
						@unittest.skip(
						    reason="""Mask2Former has some layers using `add_module` which doesn't work well with `nn.DataParallel`"""			)
						def      A__    (		self :Tuple			):
										'''simple docstring'''

										pass

						@unittest.skip("""Will be fixed soon by reducing the size of the model used for common tests."""			)
						def      A__    (		self :Union[str, Any]			):
										'''simple docstring'''

										pass

						def      A__    (		self :Optional[int]			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__						:						Union[str, Any]										=self.model_tester.prepare_config_and_inputs_for_common()

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

														__magic_name__						:						Optional[Any]										=["""pixel_values"""]
														self.assertListEqual(arg_names[:1]     ,			__snake_case			)

						@slow
						def      A__    (		self :Tuple			):
										'''simple docstring'''

										for model_name in ["facebook/mask2former-swin-small-coco-instance"]:
														__magic_name__						:						int										=MaskaFormerModel.from_pretrained(__snake_case			)
														self.assertIsNotNone(__snake_case			)

						def      A__    (		self :List[str]			):
										'''simple docstring'''

										__magic_name__						:						Any										=(self.model_tester.min_size,) * 2
										__magic_name__						:						Union[str, Any]										={
										    """pixel_values""": torch.randn((2, 3, *size)     ,			device=__snake_case			),
										    """mask_labels""": torch.randn((2, 10, *size)     ,			device=__snake_case			),
										    """class_labels""": torch.zeros(2     ,			10     ,			device=__snake_case			).long(),
										}
										__magic_name__						:						Optional[Any]										=self.model_tester.get_config()

										__magic_name__						:						Dict										=MaskaFormerForUniversalSegmentation(__snake_case			).to(__snake_case			)
										__magic_name__						:						Any										=model(**__snake_case			)
										self.assertTrue(outputs.loss is not None			)

						def      A__    (		self :List[str]			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__						:						int										=self.model_tester.prepare_config_and_inputs_for_common()
										self.model_tester.create_and_check_maskaformer_model(__snake_case     ,			**__snake_case     ,			output_hidden_states=__snake_case			)

						def      A__    (		self :Tuple			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__						:						List[Any]										=self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														__magic_name__						:						List[Any]										=model_class(__snake_case			).to(__snake_case			)
														__magic_name__						:						Optional[int]										=model(**__snake_case     ,			output_attentions=__snake_case			)
														self.assertTrue(outputs.attentions is not None			)

						def      A__    (		self :int			):
										'''simple docstring'''

										if not self.model_tester.is_training:
														return

										__magic_name__						:						List[Any]										=self.all_model_classes[1]
										__magic_name__					,			__magic_name__					,			__magic_name__					,			__magic_name__					,			__magic_name__						:						Union[str, Any]										=self.model_tester.prepare_config_and_inputs()

										__magic_name__						:						Dict										=model_class(__snake_case			)
										model.to(__snake_case			)
										model.train()

										__magic_name__						:						Optional[Any]										=model(__snake_case     ,			mask_labels=__snake_case     ,			class_labels=__snake_case			).loss
										loss.backward()


						def      A__    (		self :int			):
										'''simple docstring'''

										__magic_name__						:						List[str]										=self.all_model_classes[1]
										__magic_name__					,			__magic_name__					,			__magic_name__					,			__magic_name__					,			__magic_name__						:						List[Any]										=self.model_tester.prepare_config_and_inputs()
										__magic_name__						:						Tuple										=True
										__magic_name__						:						Optional[int]										=True

										__magic_name__						:						int										=model_class(__snake_case			).to(__snake_case			)
										model.train()

										__magic_name__						:						List[Any]										=model(__snake_case     ,			mask_labels=__snake_case     ,			class_labels=__snake_case			)

										__magic_name__						:						Optional[int]										=outputs.encoder_hidden_states[0]
										encoder_hidden_states.retain_grad()

										__magic_name__						:						Union[str, Any]										=outputs.pixel_decoder_hidden_states[0]
										pixel_decoder_hidden_states.retain_grad()

										__magic_name__						:						Union[str, Any]										=outputs.transformer_decoder_hidden_states[0]
										transformer_decoder_hidden_states.retain_grad()

										__magic_name__						:						Optional[int]										=outputs.attentions[0]
										attentions.retain_grad()

										outputs.loss.backward(retain_graph=__snake_case			)

										self.assertIsNotNone(encoder_hidden_states.grad			)
										self.assertIsNotNone(pixel_decoder_hidden_states.grad			)
										self.assertIsNotNone(transformer_decoder_hidden_states.grad			)
										self.assertIsNotNone(attentions.grad			)


UpperCAmelCase_		:					Dict          =  1e-4




def 		lowerCAmelCase_ (						):
				__magic_name__						:						Dict										=Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png""" )
				return image




@require_vision
@slow
class 		__A   (      unittest.TestCase      ):

						@cached_property
						def      A__    (		self :int			):
										'''simple docstring'''

										return "facebook/mask2former-swin-small-coco-instance"

						@cached_property
						def      A__    (		self :int			):
										'''simple docstring'''

										return MaskaFormerImageProcessor.from_pretrained(self.model_checkpoints			) if is_vision_available() else None

						def      A__    (		self :Optional[Any]			):
										'''simple docstring'''

										__magic_name__						:						Optional[Any]										=MaskaFormerModel.from_pretrained(self.model_checkpoints			).to(__snake_case			)
										__magic_name__						:						int										=self.default_image_processor
										__magic_name__						:						List[Any]										=prepare_img()
										__magic_name__						:						Any										=image_processor(__snake_case     ,			return_tensors="""pt"""			).to(__snake_case			)
										__magic_name__						:						Dict										=inputs["""pixel_values"""].shape
										# check size is divisible by 32
										self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0			)
										# check size
										self.assertEqual(__snake_case     ,			(1, 3, 3_84, 3_84)			)

										with torch.no_grad():
														__magic_name__						:						List[str]										=model(**__snake_case			)

										__magic_name__						:						Any										=torch.tensor(
										    [[-0.2790, -1.0717, -1.1668], [-0.5128, -0.3128, -0.4987], [-0.5832, 0.1971, -0.0197]]			).to(__snake_case			)
										self.assertTrue(
										    torch.allclose(
										        outputs.encoder_last_hidden_state[0, 0, :3, :3]     ,			__snake_case     ,			atol=__snake_case			)			)

										__magic_name__						:						Dict										=torch.tensor(
										    [[0.8973, 1.1847, 1.1776], [1.1934, 1.5040, 1.5128], [1.1153, 1.4486, 1.4951]]			).to(__snake_case			)
										self.assertTrue(
										    torch.allclose(
										        outputs.pixel_decoder_last_hidden_state[0, 0, :3, :3]     ,			__snake_case     ,			atol=__snake_case			)			)

										__magic_name__						:						Any										=torch.tensor(
										    [[2.1152, 1.7000, -0.8603], [1.5808, 1.8004, -0.9353], [1.6043, 1.7495, -0.5999]]			).to(__snake_case			)
										self.assertTrue(
										    torch.allclose(
										        outputs.transformer_decoder_last_hidden_state[0, :3, :3]     ,			__snake_case     ,			atol=__snake_case			)			)

						def      A__    (		self :Any			):
										'''simple docstring'''

										__magic_name__						:						Tuple										=MaskaFormerForUniversalSegmentation.from_pretrained(self.model_checkpoints			).to(__snake_case			).eval()
										__magic_name__						:						Optional[int]										=self.default_image_processor
										__magic_name__						:						Tuple										=prepare_img()
										__magic_name__						:						List[Any]										=image_processor(__snake_case     ,			return_tensors="""pt"""			).to(__snake_case			)
										__magic_name__						:						Union[str, Any]										=inputs["""pixel_values"""].shape
										# check size is divisible by 32
										self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0			)
										# check size
										self.assertEqual(__snake_case     ,			(1, 3, 3_84, 3_84)			)

										with torch.no_grad():
														__magic_name__						:						str										=model(**__snake_case			)
										# masks_queries_logits
										__magic_name__						:						List[Any]										=outputs.masks_queries_logits
										self.assertEqual(
										    masks_queries_logits.shape     ,			(1, model.config.num_queries, inputs_shape[-2] // 4, inputs_shape[-1] // 4)			)
										__magic_name__						:						List[Any]										=[
										    [-8.7839, -9.0056, -8.8121],
										    [-7.4104, -7.0313, -6.5401],
										    [-6.6105, -6.3427, -6.4675],
										]
										__magic_name__						:						Dict										=torch.tensor(__snake_case			).to(__snake_case			)
										self.assertTrue(torch.allclose(masks_queries_logits[0, 0, :3, :3]     ,			__snake_case     ,			atol=__snake_case			)			)
										# class_queries_logits
										__magic_name__						:						Any										=outputs.class_queries_logits
										self.assertEqual(class_queries_logits.shape     ,			(1, model.config.num_queries, model.config.num_labels + 1)			)
										__magic_name__						:						int										=torch.tensor(
										    [
										        [1.8324, -8.0835, -4.1922],
										        [0.8450, -9.0050, -3.6053],
										        [0.3045, -7.7293, -3.0275],
										    ]			).to(__snake_case			)
										self.assertTrue(torch.allclose(outputs.class_queries_logits[0, :3, :3]     ,			__snake_case     ,			atol=__snake_case			)			)


						def      A__    (		self :Optional[Any]			):
										'''simple docstring'''

										__magic_name__						:						Union[str, Any]										=MaskaFormerForUniversalSegmentation.from_pretrained(self.model_checkpoints			).to(__snake_case			).eval()
										__magic_name__						:						Any										=self.default_image_processor

										__magic_name__						:						Union[str, Any]										=image_processor(
										    [np.zeros((3, 8_00, 13_33)			), np.zeros((3, 8_00, 13_33)			)]     ,			segmentation_maps=[np.zeros((3_84, 3_84)			).astype(np.floataa			), np.zeros((3_84, 3_84)			).astype(np.floataa			)]     ,			return_tensors="""pt"""     ,			)

										__magic_name__						:						str										=inputs["""pixel_values"""].to(__snake_case			)
										__magic_name__						:						Tuple										=[el.to(__snake_case			) for el in inputs["""mask_labels"""]]
										__magic_name__						:						Union[str, Any]										=[el.to(__snake_case			) for el in inputs["""class_labels"""]]

										with torch.no_grad():
														__magic_name__						:						Dict										=model(**__snake_case			)

										self.assertTrue(outputs.loss is not None			)




