






"""simple docstring"""







import gc
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer

from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel
from diffusers.pipelines.alt_diffusion.modeling_roberta_series import (
    RobertaSeriesConfig,
    RobertaSeriesModelWithTransformation,
)
from diffusers.utils import slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS
from ..test_pipelines_common import PipelineKarrasSchedulerTesterMixin, PipelineLatentTesterMixin, PipelineTesterMixin


enable_full_determinism()




class 				A__ (			_lowerCamelCase ,  _lowerCamelCase ,  _lowerCamelCase ,  unittest.TestCase):
		A_		: List[str]            =			AltDiffusionPipeline
		A_		: int            =			TEXT_TO_IMAGE_PARAMS
		A_		: Dict            =			TEXT_TO_IMAGE_BATCH_PARAMS
		A_		: int            =			TEXT_TO_IMAGE_IMAGE_PARAMS
		A_		: List[str]            =			TEXT_TO_IMAGE_IMAGE_PARAMS

		def 							__lowerCamelCase							(   self				):
			torch.manual_seed(0				)
			__lowerCAmelCase    :		Optional[int]		    =   UNetaDConditionModel(
			    block_out_channels=(32, 64) ,	layers_per_block=2 ,	sample_size=32 ,	in_channels=4 ,	out_channels=4 ,	down_block_types=('DownBlock2D', 'CrossAttnDownBlock2D') ,	up_block_types=('CrossAttnUpBlock2D', 'UpBlock2D') ,	cross_attention_dim=32 ,	)
			__lowerCAmelCase    :		Optional[Any]		    =   DDIMScheduler(
			    beta_start=0.0_0085 ,	beta_end=0.012 ,	beta_schedule='scaled_linear' ,	clip_sample=UpperCamelCase_ ,	set_alpha_to_one=UpperCamelCase_ ,	)
			torch.manual_seed(0				)
			__lowerCAmelCase    :		Optional[int]		    =   AutoencoderKL(
			    block_out_channels=[32, 64] ,	in_channels=3 ,	out_channels=3 ,	down_block_types=['DownEncoderBlock2D', 'DownEncoderBlock2D'] ,	up_block_types=['UpDecoderBlock2D', 'UpDecoderBlock2D'] ,	latent_channels=4 ,	)

			# TODO: address the non-deterministic text encoder (fails for save-load tests)
			# torch.manual_seed(0)
			# text_encoder_config = RobertaSeriesConfig(
			#     hidden_size=32,
			#     project_dim=32,
			#     intermediate_size=37,
			#     layer_norm_eps=1e-05,
			#     num_attention_heads=4,
			#     num_hidden_layers=5,
			#     vocab_size=5002,
			# )
			# text_encoder = RobertaSeriesModelWithTransformation(text_encoder_config)

			torch.manual_seed(0				)
			__lowerCAmelCase    :		Any		    =   CLIPTextConfig(
			    bos_token_id=0 ,	eos_token_id=2 ,	hidden_size=32 ,	projection_dim=32 ,	intermediate_size=37 ,	layer_norm_eps=1E-05 ,	num_attention_heads=4 ,	num_hidden_layers=5 ,	pad_token_id=1 ,	vocab_size=50_02 ,	)
			__lowerCAmelCase    :		str		    =   CLIPTextModel(UpperCamelCase_				)

			__lowerCAmelCase    :		str		    =   XLMRobertaTokenizer.from_pretrained('hf-internal-testing/tiny-xlm-roberta'				)
			__lowerCAmelCase    :		Union[str, Any]		    =   77

			__lowerCAmelCase    :		Union[str, Any]		    =   {
			    'unet': unet,
			    'scheduler': scheduler,
			    'vae': vae,
			    'text_encoder': text_encoder,
			    'tokenizer': tokenizer,
			    'safety_checker': None,
			    'feature_extractor': None,
			}
			return components

		def 							__lowerCamelCase							(   self ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE=0				):





			if str(UpperCamelCase_				).startswith('mps'				):
				__lowerCAmelCase    :		Union[str, Any]		    =   torch.manual_seed(UpperCamelCase_				)
			else:
				__lowerCAmelCase    :		Any		    =   torch.Generator(device=UpperCamelCase_				).manual_seed(UpperCamelCase_				)
			__lowerCAmelCase    :		List[Any]		    =   {
			    'prompt': 'A painting of a squirrel eating a burger',
			    'generator': generator,
			    'num_inference_steps': 2,
			    'guidance_scale': 6.0,
			    'output_type': 'numpy',
			}
			return inputs

		def 							__lowerCamelCase							(   self				):
			super().test_attention_slicing_forward_pass(expected_max_diff=3E-3				)

		def 							__lowerCamelCase							(   self				):
			super().test_inference_batch_single_identical(expected_max_diff=3E-3				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Dict		    =   'cpu'  # ensure determinism for the device-dependent torch.Generator

			__lowerCAmelCase    :		List[Any]		    =   self.get_dummy_components()
			torch.manual_seed(0				)
			__lowerCAmelCase    :		List[Any]		    =   RobertaSeriesConfig(
			    hidden_size=32 ,	project_dim=32 ,	intermediate_size=37 ,	layer_norm_eps=1E-05 ,	num_attention_heads=4 ,	num_hidden_layers=5 ,	vocab_size=50_02 ,	)
			# TODO: remove after fixing the non-deterministic text encoder
			__lowerCAmelCase    :		Optional[Any]		    =   RobertaSeriesModelWithTransformation(UpperCamelCase_				)
			__lowerCAmelCase    :		str		    =   text_encoder

			__lowerCAmelCase    :		str		    =   AltDiffusionPipeline(**UpperCamelCase_				)
			__lowerCAmelCase    :		List[Any]		    =   alt_pipe.to(UpperCamelCase_				)
			alt_pipe.set_progress_bar_config(disable=UpperCamelCase_				)

			__lowerCAmelCase    :		Any		    =   self.get_dummy_inputs(UpperCamelCase_				)
			__lowerCAmelCase    :		int		    =   'A photo of an astronaut'
			__lowerCAmelCase    :		Optional[int]		    =   alt_pipe(**UpperCamelCase_				)
			__lowerCAmelCase    :		List[str]		    =   output.images
			__lowerCAmelCase    :		Dict		    =   image[0, -3:, -3:, -1]

			assert image.shape == (1, 64, 64, 3)
			__lowerCAmelCase    :		Union[str, Any]		    =   np.array(
			    [0.574_8162, 0.6044_7145, 0.4882_1217, 0.5010_0636, 0.543_1185, 0.4576_3683, 0.4965_7696, 0.4813_2733, 0.4757_3093]				)

			assert np.abs(image_slice.flatten() - expected_slice				).max() < 1E-2







		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		List[Any]		    =   'cpu'  # ensure determinism for the device-dependent torch.Generator

			__lowerCAmelCase    :		List[Any]		    =   self.get_dummy_components()
			__lowerCAmelCase    :		int		    =   PNDMScheduler(skip_prk_steps=UpperCamelCase_				)
			torch.manual_seed(0				)
			__lowerCAmelCase    :		Dict		    =   RobertaSeriesConfig(
			    hidden_size=32 ,	project_dim=32 ,	intermediate_size=37 ,	layer_norm_eps=1E-05 ,	num_attention_heads=4 ,	num_hidden_layers=5 ,	vocab_size=50_02 ,	)
			# TODO: remove after fixing the non-deterministic text encoder
			__lowerCAmelCase    :		Optional[int]		    =   RobertaSeriesModelWithTransformation(UpperCamelCase_				)
			__lowerCAmelCase    :		Tuple		    =   text_encoder
			__lowerCAmelCase    :		str		    =   AltDiffusionPipeline(**UpperCamelCase_				)
			__lowerCAmelCase    :		List[Any]		    =   alt_pipe.to(UpperCamelCase_				)
			alt_pipe.set_progress_bar_config(disable=UpperCamelCase_				)

			__lowerCAmelCase    :		Dict		    =   self.get_dummy_inputs(UpperCamelCase_				)
			__lowerCAmelCase    :		List[str]		    =   alt_pipe(**UpperCamelCase_				)
			__lowerCAmelCase    :		Any		    =   output.images
			__lowerCAmelCase    :		int		    =   image[0, -3:, -3:, -1]

			assert image.shape == (1, 64, 64, 3)
			__lowerCAmelCase    :		str		    =   np.array(
			    [0.5160_5093, 0.570_7241, 0.4736_5507, 0.5057_8886, 0.563_3877, 0.464_2503, 0.518_2081, 0.4876_3484, 0.4908_4237]				)

			assert np.abs(image_slice.flatten() - expected_slice				).max() < 1E-2




@slow
@require_torch_gpu
class 				A__ (			unittest.TestCase):

		def 							__lowerCamelCase							(   self				):
			super().tearDown()
			gc.collect()
			torch.cuda.empty_cache()

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		int		    =   AltDiffusionPipeline.from_pretrained('BAAI/AltDiffusion' ,	safety_checker=UpperCamelCase_				)
			__lowerCAmelCase    :		List[Any]		    =   alt_pipe.to(UpperCamelCase_				)
			alt_pipe.set_progress_bar_config(disable=UpperCamelCase_				)

			__lowerCAmelCase    :		Any		    =   'A painting of a squirrel eating a burger'
			__lowerCAmelCase    :		int		    =   torch.manual_seed(0				)
			__lowerCAmelCase    :		Dict		    =   alt_pipe([prompt] ,	generator=UpperCamelCase_ ,	guidance_scale=6.0 ,	num_inference_steps=20 ,	output_type='np'				)

			__lowerCAmelCase    :		List[Any]		    =   output.images

			__lowerCAmelCase    :		str		    =   image[0, -3:, -3:, -1]

			assert image.shape == (1, 5_12, 5_12, 3)
			__lowerCAmelCase    :		Optional[int]		    =   np.array([0.1010, 0.0800, 0.0794, 0.0885, 0.0843, 0.0762, 0.0769, 0.0729, 0.0586]				)

			assert np.abs(image_slice.flatten() - expected_slice				).max() < 1E-2







		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Union[str, Any]		    =   DDIMScheduler.from_pretrained('BAAI/AltDiffusion' ,	subfolder='scheduler'				)

			__lowerCAmelCase    :		Optional[Any]		    =   AltDiffusionPipeline.from_pretrained('BAAI/AltDiffusion' ,	scheduler=UpperCamelCase_ ,	safety_checker=UpperCamelCase_				)
			__lowerCAmelCase    :		str		    =   alt_pipe.to(UpperCamelCase_				)
			alt_pipe.set_progress_bar_config(disable=UpperCamelCase_				)

			__lowerCAmelCase    :		int		    =   'A painting of a squirrel eating a burger'
			__lowerCAmelCase    :		Any		    =   torch.manual_seed(0				)

			__lowerCAmelCase    :		Optional[Any]		    =   alt_pipe([prompt] ,	generator=UpperCamelCase_ ,	num_inference_steps=2 ,	output_type='numpy'				)
			__lowerCAmelCase    :		List[Any]		    =   output.images

			__lowerCAmelCase    :		List[str]		    =   image[0, -3:, -3:, -1]

			assert image.shape == (1, 5_12, 5_12, 3)
			__lowerCAmelCase    :		str		    =   np.array([0.4019, 0.4052, 0.3810, 0.4119, 0.3916, 0.3982, 0.4651, 0.4195, 0.5323]				)

			assert np.abs(image_slice.flatten() - expected_slice				).max() < 1E-2

"""simple docstring"""







import inspect
import unittest

from transformers import RegNetConfig
from transformers.file_utils import cached_property, is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

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 RegNetForImageClassification, RegNetModel
							from transformers.models.regnet.modeling_regnet import REGNET_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
							from PIL import Image

							from transformers import AutoImageProcessor




class 				A__ :

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

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Optional[Any]		    =   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]				)

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

			__lowerCAmelCase    :		int		    =   self.get_config()

			return config, pixel_values, labels

		def 							__lowerCamelCase							(   self				):
			return RegNetConfig(
			    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 ,	)

		def 							__lowerCamelCase							(   self ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				):
			__lowerCAmelCase    :		Any		    =   RegNetModel(config=_SCREAMING_SNAKE_CASE				)
			model.to(_SCREAMING_SNAKE_CASE				)
			model.eval()
			__lowerCAmelCase    :		Any		    =   model(_SCREAMING_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 ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				):
			__lowerCAmelCase    :		Optional[Any]		    =   self.num_labels
			__lowerCAmelCase    :		str		    =   RegNetForImageClassification(_SCREAMING_SNAKE_CASE				)
			model.to(_SCREAMING_SNAKE_CASE				)
			model.eval()
			__lowerCAmelCase    :		Any		    =   model(_SCREAMING_SNAKE_CASE ,	labels=_SCREAMING_SNAKE_CASE				)
			self.parent.assertEqual(result.logits.shape ,	(self.batch_size, self.num_labels)				)







		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Optional[Any]		    =   self.prepare_config_and_inputs()
			__lowerCAmelCase    ,     __lowerCAmelCase    ,     __lowerCAmelCase    :		Any		    =   config_and_inputs
			__lowerCAmelCase    :		List[str]		    =   {'pixel_values': pixel_values}
			return config, inputs_dict




