import unittest

from transformers import GPTNeoXJapaneseConfig, is_torch_available
from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer
from transformers.testing_utils import require_torch, slow, torch_device

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


if is_torch_available():
				import torch

				from transformers import GPTNeoXJapaneseForCausalLM, GPTNeoXJapaneseModel



class        lowerCamelCase__				:





			def __init__(       self	:	str  ,  lowercase__	:	Optional[Any]  ,  lowercase__	:	Any=13  ,  lowercase__	:	int=7  ,  lowercase__	:	Any=True  ,  lowercase__	:	int=True  ,  lowercase__	:	Optional[Any]=True  ,  lowercase__	:	List[Any]=True  ,  lowercase__	:	List[str]=99  ,  lowercase__	:	Dict=32  ,  lowercase__	:	str=5  ,  lowercase__	:	int=4  ,  lowercase__	:	str=4  ,  lowercase__	:	Dict="gelu"  ,  lowercase__	:	str=0.0  ,  lowercase__	:	str=0.1  ,  lowercase__	:	Optional[Any]=True  ,  lowercase__	:	Optional[int]=5_12  ,  lowercase__	:	List[str]=16  ,  lowercase__	:	List[str]=2  ,  lowercase__	:	Any=0.0_2  ,  lowercase__	:	Tuple=3  ,  lowercase__	:	Optional[int]=4  ,  lowercase__	:	str=None  ,  ):
										_lowerCAmelCase							=							parent
										_lowerCAmelCase							=							batch_size
										_lowerCAmelCase							=							seq_length
										_lowerCAmelCase							=							is_training
										_lowerCAmelCase							=							use_input_mask
										_lowerCAmelCase							=							use_token_type_ids
										_lowerCAmelCase							=							use_labels
										_lowerCAmelCase							=							vocab_size
										_lowerCAmelCase							=							hidden_size
										_lowerCAmelCase							=							num_hidden_layers
										_lowerCAmelCase							=							num_attention_heads
										_lowerCAmelCase							=							intermediate_multiple_size
										_lowerCAmelCase							=							hidden_act
										_lowerCAmelCase							=							hidden_dropout
										_lowerCAmelCase							=							attention_dropout
										_lowerCAmelCase							=							weight_tying
										_lowerCAmelCase							=							max_position_embeddings
										_lowerCAmelCase							=							type_vocab_size
										_lowerCAmelCase							=							type_sequence_label_size
										_lowerCAmelCase							=							initializer_range
										_lowerCAmelCase							=							num_labels
										_lowerCAmelCase							=							num_choices
										_lowerCAmelCase							=							scope





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										_lowerCAmelCase							=							ids_tensor([self.batch_size, self.seq_length]  ,  self.vocab_size						)

										_lowerCAmelCase							=							None
										if self.use_input_mask:
																	_lowerCAmelCase							=							random_attention_mask([self.batch_size, self.seq_length]						)

										_lowerCAmelCase							=							None
										if self.use_labels:
																	_lowerCAmelCase							=							ids_tensor([self.batch_size, self.seq_length]  ,  self.num_labels						)

										_lowerCAmelCase							=							self.get_config()

										return config, input_ids, input_mask, token_labels





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										return GPTNeoXJapaneseConfig(
										    vocab_size=self.vocab_size  ,  hidden_size=self.hidden_size  ,  num_hidden_layers=self.num_hidden_layers  ,  num_attention_heads=self.num_attention_heads  ,  intermediate_multiple_size=self.intermediate_multiple_size  ,  hidden_act=self.hidden_act  ,  hidden_dropout=self.hidden_dropout  ,  attention_dropout=self.attention_dropout  ,  weight_tying=self.weight_tying  ,  max_position_embeddings=self.max_position_embeddings  ,  type_vocab_size=self.type_vocab_size  ,  is_decoder=lowercase__  ,  initializer_range=self.initializer_range  ,  )





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[str]						):
										_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase							=							self.prepare_config_and_inputs()

										_lowerCAmelCase							=							True

										return config, input_ids, input_mask, token_labels





			def   SCREAMING_SNAKE_CASE__     (       self	:	int  ,  lowercase__	:	List[str]  ,  lowercase__	:	List[Any]  ,  lowercase__	:	str						):
										_lowerCAmelCase							=							GPTNeoXJapaneseModel(config=lowercase__						)
										model.to(lowercase__						)
										model.eval()
										_lowerCAmelCase							=							model(lowercase__  ,  attention_mask=lowercase__						)
										_lowerCAmelCase							=							model(lowercase__						)
										self.parent.assertEqual(result.last_hidden_state.shape  ,  (self.batch_size, self.seq_length, self.hidden_size)						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Union[str, Any]  ,  lowercase__	:	Optional[int]  ,  lowercase__	:	Dict  ,  lowercase__	:	Optional[Any]						):
										_lowerCAmelCase							=							True
										_lowerCAmelCase							=							GPTNeoXJapaneseModel(lowercase__						)
										model.to(lowercase__						)
										model.eval()
										_lowerCAmelCase							=							model(lowercase__  ,  attention_mask=lowercase__						)
										self.parent.assertEqual(result.last_hidden_state.shape  ,  (self.batch_size, self.seq_length, self.hidden_size)						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	int  ,  lowercase__	:	Dict  ,  lowercase__	:	int  ,  lowercase__	:	List[Any]  ,  lowercase__	:	List[Any]						):
										_lowerCAmelCase							=							GPTNeoXJapaneseForCausalLM(config=lowercase__						)
										model.to(lowercase__						)
										model.eval()
										_lowerCAmelCase							=							model(lowercase__  ,  attention_mask=lowercase__  ,  labels=lowercase__						)
										self.parent.assertEqual(result.logits.shape  ,  (self.batch_size, self.seq_length, self.vocab_size)						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	str  ,  lowercase__	:	Optional[Any]  ,  lowercase__	:	Tuple  ,  lowercase__	:	Optional[Any]						):
										_lowerCAmelCase							=							True
										_lowerCAmelCase							=							GPTNeoXJapaneseForCausalLM(config=lowercase__						)
										model.to(lowercase__						)
										model.eval()

										# first forward pass
										_lowerCAmelCase							=							model(lowercase__  ,  attention_mask=lowercase__  ,  use_cache=lowercase__						)
										_lowerCAmelCase							=							outputs.past_key_values

										# create hypothetical multiple next token and extent to next_input_ids
										_lowerCAmelCase							=							ids_tensor((self.batch_size, 3)  ,  config.vocab_size						)
										_lowerCAmelCase							=							ids_tensor((self.batch_size, 3)  ,  vocab_size=2						)

										# append to next input_ids and
										_lowerCAmelCase							=							torch.cat([input_ids, next_tokens]  ,  dim=-1						)
										_lowerCAmelCase							=							torch.cat([input_mask, next_mask]  ,  dim=-1						)

										_lowerCAmelCase							=							model(lowercase__  ,  attention_mask=lowercase__  ,  output_hidden_states=lowercase__						)
										_lowerCAmelCase							=							output_from_no_past['hidden_states'][0]
										_lowerCAmelCase							=							model(
										    lowercase__  ,  attention_mask=lowercase__  ,  past_key_values=lowercase__  ,  output_hidden_states=lowercase__  ,  )['hidden_states'][0]

										# select random slice
										_lowerCAmelCase							=							ids_tensor((1,)  ,  output_from_past.shape[-1]						).item()
										_lowerCAmelCase							=							output_from_no_past[:, -3:, random_slice_idx].detach()
										_lowerCAmelCase							=							output_from_past[:, :, random_slice_idx].detach()

										self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]						)

										# test that outputs are equal for slice
										self.parent.assertTrue(torch.allclose(lowercase__  ,  lowercase__  ,  atol=1e-3						)						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Optional[int]						):
										_lowerCAmelCase							=							self.prepare_config_and_inputs()
										_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase							=							config_and_inputs
										_lowerCAmelCase							=							{'input_ids': input_ids, 'attention_mask': input_mask}
										return config, inputs_dict







