
'''simple docstring'''

import logging
import os

import quant_trainer
import torch
from torch.utils.data import DataLoader

from transformers import Trainer, is_torch_tpu_available
from transformers.trainer_utils import PredictionOutput


UpperCAmelCase__ :			str											=		logging.getLogger(__name__)

if is_torch_tpu_available(check_device=False):
		import torch_xla.core.xla_model as xm
		import torch_xla.debug.metrics as met






class  A  (						SCREAMING_SNAKE_CASE__     ):





	def __init__(       self      :							Dict   ,				*__magic_name__      :							Optional[int]   ,				__magic_name__      :							Dict=None   ,				__magic_name__      :							Union[str, Any]=None   ,				__magic_name__      :							Any=None   ,				**__magic_name__      :							Union[str, Any]				):


				"""simple docstring"""

				super().__init__(*__magic_name__   ,				**__magic_name__				)
				lowerCAmelCase__										=				eval_examples
				lowerCAmelCase__										=				post_process_function
				lowerCAmelCase__										=				quant_trainer_args
				lowerCAmelCase__										=				128  # default number of calibration samples





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Any   ,				__magic_name__      :							int=None				):


				"""simple docstring"""

				if calib_dataset is None and self.calib_dataset is None:
							raise ValueError("Trainer: calibration requires an calib_dataset."				)
				lowerCAmelCase__										=				calib_dataset if calib_dataset is not None else self.calib_dataset

				lowerCAmelCase__										=				self._remove_unused_columns(__magic_name__   ,				description="Calibration"				)

				return DataLoader(
				    __magic_name__   ,				batch_size=self.args.eval_batch_size   ,				collate_fn=self.data_collator   ,				drop_last=self.args.dataloader_drop_last   ,				num_workers=self.args.dataloader_num_workers   ,				pin_memory=self.args.dataloader_pin_memory   ,				shuffle=__magic_name__   ,				)





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Optional[int]   ,				__magic_name__      :							List[Any]=None				):


				"""simple docstring"""

				lowerCAmelCase__										=				self.train_dataset if calib_dataset is None else calib_dataset
				lowerCAmelCase__										=				self.get_calib_dataloader(__magic_name__				)

				lowerCAmelCase__										=				self.model
				quant_trainer.configure_model(__magic_name__   ,				self.quant_trainer_args   ,				calib=__magic_name__				)
				model.eval()
				quant_trainer.enable_calibration(__magic_name__				)

				logger.info("***** Running calibration *****"				)
				logger.info(f"""  Num examples = {self.calib_num}"""				)
				logger.info(f"""  Batch size = {calib_dataloader.batch_size}"""				)

				for step, inputs in enumerate(__magic_name__				):
							# Prediction step
							lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__										=				self.prediction_step(__magic_name__   ,				__magic_name__   ,				prediction_loss_only=__magic_name__				)
							if (step + 1) * calib_dataloader.batch_size >= self.calib_num:
										break

				quant_trainer.finish_calibration(__magic_name__   ,				self.quant_trainer_args				)
				lowerCAmelCase__										=				model





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Union[str, Any]   ,				__magic_name__      :							Optional[Any]=None   ,				__magic_name__      :							Optional[int]=None   ,				__magic_name__      :							Dict=None   ,				__magic_name__      :							str = "eval"				):


				"""simple docstring"""

				lowerCAmelCase__										=				self.eval_dataset if eval_dataset is None else eval_dataset
				lowerCAmelCase__										=				self.get_eval_dataloader(__magic_name__				)
				lowerCAmelCase__										=				self.eval_examples if eval_examples is None else eval_examples

				# Temporarily disable metric computation, we will do it in the loop here.
				lowerCAmelCase__										=				self.compute_metrics
				lowerCAmelCase__										=				None
				lowerCAmelCase__										=				self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
				try:
							lowerCAmelCase__										=				eval_loop(
							    __magic_name__   ,				description="Evaluation"   ,				prediction_loss_only=True if compute_metrics is None else None   ,				ignore_keys=__magic_name__   ,				)
				finally:
							lowerCAmelCase__										=				compute_metrics

				if self.post_process_function is not None and self.compute_metrics is not None:
							lowerCAmelCase__										=				self.post_process_function(__magic_name__   ,				__magic_name__   ,				output.predictions				)
							lowerCAmelCase__										=				self.compute_metrics(__magic_name__				)

							# Prefix all keys with metric_key_prefix + '_'
							for key in list(metrics.keys()				):
										if not key.startswith(f"""{metric_key_prefix}_"""				):
													lowerCAmelCase__										=				metrics.pop(__magic_name__				)

							self.log(__magic_name__				)
				else:
							lowerCAmelCase__										=				{}

				if self.args.tpu_metrics_debug or self.args.debug:
							# tpu-comment: Logging debug metrics for PyTorch/XLA (compile, execute times, ops, etc.)
							xm.master_print(met.metrics_report()				)

				lowerCAmelCase__										=				self.callback_handler.on_evaluate(self.args   ,				self.state   ,				self.control   ,				__magic_name__				)
				return metrics





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Dict   ,				__magic_name__      :							Tuple   ,				__magic_name__      :							Dict   ,				__magic_name__      :							Any=None   ,				__magic_name__      :							str = "test"				):


				"""simple docstring"""

				lowerCAmelCase__										=				self.get_test_dataloader(__magic_name__				)

				# Temporarily disable metric computation, we will do it in the loop here.
				lowerCAmelCase__										=				self.compute_metrics
				lowerCAmelCase__										=				None
				lowerCAmelCase__										=				self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
				try:
							lowerCAmelCase__										=				eval_loop(
							    __magic_name__   ,				description="Prediction"   ,				prediction_loss_only=True if compute_metrics is None else None   ,				ignore_keys=__magic_name__   ,				)
				finally:
							lowerCAmelCase__										=				compute_metrics

				if self.post_process_function is None or self.compute_metrics is None:
							return output

				lowerCAmelCase__										=				self.post_process_function(__magic_name__   ,				__magic_name__   ,				output.predictions   ,				"predict"				)
				lowerCAmelCase__										=				self.compute_metrics(__magic_name__				)

				# Prefix all keys with metric_key_prefix + '_'
				for key in list(metrics.keys()				):
							if not key.startswith(f"""{metric_key_prefix}_"""				):
										lowerCAmelCase__										=				metrics.pop(__magic_name__				)

				return PredictionOutput(predictions=predictions.predictions   ,				label_ids=predictions.label_ids   ,				metrics=__magic_name__				)







	def 				__SCREAMING_SNAKE_CASE	(       self      :							Tuple   ,				__magic_name__      :							Optional[Any]="./"				):


				"""simple docstring"""

				lowerCAmelCase__										=				self.eval_dataset
				lowerCAmelCase__										=				self.get_eval_dataloader(__magic_name__				)

				lowerCAmelCase__										=				next(iter(__magic_name__				)				)

				# saving device - to make it consistent
				lowerCAmelCase__										=				torch.device("cuda" if torch.cuda.is_available() else "cpu"				)

				# convert to tuple
				lowerCAmelCase__										=				tuple(v.to(__magic_name__				) for k, v in batch.items()				)

				logger.info("Converting model to be onnx compatible"				)
				from pytorch_quantization.nn import TensorQuantizer

				lowerCAmelCase__										=				True

				lowerCAmelCase__										=				self.model.to(__magic_name__				)

				model.eval()
				model.float()

				lowerCAmelCase__										=				model.module if hasattr(__magic_name__   ,				"module"				) else model
				quant_trainer.configure_model(__magic_name__   ,				self.quant_trainer_args				)

				lowerCAmelCase__										=				os.path.join(__magic_name__   ,				"model.onnx"				)
				logger.info(f"""exporting model to {output_model_file}"""				)

				lowerCAmelCase__										=				{0: "batch_size", 1: "seq_len"}

				torch.onnx.export(
				    __magic_name__   ,				__magic_name__   ,				__magic_name__   ,				export_params=__magic_name__   ,				opset_version=13   ,				do_constant_folding=__magic_name__   ,				input_names=["input_ids", "attention_mask", "token_type_ids"]   ,				output_names=["output_start_logits", "output_end_logits"]   ,				dynamic_axes={
				        "input_ids": axes,
				        "attention_mask": axes,
				        "token_type_ids": axes,
				        "output_start_logits": axes,
				        "output_end_logits": axes,
				    }   ,				verbose=__magic_name__   ,				)
				logger.info("onnx export finished"				)