@require_torch
class 				A__ (			_lowerCamelCase ,  _lowerCamelCase ,  unittest.TestCase):
		A_		: List[str]            =			(RegNetModel, RegNetForImageClassification) if is_torch_available() else ()
		A_		: List[Any]            =			(
		    {'feature-extraction': RegNetModel, 'image-classification': RegNetForImageClassification}
		    if is_torch_available()
		    else {}
		)

		A_		: Dict            =			False
		A_		: str            =			False
		A_		: int            =			False
		A_		: Union[str, Any]            =			False

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		List[str]		    =   RegNetModelTester(self				)
			__lowerCAmelCase    :		int		    =   ConfigTester(self ,	config_class=_SCREAMING_SNAKE_CASE ,	has_text_modality=_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			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				):
			return

		@unittest.skip(reason='RegNet does not use inputs_embeds'				)
		def 							__lowerCamelCase							(   self				):
			pass

		@unittest.skip(reason='RegNet does not support input and output embeddings'				)
		def 							__lowerCamelCase							(   self				):
			pass

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    ,     __lowerCAmelCase    :		List[Any]		    =   self.model_tester.prepare_config_and_inputs_for_common()

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

				__lowerCAmelCase    :		Optional[int]		    =   ['pixel_values']
				self.assertListEqual(arg_names[:1] ,	_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		Optional[Any]		    =   self.model_tester.prepare_config_and_inputs()
			self.model_tester.create_and_check_model(*_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    ,     __lowerCAmelCase    :		List[str]		    =   self.model_tester.prepare_config_and_inputs_for_common()

			for model_class in self.all_model_classes:
				__lowerCAmelCase    :		Union[str, Any]		    =   model_class(config=_SCREAMING_SNAKE_CASE				)
				for name, module in model.named_modules():
					if isinstance(_SCREAMING_SNAKE_CASE ,	(nn.BatchNormad, nn.GroupNorm)				):
						self.assertTrue(
						    torch.all(module.weight == 1				) ,	msg=f"Parameter {name} of model {model_class} seems not properly initialized" ,	)
						self.assertTrue(
						    torch.all(module.bias == 0				) ,	msg=f"Parameter {name} of model {model_class} seems not properly initialized" ,	)

		def 							__lowerCamelCase							(   self				):
			def check_hidden_states_output(_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				):
				__lowerCAmelCase    :		Any		    =   model_class(_SCREAMING_SNAKE_CASE				)
				model.to(_SCREAMING_SNAKE_CASE				)
				model.eval()

				with torch.no_grad():
					__lowerCAmelCase    :		List[str]		    =   model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				)				)

				__lowerCAmelCase    :		Any		    =   outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

				__lowerCAmelCase    :		List[str]		    =   self.model_tester.num_stages
				self.assertEqual(len(_SCREAMING_SNAKE_CASE				) ,	expected_num_stages + 1				)

				# RegNet'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 // 2, self.model_tester.image_size // 2] ,	)

			__lowerCAmelCase    ,     __lowerCAmelCase    :		Dict		    =   self.model_tester.prepare_config_and_inputs_for_common()
			__lowerCAmelCase    :		List[Any]		    =   ['basic', 'bottleneck']
			for model_class in self.all_model_classes:
				for layer_type in layers_type:
					__lowerCAmelCase    :		List[Any]		    =   layer_type
					__lowerCAmelCase    :		Tuple		    =   True
					check_hidden_states_output(_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				)

					# check that output_hidden_states also work using config
					del inputs_dict["output_hidden_states"]
					__lowerCAmelCase    :		Dict		    =   True

					check_hidden_states_output(_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE ,	_SCREAMING_SNAKE_CASE				)

		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		List[Any]		    =   self.model_tester.prepare_config_and_inputs()
			self.model_tester.create_and_check_for_image_classification(*_SCREAMING_SNAKE_CASE				)







		@slow
		def 							__lowerCamelCase							(   self				):
			for model_name in REGNET_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
				__lowerCAmelCase    :		Dict		    =   RegNetModel.from_pretrained(_SCREAMING_SNAKE_CASE				)
				self.assertIsNotNone(_SCREAMING_SNAKE_CASE				)