@require_torch
class        lowerCamelCase__				(   UpperCAmelCase       ,UpperCAmelCase       ,unittest.TestCase				):
			UpperCamelCase__    							=(GPTNeoXJapaneseModel, GPTNeoXJapaneseForCausalLM) if is_torch_available() else ()
			UpperCamelCase__    							=(GPTNeoXJapaneseForCausalLM,) if is_torch_available() else ()
			UpperCamelCase__    							=(
			    {"feature-extraction": GPTNeoXJapaneseModel, "text-generation": GPTNeoXJapaneseForCausalLM}
			    if is_torch_available()
			    else {}
			)
			UpperCamelCase__    							=False
			UpperCamelCase__    							=False
			UpperCamelCase__    							=False
			UpperCamelCase__    							=False





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										_lowerCAmelCase							=							GPTNeoXJapaneseModelTester(self						)
										_lowerCAmelCase							=							ConfigTester(self  ,  config_class=lowercase__  ,  hidden_size=37						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	str						):
										self.config_tester.run_common_tests()





			def   SCREAMING_SNAKE_CASE__     (       self	:	int						):
										_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase							=							self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_model(lowercase__  ,  lowercase__  ,  lowercase__						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Any						):
										_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase							=							self.model_tester.prepare_config_and_inputs_for_decoder()
										self.model_tester.create_and_check_model_as_decoder(lowercase__  ,  lowercase__  ,  lowercase__						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										# This regression test was failing with PyTorch < 1.3
										_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase							=							self.model_tester.prepare_config_and_inputs_for_decoder()

										_lowerCAmelCase							=							None

										self.model_tester.create_and_check_model_as_decoder(lowercase__  ,  lowercase__  ,  lowercase__						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase			,		_lowerCAmelCase							=							self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_decoder_model_past_large_inputs(lowercase__  ,  lowercase__  ,  lowercase__						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Optional[Any]						):
										_lowerCAmelCase							=							self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_for_causal_lm(*lowercase__						)





			@slow
			def   SCREAMING_SNAKE_CASE__     (       self	:	Tuple						):
										_lowerCAmelCase							=							'abeja/gpt-neox-japanese-2.7b'

										_lowerCAmelCase							=							['データサイエンティストとは、', '100年後に必要とされる会社は、', 'フルリモートの環境で働くために必要なことは、', '国境の長いトンネルを抜けると', '美味しい日本食といえば、']

										_lowerCAmelCase							=							[
										    'データサイエンティストとは、データを分析し、ビジネスに役立つ知見を導き出す専門家のことです。',
										    '100年後に必要とされる会社は、「人」が中心の会社です。',
										    'フルリモートの環境で働くために必要なことは、「自分の時間をコントロールする」ことです。',
										    '国境の長いトンネルを抜けると、そこは雪国だった。',
										    '美味しい日本食といえば、やっぱりお寿司ですよね。',
										]

										_lowerCAmelCase							=							GPTNeoXJapaneseTokenizer.from_pretrained(lowercase__						)
										_lowerCAmelCase							=							GPTNeoXJapaneseForCausalLM.from_pretrained(lowercase__						)

										_lowerCAmelCase							=							[]
										for prompt in prompts:
																	_lowerCAmelCase							=							tokenizer(lowercase__  ,  return_tensors='pt'						).input_ids
																	_lowerCAmelCase							=							model.generate(lowercase__  ,  max_length=50						)
																	_lowerCAmelCase							=							tokenizer.batch_decode(lowercase__  ,  skip_special_tokens=lowercase__						)
																	predicted_outputs += generated_string
										self.assertListEqual(lowercase__  ,  lowercase__						)







import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin


if is_torch_available():
				import torch

if is_vision_available():
				from PIL import Image

				from transformers import ChineseCLIPImageProcessor



class        lowerCamelCase__				(   unittest.TestCase				):





			def __init__(       self	:	List[str]  ,  lowercase__	:	Any  ,  lowercase__	:	List[Any]=7  ,  lowercase__	:	List[str]=3  ,  lowercase__	:	str=18  ,  lowercase__	:	List[Any]=30  ,  lowercase__	:	Optional[int]=4_00  ,  lowercase__	:	Dict=True  ,  lowercase__	:	List[str]=None  ,  lowercase__	:	int=True  ,  lowercase__	:	Tuple=None  ,  lowercase__	:	int=True  ,  lowercase__	:	Tuple=[0.4_8_1_4_5_4_6_6, 0.4_5_7_8_2_7_5, 0.4_0_8_2_1_0_7_3]  ,  lowercase__	:	Optional[int]=[0.2_6_8_6_2_9_5_4, 0.2_6_1_3_0_2_5_8, 0.2_7_5_7_7_7_1_1]  ,  lowercase__	:	Any=True  ,  ):
										_lowerCAmelCase							=							size if size is not None else {'height': 2_24, 'width': 2_24}
										_lowerCAmelCase							=							crop_size if crop_size is not None else {'height': 18, 'width': 18}
										_lowerCAmelCase							=							parent
										_lowerCAmelCase							=							batch_size
										_lowerCAmelCase							=							num_channels
										_lowerCAmelCase							=							image_size
										_lowerCAmelCase							=							min_resolution
										_lowerCAmelCase							=							max_resolution
										_lowerCAmelCase							=							do_resize
										_lowerCAmelCase							=							size
										_lowerCAmelCase							=							do_center_crop
										_lowerCAmelCase							=							crop_size
										_lowerCAmelCase							=							do_normalize
										_lowerCAmelCase							=							image_mean
										_lowerCAmelCase							=							image_std
										_lowerCAmelCase							=							do_convert_rgb





			def   SCREAMING_SNAKE_CASE__     (       self	:	Optional[Any]						):
										return {
										    "do_resize": self.do_resize,
										    "size": self.size,
										    "do_center_crop": self.do_center_crop,
										    "crop_size": self.crop_size,
										    "do_normalize": self.do_normalize,
										    "image_mean": self.image_mean,
										    "image_std": self.image_std,
										    "do_convert_rgb": self.do_convert_rgb,
										}





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[str]  ,  lowercase__	:	Tuple=False  ,  lowercase__	:	List[Any]=False  ,  lowercase__	:	str=False						):
										assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

										if equal_resolution:
																	_lowerCAmelCase							=							[]
																	for i in range(self.batch_size						):
																								image_inputs.append(
																								    np.random.randint(
																								        2_55  ,  size=(self.num_channels, self.max_resolution, self.max_resolution)  ,  dtype=np.uinta						)						)
										else:
																	_lowerCAmelCase							=							[]
																	for i in range(self.batch_size						):
																								_lowerCAmelCase			,		_lowerCAmelCase							=							np.random.choice(np.arange(self.min_resolution  ,  self.max_resolution						)  ,  2						)
																								image_inputs.append(np.random.randint(2_55  ,  size=(self.num_channels, width, height)  ,  dtype=np.uinta						)						)

										if not numpify and not torchify:
																	# PIL expects the channel dimension as last dimension
																	_lowerCAmelCase							=							[Image.fromarray(np.moveaxis(lowercase__  ,  0  ,  -1						)						) for x in image_inputs]

										if torchify:
																	_lowerCAmelCase							=							[torch.from_numpy(lowercase__						) for x in image_inputs]

										return image_inputs







@require_torch
@require_vision
class        lowerCamelCase__				(   UpperCAmelCase       ,unittest.TestCase				):
			UpperCamelCase__    							=ChineseCLIPImageProcessor if is_vision_available() else None





			def   SCREAMING_SNAKE_CASE__     (       self	:	Tuple						):
										_lowerCAmelCase							=							ChineseCLIPImageProcessingTester(self  ,  do_center_crop=lowercase__						)





			@property
			def   SCREAMING_SNAKE_CASE__     (       self	:	Any						):
										return self.image_processor_tester.prepare_image_processor_dict()





			def   SCREAMING_SNAKE_CASE__     (       self	:	Tuple						):
										_lowerCAmelCase							=							self.image_processing_class(**self.image_processor_dict						)
										self.assertTrue(hasattr(lowercase__  ,  'do_resize'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'size'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'do_center_crop'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'center_crop'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'do_normalize'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'image_mean'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'image_std'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'do_convert_rgb'						)						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Union[str, Any]						):
										_lowerCAmelCase							=							self.image_processing_class.from_dict(self.image_processor_dict						)
										self.assertEqual(image_processor.size  ,  {'height': 2_24, 'width': 2_24}						)
										self.assertEqual(image_processor.crop_size  ,  {'height': 18, 'width': 18}						)

										_lowerCAmelCase							=							self.image_processing_class.from_dict(self.image_processor_dict  ,  size=42  ,  crop_size=84						)
										self.assertEqual(image_processor.size  ,  {'shortest_edge': 42}						)
										self.assertEqual(image_processor.crop_size  ,  {'height': 84, 'width': 84}						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										pass





			def   SCREAMING_SNAKE_CASE__     (       self	:	str						):
										# Initialize image_processing
										_lowerCAmelCase							=							self.image_processing_class(**self.image_processor_dict						)
										# create random PIL images
										_lowerCAmelCase							=							self.image_processor_tester.prepare_inputs(equal_resolution=lowercase__						)
										for image in image_inputs:
																	self.assertIsInstance(lowercase__  ,  Image.Image						)

										# Test not batched input
										_lowerCAmelCase							=							image_processing(image_inputs[0]  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        1,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )

										# Test batched
										_lowerCAmelCase							=							image_processing(lowercase__  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )





			def   SCREAMING_SNAKE_CASE__     (       self	:	Any						):
										# Initialize image_processing
										_lowerCAmelCase							=							self.image_processing_class(**self.image_processor_dict						)
										# create random numpy tensors
										_lowerCAmelCase							=							self.image_processor_tester.prepare_inputs(equal_resolution=lowercase__  ,  numpify=lowercase__						)
										for image in image_inputs:
																	self.assertIsInstance(lowercase__  ,  np.ndarray						)

										# Test not batched input
										_lowerCAmelCase							=							image_processing(image_inputs[0]  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        1,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )

										# Test batched
										_lowerCAmelCase							=							image_processing(lowercase__  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )





			def   SCREAMING_SNAKE_CASE__     (       self	:	int						):
										# Initialize image_processing
										_lowerCAmelCase							=							self.image_processing_class(**self.image_processor_dict						)
										# create random PyTorch tensors
										_lowerCAmelCase							=							self.image_processor_tester.prepare_inputs(equal_resolution=lowercase__  ,  torchify=lowercase__						)
										for image in image_inputs:
																	self.assertIsInstance(lowercase__  ,  torch.Tensor						)

										# Test not batched input
										_lowerCAmelCase							=							image_processing(image_inputs[0]  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        1,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )

										# Test batched
										_lowerCAmelCase							=							image_processing(lowercase__  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )







@require_torch
@require_vision
class        lowerCamelCase__				(   UpperCAmelCase       ,unittest.TestCase				):
			UpperCamelCase__    							=ChineseCLIPImageProcessor if is_vision_available() else None





			def   SCREAMING_SNAKE_CASE__     (       self	:	Optional[Any]						):
										_lowerCAmelCase							=							ChineseCLIPImageProcessingTester(self  ,  num_channels=4  ,  do_center_crop=lowercase__						)
										_lowerCAmelCase							=							3





			@property
			def   SCREAMING_SNAKE_CASE__     (       self	:	Tuple						):
										return self.image_processor_tester.prepare_image_processor_dict()





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[Any]						):
										_lowerCAmelCase							=							self.image_processing_class(**self.image_processor_dict						)
										self.assertTrue(hasattr(lowercase__  ,  'do_resize'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'size'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'do_center_crop'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'center_crop'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'do_normalize'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'image_mean'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'image_std'						)						)
										self.assertTrue(hasattr(lowercase__  ,  'do_convert_rgb'						)						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Union[str, Any]						):
										pass





			def   SCREAMING_SNAKE_CASE__     (       self	:	Dict						):
										# Initialize image_processing
										_lowerCAmelCase							=							self.image_processing_class(**self.image_processor_dict						)
										# create random PIL images
										_lowerCAmelCase							=							self.image_processor_tester.prepare_inputs(equal_resolution=lowercase__						)
										for image in image_inputs:
																	self.assertIsInstance(lowercase__  ,  Image.Image						)

										# Test not batched input
										_lowerCAmelCase							=							image_processing(image_inputs[0]  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        1,
										        self.expected_encoded_image_num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )

										# Test batched
										_lowerCAmelCase							=							image_processing(lowercase__  ,  return_tensors='pt'						).pixel_values
										self.assertEqual(
										    encoded_images.shape  ,  (
										        self.image_processor_tester.batch_size,
										        self.expected_encoded_image_num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )  ,  )