'''simple docstring'''

import random
import unittest

import numpy as np

import transformers
from transformers import is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax


if is_flax_available():
							import os

							import jax.numpy as jnp
							from jax import jit

							from transformers import AutoTokenizer, FlaxAutoModelForCausalLM
							from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model

							SCREAMING_SNAKE_CASE							:				List[Any]     	=			"0.12"  # assumed parallelism: 8


if is_torch_available():
							import torch




def 							_UpperCamelCase				(   lowerCAmelCase__:					Dict		,lowerCAmelCase__:					int		,lowerCAmelCase__:					Tuple=None   )      -> Union[str, Any]:
							if rng is None:
														SCREAMING_SNAKE_CASE_				=				random.Random()

							SCREAMING_SNAKE_CASE_				=				1
							for dim in shape:
														total_dims *= dim

							SCREAMING_SNAKE_CASE_				=				[]
							for _ in range(lowerCAmelCase__   ):
														values.append(rng.randint(0		,vocab_size - 1   )   )

							SCREAMING_SNAKE_CASE_				=				np.array(lowerCAmelCase__		,dtype=jnp.intaa   ).reshape(lowerCAmelCase__   )

							return output




def 							_UpperCamelCase				(   lowerCAmelCase__:					Tuple		,lowerCAmelCase__:					str=None   )      -> Optional[int]:
							SCREAMING_SNAKE_CASE_				=				ids_tensor(lowerCAmelCase__		,vocab_size=2		,rng=lowerCAmelCase__   )
							# make sure that at least one token is attended to for each batch
							SCREAMING_SNAKE_CASE_				=				1
							return attn_mask