def 					__lowerCAmelCase       ():
	__lowerCAmelCase    :		str		    =   Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'	)
	return image




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

		@cached_property
		def 							__lowerCamelCase							(   self				):
			return (
			    AutoImageProcessor.from_pretrained(REGNET_PRETRAINED_MODEL_ARCHIVE_LIST[0]				)
			    if is_vision_available()
			    else None
			)







		@slow
		def 							__lowerCamelCase							(   self				):
			__lowerCAmelCase    :		List[str]		    =   RegNetForImageClassification.from_pretrained(REGNET_PRETRAINED_MODEL_ARCHIVE_LIST[0]				).to(_SCREAMING_SNAKE_CASE				)

			__lowerCAmelCase    :		str		    =   self.default_image_processor
			__lowerCAmelCase    :		Any		    =   prepare_img()
			__lowerCAmelCase    :		Any		    =   image_processor(images=_SCREAMING_SNAKE_CASE ,	return_tensors='pt'				).to(_SCREAMING_SNAKE_CASE				)

			# forward pass
			with torch.no_grad():
				__lowerCAmelCase    :		List[str]		    =   model(**_SCREAMING_SNAKE_CASE				)

			# verify the logits
			__lowerCAmelCase    :		Union[str, Any]		    =   torch.Size((1, 10_00)				)
			self.assertEqual(outputs.logits.shape ,	_SCREAMING_SNAKE_CASE				)

			__lowerCAmelCase    :		Optional[int]		    =   torch.tensor([-0.4180, -1.5051, -3.4836]				).to(_SCREAMING_SNAKE_CASE				)

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