



"""simple docstring"""


import copy
import inspect
import unittest

import numpy as np
from huggingface_hub import hf_hub_download

from transformers import TimesformerConfig
from transformers.models.auto import get_values
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 (
				    MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
				    TimesformerForVideoClassification,
				    TimesformerModel,
				)
				from transformers.models.timesformer.modeling_timesformer import TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
				from transformers import VideoMAEImageProcessor







class       A_			:



						"""simple docstring"""






						def __init__(					self :Union[str, Any]   ,  lowercase_ :str   ,  lowercase_ :Tuple=13   ,  lowercase_ :Any=10   ,  lowercase_ :int=3   ,  lowercase_ :List[Any]=2   ,  lowercase_ :str=2   ,  lowercase_ :Optional[int]=True   ,  lowercase_ :List[Any]=True   ,  lowercase_ :List[str]=32   ,  lowercase_ :Tuple=5   ,  lowercase_ :Tuple=4   ,  lowercase_ :Union[str, Any]=37   ,  lowercase_ :List[str]="gelu"   ,  lowercase_ :Optional[int]=0.1   ,  lowercase_ :List[Any]=0.1   ,  lowercase_ :Union[str, Any]=10   ,  lowercase_ :Tuple=0.02   ,  lowercase_ :List[str]="divided_space_time"   ,  lowercase_ :List[str]=None   ,  )				->			Union[str, Any]:
												UpperCAmelCase             = parent
												UpperCAmelCase             = batch_size
												UpperCAmelCase             = image_size
												UpperCAmelCase             = num_channels
												UpperCAmelCase             = patch_size
												UpperCAmelCase             = num_frames
												UpperCAmelCase             = is_training
												UpperCAmelCase             = use_labels
												UpperCAmelCase             = hidden_size
												UpperCAmelCase             = num_hidden_layers
												UpperCAmelCase             = num_attention_heads
												UpperCAmelCase             = intermediate_size
												UpperCAmelCase             = hidden_act
												UpperCAmelCase             = hidden_dropout_prob
												UpperCAmelCase             = attention_probs_dropout_prob
												UpperCAmelCase             = attention_type
												UpperCAmelCase             = initializer_range
												UpperCAmelCase             = scope
												UpperCAmelCase             = num_labels

												# in TimeSformer, the number of spatial tokens equals num_frames * num_patches per frame + 1 CLS token
												UpperCAmelCase             = (image_size // patch_size) ** 2
												UpperCAmelCase             = (num_frames) * self.num_patches_per_frame + 1






						def 	UpperCAmelCase__     (					self :Optional[Any]					)				->			Dict:
												UpperCAmelCase             = floats_tensor(
												    [self.batch_size, self.num_frames, self.num_channels, self.image_size, self.image_size]					)

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

												UpperCAmelCase             = self.get_config()

												return config, pixel_values, labels






						def 	UpperCAmelCase__     (					self :Optional[Any]					)				->			Any:
												UpperCAmelCase             = TimesformerConfig(
												    image_size=self.image_size   ,  patch_size=self.patch_size   ,  num_channels=self.num_channels   ,  num_frames=self.num_frames   ,  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   ,  initializer_range=self.initializer_range   ,  attention_type=self.attention_type   ,  )
												UpperCAmelCase             = self.num_labels
												return config






						def 	UpperCAmelCase__     (					self :Optional[Any]   ,  lowercase_ :Optional[int]   ,  lowercase_ :int   ,  lowercase_ :Union[str, Any]					)				->			int:
												UpperCAmelCase             = TimesformerModel(config=lowercase_					)
												model.to(lowercase_					)
												model.eval()
												UpperCAmelCase             = model(lowercase_					)
												self.parent.assertEqual(result.last_hidden_state.shape   ,  (self.batch_size, self.seq_length, self.hidden_size)					)






						def 	UpperCAmelCase__     (					self :Union[str, Any]   ,  lowercase_ :List[str]   ,  lowercase_ :Optional[Any]   ,  lowercase_ :Tuple					)				->			List[Any]:
												UpperCAmelCase             = TimesformerForVideoClassification(lowercase_					)
												model.to(lowercase_					)
												model.eval()

												UpperCAmelCase             = model(lowercase_					)

												# verify the logits shape
												UpperCAmelCase             = torch.Size((self.batch_size, self.num_labels)					)
												self.parent.assertEqual(result.logits.shape   ,  lowercase_					)






						def 	UpperCAmelCase__     (					self :List[Any]					)				->			Dict:
												UpperCAmelCase             = self.prepare_config_and_inputs()
												UpperCAmelCase      ,    UpperCAmelCase      ,    UpperCAmelCase             = config_and_inputs
												UpperCAmelCase             = {'pixel_values': pixel_values}
												return config, inputs_dict







@require_torch
class       A_			(     SCREAMING_SNAKE_CASE_	,   SCREAMING_SNAKE_CASE_	,   unittest.TestCase				):



						"""simple docstring"""
						__UpperCamelCase						=							(TimesformerModel, TimesformerForVideoClassification) if is_torch_available() else ()
						__UpperCamelCase						=							(
						    {"""feature-extraction""": TimesformerModel, """video-classification""": TimesformerForVideoClassification}
						    if is_torch_available()
						    else {}
						)

						__UpperCamelCase						=							False
						__UpperCamelCase						=							False
						__UpperCamelCase						=							False
						__UpperCamelCase						=							False






						def 	UpperCAmelCase__     (					self :Dict					)				->			Tuple:
												UpperCAmelCase             = TimesformerModelTester(self					)
												UpperCAmelCase             = ConfigTester(
												    self   ,  config_class=lowercase_   ,  has_text_modality=lowercase_   ,  hidden_size=37					)






						def 	UpperCAmelCase__     (					self :str   ,  lowercase_ :Optional[int]   ,  lowercase_ :str   ,  lowercase_ :Dict=False					)				->			int:
												UpperCAmelCase             = copy.deepcopy(lowercase_					)

												if return_labels:
																		if model_class in get_values(lowercase_					):
																								UpperCAmelCase             = torch.zeros(
																								    self.model_tester.batch_size   ,  dtype=torch.long   ,  device=lowercase_					)

												return inputs_dict






						def 	UpperCAmelCase__     (					self :Any					)				->			List[str]:
												self.config_tester.run_common_tests()






						@unittest.skip(reason='TimeSformer does not use inputs_embeds'					)
						def 	UpperCAmelCase__     (					self :Optional[Any]					)				->			Optional[int]:
												pass






						def 	UpperCAmelCase__     (					self :List[Any]					)				->			Union[str, Any]:
												UpperCAmelCase      ,    UpperCAmelCase             = self.model_tester.prepare_config_and_inputs_for_common()

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






						def 	UpperCAmelCase__     (					self :str					)				->			Any:
												UpperCAmelCase      ,    UpperCAmelCase             = self.model_tester.prepare_config_and_inputs_for_common()

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

																		UpperCAmelCase             = ['pixel_values']
																		self.assertListEqual(arg_names[:1]   ,  lowercase_					)






						def 	UpperCAmelCase__     (					self :Optional[int]					)				->			Tuple:
												UpperCAmelCase             = self.model_tester.prepare_config_and_inputs()
												self.model_tester.create_and_check_model(*lowercase_					)






						def 	UpperCAmelCase__     (					self :Optional[int]					)				->			Optional[Any]:
												UpperCAmelCase             = self.model_tester.prepare_config_and_inputs()
												self.model_tester.create_and_check_for_video_classification(*lowercase_					)






						@slow
						def 	UpperCAmelCase__     (					self :Tuple					)				->			Optional[Any]:
												for model_name in TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																		UpperCAmelCase             = TimesformerModel.from_pretrained(lowercase_					)
																		self.assertIsNotNone(lowercase_					)






						def 	UpperCAmelCase__     (					self :Any					)				->			Union[str, Any]:
												if not self.has_attentions:
																		pass

												else:
																		UpperCAmelCase      ,    UpperCAmelCase             = self.model_tester.prepare_config_and_inputs_for_common()
																		UpperCAmelCase             = True

																		for model_class in self.all_model_classes:
																								UpperCAmelCase             = self.model_tester.seq_length
																								UpperCAmelCase             = self.model_tester.num_frames

																								UpperCAmelCase             = True
																								UpperCAmelCase             = False
																								UpperCAmelCase             = True
																								UpperCAmelCase             = model_class(lowercase_					)
																								model.to(lowercase_					)
																								model.eval()
																								with torch.no_grad():
																														UpperCAmelCase             = model(**self._prepare_for_class(lowercase_   ,  lowercase_					)					)
																								UpperCAmelCase             = outputs.attentions
																								self.assertEqual(len(lowercase_					)   ,  self.model_tester.num_hidden_layers					)

																								# check that output_attentions also work using config
																								del inputs_dict["output_attentions"]
																								UpperCAmelCase             = True
																								UpperCAmelCase             = model_class(lowercase_					)
																								model.to(lowercase_					)
																								model.eval()
																								with torch.no_grad():
																														UpperCAmelCase             = model(**self._prepare_for_class(lowercase_   ,  lowercase_					)					)
																								UpperCAmelCase             = outputs.attentions
																								self.assertEqual(len(lowercase_					)   ,  self.model_tester.num_hidden_layers					)

																								# attentions has shape (batch_size x num_frames) x num_heads x (num_patches per frame + 1) x (num_patches per frame + 1)
																								self.assertListEqual(
																								    list(attentions[0].shape[-3:]					)   ,  [self.model_tester.num_attention_heads, seq_len // num_frames + 1, seq_len // num_frames + 1]   ,  )
																								UpperCAmelCase             = len(lowercase_					)

																								# Check attention is always last and order is fine
																								UpperCAmelCase             = True
																								UpperCAmelCase             = True
																								UpperCAmelCase             = model_class(lowercase_					)
																								model.to(lowercase_					)
																								model.eval()
																								with torch.no_grad():
																														UpperCAmelCase             = model(**self._prepare_for_class(lowercase_   ,  lowercase_					)					)

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

																								UpperCAmelCase             = outputs.attentions

																								self.assertEqual(len(lowercase_					)   ,  self.model_tester.num_hidden_layers					)

																								# attentions has shape (batch_size x num_frames) x num_heads x (num_patches per frame + 1) x (num_patches per frame + 1)
																								self.assertListEqual(
																								    list(self_attentions[0].shape[-3:]					)   ,  [self.model_tester.num_attention_heads, seq_len // num_frames + 1, seq_len // num_frames + 1]   ,  )






						def 	UpperCAmelCase__     (					self :Dict					)				->			List[Any]:
												def check_hidden_states_output(lowercase_ :List[str]   ,  lowercase_ :Optional[Any]   ,  lowercase_ :Any					):
																		UpperCAmelCase             = model_class(lowercase_					)
																		model.to(lowercase_					)
																		model.eval()

																		with torch.no_grad():
																								UpperCAmelCase             = model(**self._prepare_for_class(lowercase_   ,  lowercase_					)					)

																		UpperCAmelCase             = outputs.hidden_states
																		UpperCAmelCase             = self.model_tester.num_hidden_layers + 1
																		self.assertEqual(len(lowercase_					)   ,  lowercase_					)

																		UpperCAmelCase             = self.model_tester.seq_length

																		self.assertListEqual(
																		    list(hidden_states[0].shape[-2:]					)   ,  [seq_length, self.model_tester.hidden_size]   ,  )

												UpperCAmelCase      ,    UpperCAmelCase             = self.model_tester.prepare_config_and_inputs_for_common()

												for model_class in self.all_model_classes:
																		UpperCAmelCase             = True
																		check_hidden_states_output(lowercase_   ,  lowercase_   ,  lowercase_					)

																		# check that output_hidden_states also work using config
																		del inputs_dict["output_hidden_states"]
																		UpperCAmelCase             = True

																		check_hidden_states_output(lowercase_   ,  lowercase_   ,  lowercase_					)


def  _lowerCAmelCase      (   ):
						UpperCAmelCase             = hf_hub_download(
						    repo_id='hf-internal-testing/spaghetti-video'		,	filename='eating_spaghetti.npy'		,	repo_type='dataset'						)
						UpperCAmelCase             = np.load(lowercase_						)
						return list(lowercase_						)







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



						"""simple docstring"""






						@cached_property
						def 	UpperCAmelCase__     (					self :Union[str, Any]					)				->			str:
												# logits were tested with a different mean and std, so we use the same here
												return (
												    VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]   ,  image_std=[0.5, 0.5, 0.5]					)
												    if is_vision_available()
												    else None
												)






						@slow
						def 	UpperCAmelCase__     (					self :Any					)				->			Tuple:
												UpperCAmelCase             = TimesformerForVideoClassification.from_pretrained('facebook/timesformer-base-finetuned-k400'					).to(
												    lowercase_					)

												UpperCAmelCase             = self.default_image_processor
												UpperCAmelCase             = prepare_video()
												UpperCAmelCase             = image_processor(video[:8]   ,  return_tensors='pt'					).to(lowercase_					)

												# forward pass
												with torch.no_grad():
																		UpperCAmelCase             = model(**lowercase_					)

												# verify the logits
												UpperCAmelCase             = torch.Size((1, 4_00)					)
												self.assertEqual(outputs.logits.shape   ,  lowercase_					)

												UpperCAmelCase             = torch.tensor([-0.3016, -0.7713, -0.4205]					).to(lowercase_					)

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













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  UpperCamelCase_      :



	'''simple docstring'''




	def __init__(       self       ,			a       ,			a=13       ,			a=7       ,			a=True       ,			a=True       ,			a=True       ,			a=True       ,			a=99       ,			a=32       ,			a=5       ,			a=4       ,			a=4       ,			a="gelu"       ,			a=0.0       ,			a=0.1       ,			a=True       ,			a=5_12       ,			a=16       ,			a=2       ,			a=0.02       ,			a=3       ,			a=4       ,			a=None       ,			)       ->    Optional[Any]:
								snake_case_				=							parent
								snake_case_				=							batch_size
								snake_case_				=							seq_length
								snake_case_				=							is_training
								snake_case_				=							use_input_mask
								snake_case_				=							use_token_type_ids
								snake_case_				=							use_labels
								snake_case_				=							vocab_size
								snake_case_				=							hidden_size
								snake_case_				=							num_hidden_layers
								snake_case_				=							num_attention_heads
								snake_case_				=							intermediate_multiple_size
								snake_case_				=							hidden_act
								snake_case_				=							hidden_dropout
								snake_case_				=							attention_dropout
								snake_case_				=							weight_tying
								snake_case_				=							max_position_embeddings
								snake_case_				=							type_vocab_size
								snake_case_				=							type_sequence_label_size
								snake_case_				=							initializer_range
								snake_case_				=							num_labels
								snake_case_				=							num_choices
								snake_case_				=							scope




	def 							_UpperCamelCase			(       self					)       ->    List[Any]:
								snake_case_				=							ids_tensor([self.batch_size, self.seq_length]       ,			self.vocab_size					)

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

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

								snake_case_				=							self.get_config()

								return config, input_ids, input_mask, token_labels




	def 							_UpperCamelCase			(       self					)       ->    Dict:
								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=a       ,			initializer_range=self.initializer_range       ,			)




	def 							_UpperCamelCase			(       self					)       ->    int:
								snake_case_			,		snake_case_			,		snake_case_			,		snake_case_				=							self.prepare_config_and_inputs()

								snake_case_				=							True

								return config, input_ids, input_mask, token_labels




	def 							_UpperCamelCase			(       self       ,			a       ,			a       ,			a					)       ->    Any:
								snake_case_				=							GPTNeoXJapaneseModel(config=a					)
								model.to(a					)
								model.eval()
								snake_case_				=							model(a       ,			attention_mask=a					)
								snake_case_				=							model(a					)
								self.parent.assertEqual(result.last_hidden_state.shape       ,			(self.batch_size, self.seq_length, self.hidden_size)					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a       ,			a					)       ->    Union[str, Any]:
								snake_case_				=							True
								snake_case_				=							GPTNeoXJapaneseModel(a					)
								model.to(a					)
								model.eval()
								snake_case_				=							model(a       ,			attention_mask=a					)
								self.parent.assertEqual(result.last_hidden_state.shape       ,			(self.batch_size, self.seq_length, self.hidden_size)					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a       ,			a       ,			a					)       ->    int:
								snake_case_				=							GPTNeoXJapaneseForCausalLM(config=a					)
								model.to(a					)
								model.eval()
								snake_case_				=							model(a       ,			attention_mask=a       ,			labels=a					)
								self.parent.assertEqual(result.logits.shape       ,			(self.batch_size, self.seq_length, self.vocab_size)					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a       ,			a					)       ->    Tuple:
								snake_case_				=							True
								snake_case_				=							GPTNeoXJapaneseForCausalLM(config=a					)
								model.to(a					)
								model.eval()

								# first forward pass
								snake_case_				=							model(a       ,			attention_mask=a       ,			use_cache=a					)
								snake_case_				=							outputs.past_key_values

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

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

								snake_case_				=							model(a       ,			attention_mask=a       ,			output_hidden_states=a					)
								snake_case_				=							output_from_no_past['hidden_states'][0]
								snake_case_				=							model(
								    a       ,			attention_mask=a       ,			past_key_values=a       ,			output_hidden_states=a       ,			)['hidden_states'][0]

								# select random slice
								snake_case_				=							ids_tensor((1,)       ,			output_from_past.shape[-1]					).item()
								snake_case_				=							output_from_no_past[:, -3:, random_slice_idx].detach()
								snake_case_				=							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(a       ,			a       ,			atol=1E-3					)					)






	def 							_UpperCamelCase			(       self					)       ->    Dict:
								snake_case_				=							self.prepare_config_and_inputs()
								snake_case_			,		snake_case_			,		snake_case_			,		snake_case_				=							config_and_inputs
								snake_case_				=							{'input_ids': input_ids, 'attention_mask': input_mask}
								return config, inputs_dict






@require_torch
class  UpperCamelCase_      (			snake_case_       ,					snake_case_       ,					unittest.TestCase				):



	'''simple docstring'''




	lowerCAmelCase													= (GPTNeoXJapaneseModel, GPTNeoXJapaneseForCausalLM) if is_torch_available() else ()
	lowerCAmelCase													= (GPTNeoXJapaneseForCausalLM,) if is_torch_available() else ()
	lowerCAmelCase													= (
	    {'''feature-extraction''': GPTNeoXJapaneseModel, '''text-generation''': GPTNeoXJapaneseForCausalLM}
	    if is_torch_available()
	    else {}
	)
	lowerCAmelCase													= False
	lowerCAmelCase													= False
	lowerCAmelCase													= False
	lowerCAmelCase													= False




	def 							_UpperCamelCase			(       self					)       ->    List[Any]:
								snake_case_				=							GPTNeoXJapaneseModelTester(self					)
								snake_case_				=							ConfigTester(self       ,			config_class=a       ,			hidden_size=37					)




	def 							_UpperCamelCase			(       self					)       ->    str:
								self.config_tester.run_common_tests()




	def 							_UpperCamelCase			(       self					)       ->    Optional[Any]:
								snake_case_			,		snake_case_			,		snake_case_			,		snake_case_				=							self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(a       ,			a       ,			a					)




	def 							_UpperCamelCase			(       self					)       ->    Union[str, Any]:
								snake_case_			,		snake_case_			,		snake_case_			,		snake_case_				=							self.model_tester.prepare_config_and_inputs_for_decoder()
								self.model_tester.create_and_check_model_as_decoder(a       ,			a       ,			a					)




	def 							_UpperCamelCase			(       self					)       ->    Optional[int]:
								# This regression test was failing with PyTorch < 1.3
								snake_case_			,		snake_case_			,		snake_case_			,		snake_case_				=							self.model_tester.prepare_config_and_inputs_for_decoder()

								snake_case_				=							None

								self.model_tester.create_and_check_model_as_decoder(a       ,			a       ,			a					)




	def 							_UpperCamelCase			(       self					)       ->    Dict:
								snake_case_			,		snake_case_			,		snake_case_			,		snake_case_				=							self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_decoder_model_past_large_inputs(a       ,			a       ,			a					)




	def 							_UpperCamelCase			(       self					)       ->    List[Any]:
								snake_case_				=							self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_causal_lm(*a					)






	@slow
	def 							_UpperCamelCase			(       self					)       ->    Any:
								snake_case_				=							'abeja/gpt-neox-japanese-2.7b'

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

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

								snake_case_				=							GPTNeoXJapaneseTokenizer.from_pretrained(a					)
								snake_case_				=							GPTNeoXJapaneseForCausalLM.from_pretrained(a					)

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