@require_flax
class    snake_case     :






				"""simple docstring"""
				_a    	=     None
				_a    	=     ()



				def   a__					(    self       )     ->							List[str]:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self.model_tester.prepare_config_and_inputs_for_common()

											# cut to half length & take max batch_size 3
											SCREAMING_SNAKE_CASE_				=				2
											SCREAMING_SNAKE_CASE_				=				inputs['input_ids'].shape[-1] // 2
											SCREAMING_SNAKE_CASE_				=				inputs['input_ids'][:max_batch_size, :sequence_length]

											SCREAMING_SNAKE_CASE_				=				jnp.ones_like(_lowercase       )
											SCREAMING_SNAKE_CASE_				=				attention_mask[:max_batch_size, :sequence_length]

											# generate max 5 tokens
											SCREAMING_SNAKE_CASE_				=				input_ids.shape[-1] + 5
											if config.eos_token_id is not None and config.pad_token_id is None:
																		# hack to allow generate for models such as GPT2 as is done in `generate()`
																		SCREAMING_SNAKE_CASE_				=				config.eos_token_id
											return config, input_ids, attention_mask, max_length



				@is_pt_flax_cross_test
				def   a__					(    self       )     ->							Dict:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				False
											SCREAMING_SNAKE_CASE_				=				max_length
											SCREAMING_SNAKE_CASE_				=				0

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model_class.__name__[4:]  # Skip the "Flax" at the beginning
																		SCREAMING_SNAKE_CASE_				=				getattr(_lowercase,     _lowercase       )
																		SCREAMING_SNAKE_CASE_				=				pt_model_class(_lowercase       ).eval()
																		SCREAMING_SNAKE_CASE_				=				load_flax_weights_in_pytorch_model(_lowercase,     flax_model.params       )

																		SCREAMING_SNAKE_CASE_				=				flax_model.generate(_lowercase       ).sequences
																		SCREAMING_SNAKE_CASE_				=				pt_model.generate(torch.tensor(_lowercase,     dtype=torch.long       )       )

																		if flax_generation_outputs.shape[-1] > pt_generation_outputs.shape[-1]:
																									SCREAMING_SNAKE_CASE_				=				flax_generation_outputs[:, : pt_generation_outputs.shape[-1]]

																		self.assertListEqual(pt_generation_outputs.numpy().tolist(),     flax_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							Any:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				False
											SCREAMING_SNAKE_CASE_				=				max_length

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							int:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				True
											SCREAMING_SNAKE_CASE_				=				max_length

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							Any:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				False
											SCREAMING_SNAKE_CASE_				=				max_length
											SCREAMING_SNAKE_CASE_				=				2

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							Optional[Any]:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				False
											SCREAMING_SNAKE_CASE_				=				max_length
											SCREAMING_SNAKE_CASE_				=				2
											SCREAMING_SNAKE_CASE_				=				2

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[0],     input_ids.shape[0] * config.num_return_sequences       )



				def   a__					(    self       )     ->							Tuple:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				True
											SCREAMING_SNAKE_CASE_				=				max_length
											SCREAMING_SNAKE_CASE_				=				0.8
											SCREAMING_SNAKE_CASE_				=				10
											SCREAMING_SNAKE_CASE_				=				0.3
											SCREAMING_SNAKE_CASE_				=				1
											SCREAMING_SNAKE_CASE_				=				8
											SCREAMING_SNAKE_CASE_				=				9

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							List[str]:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				max_length
											SCREAMING_SNAKE_CASE_				=				1
											SCREAMING_SNAKE_CASE_				=				8
											SCREAMING_SNAKE_CASE_				=				9

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							Dict:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()
											SCREAMING_SNAKE_CASE_				=				max_length
											SCREAMING_SNAKE_CASE_				=				2
											SCREAMING_SNAKE_CASE_				=				1
											SCREAMING_SNAKE_CASE_				=				8
											SCREAMING_SNAKE_CASE_				=				9

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							Optional[int]:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()

											# pad attention mask on the left
											SCREAMING_SNAKE_CASE_				=				attention_mask.at[(0, 0)].set(0       )

											SCREAMING_SNAKE_CASE_				=				False
											SCREAMING_SNAKE_CASE_				=				max_length

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase,     attention_mask=_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase,     attention_mask=_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )



				def   a__					(    self       )     ->							List[Any]:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()

											# pad attention mask on the left
											SCREAMING_SNAKE_CASE_				=				attention_mask.at[(0, 0)].set(0       )

											SCREAMING_SNAKE_CASE_				=				True
											SCREAMING_SNAKE_CASE_				=				max_length

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase,     attention_mask=_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase,     attention_mask=_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )





				def   a__					(    self       )     ->							int:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self._get_input_ids_and_config()

											# pad attention mask on the left
											SCREAMING_SNAKE_CASE_				=				attention_mask.at[(0, 0)].set(0       )

											SCREAMING_SNAKE_CASE_				=				2
											SCREAMING_SNAKE_CASE_				=				max_length

											for model_class in self.all_generative_model_classes:
																		SCREAMING_SNAKE_CASE_				=				model_class(_lowercase       )

																		SCREAMING_SNAKE_CASE_				=				model.generate(_lowercase,     attention_mask=_lowercase       ).sequences
																		self.assertEqual(generation_outputs.shape[-1],     _lowercase       )

																		SCREAMING_SNAKE_CASE_				=				jit(model.generate       )
																		SCREAMING_SNAKE_CASE_				=				jit_generate(_lowercase,     attention_mask=_lowercase       ).sequences

																		self.assertListEqual(generation_outputs.tolist(),     jit_generation_outputs.tolist()       )






@require_flax
class    snake_case     (      unittest.TestCase		):






				"""simple docstring"""



				def   a__					(    self       )     ->							Optional[int]:
											SCREAMING_SNAKE_CASE_				=				AutoTokenizer.from_pretrained('hf-internal-testing/tiny-bert'       )
											SCREAMING_SNAKE_CASE_				=				FlaxAutoModelForCausalLM.from_pretrained('hf-internal-testing/tiny-bert-flax-only'       )

											SCREAMING_SNAKE_CASE_				=				'Hello world'
											SCREAMING_SNAKE_CASE_				=				tokenizer(_lowercase,     return_tensors='np'       ).input_ids

											# typos are quickly detected (the correct argument is `do_sample`)
											with self.assertRaisesRegex(_lowercase,     'do_samples'       ):
																		model.generate(_lowercase,     do_samples=_lowercase       )

											# arbitrary arguments that will not be used anywhere are also not accepted
											with self.assertRaisesRegex(_lowercase,     'foo'       ):
																		SCREAMING_SNAKE_CASE_				=				{'foo': 'bar'}
																		model.generate(_lowercase,     **_lowercase       )





