


import copy
import inspect
import unittest

from transformers import AutoBackbone
from transformers.configuration_utils import PretrainedConfig
from transformers.testing_utils import require_timm, require_torch, torch_device
from transformers.utils.import_utils import is_torch_available

from ...test_backbone_common import BackboneTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor


if is_torch_available():
  import torch

  from transformers import TimmBackbone, TimmBackboneConfig

from ...test_pipeline_mixin import PipelineTesterMixin



class    UpperCAmelCase_	:
       '''simple docstring'''






       def __init__(     self ,					__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE=None ,					__SCREAMING_SNAKE_CASE=None ,					__SCREAMING_SNAKE_CASE=None ,					__SCREAMING_SNAKE_CASE="resnet50" ,					__SCREAMING_SNAKE_CASE=3 ,					__SCREAMING_SNAKE_CASE=32 ,					__SCREAMING_SNAKE_CASE=3 ,					__SCREAMING_SNAKE_CASE=True ,					__SCREAMING_SNAKE_CASE=True ,					):




              """simple docstring"""




              UpperCamelCase    :	Optional[Any]   	=		parent
              UpperCamelCase    :	Dict   	=		out_indices if out_indices is not None else [4]
              UpperCamelCase    :	List[str]   	=		stage_names
              UpperCamelCase    :	Any   	=		out_features
              UpperCamelCase    :	List[Any]   	=		backbone
              UpperCamelCase    :	Tuple   	=		batch_size
              UpperCamelCase    :	int   	=		image_size
              UpperCamelCase    :	Optional[int]   	=		num_channels
              UpperCamelCase    :	Optional[int]   	=		use_pretrained_backbone
              UpperCamelCase    :	Optional[int]   	=		is_training






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	List[Any]   	=		floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)
              UpperCamelCase    :	List[Any]   	=		self.get_config()

              return config, pixel_values






       def  _lowercase   (     self						):




              """simple docstring"""




              return TimmBackboneConfig(
                  image_size=self.image_size ,					num_channels=self.num_channels ,					out_features=self.out_features ,					out_indices=self.out_indices ,					stage_names=self.stage_names ,					use_pretrained_backbone=self.use_pretrained_backbone ,					backbone=self.backbone ,					)






       def  _lowercase   (     self ,					__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE						):




              """simple docstring"""




              UpperCamelCase    :	int   	=		TimmBackbone(config=__SCREAMING_SNAKE_CASE						)
              model.to(__SCREAMING_SNAKE_CASE						)
              model.eval()
              with torch.no_grad():
                     UpperCamelCase    :	int   	=		model(__SCREAMING_SNAKE_CASE						)
              self.parent.assertEqual(
                  result.feature_map[-1].shape ,					(self.batch_size, model.channels[-1], 14, 14) ,					)






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Tuple   	=		self.prepare_config_and_inputs()
              UpperCamelCase    :	List[str]   	=		config_and_inputs
              UpperCamelCase    :	Dict   	=		{'''pixel_values''': pixel_values}
              return config, inputs_dict




@require_torch
@require_timm
class    UpperCAmelCase_	(							_a,     _a,     _a,     unittest.TestCase):
       '''simple docstring'''
       __UpperCamelCase      :     str							=					(TimmBackbone,) if is_torch_available() else ()
       __UpperCamelCase      :     List[str]							=					{"feature-extraction": TimmBackbone} if is_torch_available() else {}
       __UpperCamelCase      :     str							=					False
       __UpperCamelCase      :     Optional[Any]							=					False
       __UpperCamelCase      :     Union[str, Any]							=					False
       __UpperCamelCase      :     Any							=					False






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Any   	=		TimmBackboneModelTester(self						)
              UpperCamelCase    :	Tuple   	=		ConfigTester(self ,					config_class=__SCREAMING_SNAKE_CASE ,					has_text_modality=__SCREAMING_SNAKE_CASE						)






       def  _lowercase   (     self						):




              """simple docstring"""




              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  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	List[Any]   	=		'''resnet18'''
              UpperCamelCase    :	List[Any]   	=		'''microsoft/resnet-18'''

              UpperCamelCase    :	Optional[Any]   	=		AutoBackbone.from_pretrained(__SCREAMING_SNAKE_CASE ,					use_timm_backbone=__SCREAMING_SNAKE_CASE						)
              UpperCamelCase    :	Any   	=		AutoBackbone.from_pretrained(__SCREAMING_SNAKE_CASE						)

              self.assertEqual(len(timm_model.out_features						) ,					len(transformers_model.out_features						)						)
              self.assertEqual(len(timm_model.stage_names						) ,					len(transformers_model.stage_names						)						)
              self.assertEqual(timm_model.channels ,					transformers_model.channels						)
              # Out indices are set to the last layer by default. For timm models, we don't know
              # the number of layers in advance, so we set it to (-1,), whereas for transformers
              # models, we set it to [len(stage_names) - 1] (kept for backward compatibility).
              self.assertEqual(timm_model.out_indices ,					(-1,)						)
              self.assertEqual(transformers_model.out_indices ,					[len(timm_model.stage_names						) - 1]						)

              UpperCamelCase    :	Optional[Any]   	=		AutoBackbone.from_pretrained(__SCREAMING_SNAKE_CASE ,					use_timm_backbone=__SCREAMING_SNAKE_CASE ,					out_indices=[1, 2, 3]						)
              UpperCamelCase    :	str   	=		AutoBackbone.from_pretrained(__SCREAMING_SNAKE_CASE ,					out_indices=[1, 2, 3]						)

              self.assertEqual(timm_model.out_indices ,					transformers_model.out_indices						)
              self.assertEqual(len(timm_model.out_features						) ,					len(transformers_model.out_features						)						)
              self.assertEqual(timm_model.channels ,					transformers_model.channels						)






       @unittest.skip('''TimmBackbone doesn\'t support feed forward chunking'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone doesn\'t have num_hidden_layers attribute'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone initialization is managed on the timm side'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone models doesn\'t have inputs_embeds'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone models doesn\'t have inputs_embeds'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone model cannot be created without specifying a backbone checkpoint'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''Only checkpoints on timm can be loaded into TimmBackbone'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''model weights aren\'t tied in TimmBackbone.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''model weights aren\'t tied in TimmBackbone.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''Only checkpoints on timm can be loaded into TimmBackbone'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''Only checkpoints on timm can be loaded into TimmBackbone'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone doesn\'t have hidden size info in its configuration.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''TimmBackbone doesn\'t support output_attentions.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''Safetensors is not supported by timm.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       @unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              pass






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Any   	=		self.model_tester.prepare_config_and_inputs_for_common()

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

                     UpperCamelCase    :	List[str]   	=		['''pixel_values''']
                     self.assertListEqual(arg_names[:1] ,					__SCREAMING_SNAKE_CASE						)






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Dict   	=		self.model_tester.prepare_config_and_inputs_for_common()
              UpperCamelCase    :	Dict   	=		True
              UpperCamelCase    :	Optional[int]   	=		self.has_attentions

              # no need to test all models as different heads yield the same functionality
              UpperCamelCase    :	Optional[Any]   	=		self.all_model_classes[0]
              UpperCamelCase    :	Tuple   	=		model_class(__SCREAMING_SNAKE_CASE						)
              model.to(__SCREAMING_SNAKE_CASE						)

              UpperCamelCase    :	str   	=		self._prepare_for_class(__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE						)
              UpperCamelCase    :	int   	=		model(**__SCREAMING_SNAKE_CASE						)
              UpperCamelCase    :	Union[str, Any]   	=		outputs[0][-1]

              # Encoder-/Decoder-only models
              UpperCamelCase    :	List[Any]   	=		outputs.hidden_states[0]
              hidden_states.retain_grad()

              if self.has_attentions:
                     UpperCamelCase    :	Union[str, Any]   	=		outputs.attentions[0]
                     attentions.retain_grad()

              output.flatten()[0].backward(retain_graph=__SCREAMING_SNAKE_CASE						)

              self.assertIsNotNone(hidden_states.grad						)

              if self.has_attentions:
                     self.assertIsNotNone(attentions.grad						)






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Any   	=		self.model_tester.prepare_config_and_inputs_for_common()

              for model_class in self.all_model_classes:
                     UpperCamelCase    :	Dict   	=		model_class(__SCREAMING_SNAKE_CASE						)
                     model.to(__SCREAMING_SNAKE_CASE						)
                     model.eval()
                     UpperCamelCase    :	List[Any]   	=		model(**__SCREAMING_SNAKE_CASE						)

                     self.assertEqual(len(result.feature_maps						) ,					len(config.out_indices						)						)
                     self.assertEqual(len(model.channels						) ,					len(config.out_indices						)						)

                     # Check output of last stage is taken if out_features=None, out_indices=None
                     UpperCamelCase    :	Optional[int]   	=		copy.deepcopy(__SCREAMING_SNAKE_CASE						)
                     UpperCamelCase    :	Dict   	=		None
                     UpperCamelCase    :	Dict   	=		model_class(__SCREAMING_SNAKE_CASE						)
                     model.to(__SCREAMING_SNAKE_CASE						)
                     model.eval()
                     UpperCamelCase    :	Optional[int]   	=		model(**__SCREAMING_SNAKE_CASE						)

                     self.assertEqual(len(result.feature_maps						) ,					1						)
                     self.assertEqual(len(model.channels						) ,					1						)

                     # Check backbone can be initialized with fresh weights
                     UpperCamelCase    :	int   	=		copy.deepcopy(__SCREAMING_SNAKE_CASE						)
                     UpperCamelCase    :	Any   	=		False
                     UpperCamelCase    :	Any   	=		model_class(__SCREAMING_SNAKE_CASE						)
                     model.to(__SCREAMING_SNAKE_CASE						)
                     model.eval()
                     UpperCamelCase    :	int   	=		model(**__SCREAMING_SNAKE_CASE						)





from __future__ import annotations

import unittest

from transformers import XGLMConfig, XGLMTokenizer, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
  import tensorflow as tf

  from transformers.models.xglm.modeling_tf_xglm import (
      TF_XGLM_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFXGLMForCausalLM,
      TFXGLMModel,
  )



@require_tf
class    UpperCAmelCase_	:
       '''simple docstring'''
       __UpperCamelCase      :     Any							=					XGLMConfig
       __UpperCamelCase      :     Dict							=					{}
       __UpperCamelCase      :     List[str]							=					"gelu"






       def __init__(     self ,					__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE=14 ,					__SCREAMING_SNAKE_CASE=7 ,					__SCREAMING_SNAKE_CASE=True ,					__SCREAMING_SNAKE_CASE=True ,					__SCREAMING_SNAKE_CASE=True ,					__SCREAMING_SNAKE_CASE=99 ,					__SCREAMING_SNAKE_CASE=32 ,					__SCREAMING_SNAKE_CASE=2 ,					__SCREAMING_SNAKE_CASE=4 ,					__SCREAMING_SNAKE_CASE=37 ,					__SCREAMING_SNAKE_CASE="gelu" ,					__SCREAMING_SNAKE_CASE=0.1 ,					__SCREAMING_SNAKE_CASE=0.1 ,					__SCREAMING_SNAKE_CASE=512 ,					__SCREAMING_SNAKE_CASE=0.02 ,					):




              """simple docstring"""




              UpperCamelCase    :	Any   	=		parent
              UpperCamelCase    :	Optional[int]   	=		batch_size
              UpperCamelCase    :	str   	=		seq_length
              UpperCamelCase    :	List[str]   	=		is_training
              UpperCamelCase    :	Tuple   	=		use_input_mask
              UpperCamelCase    :	Union[str, Any]   	=		use_labels
              UpperCamelCase    :	int   	=		vocab_size
              UpperCamelCase    :	Optional[int]   	=		d_model
              UpperCamelCase    :	Any   	=		num_hidden_layers
              UpperCamelCase    :	List[str]   	=		num_attention_heads
              UpperCamelCase    :	Optional[Any]   	=		ffn_dim
              UpperCamelCase    :	Optional[int]   	=		activation_function
              UpperCamelCase    :	List[str]   	=		activation_dropout
              UpperCamelCase    :	Any   	=		attention_dropout
              UpperCamelCase    :	str   	=		max_position_embeddings
              UpperCamelCase    :	Union[str, Any]   	=		initializer_range
              UpperCamelCase    :	int   	=		None
              UpperCamelCase    :	Dict   	=		0
              UpperCamelCase    :	int   	=		2
              UpperCamelCase    :	Any   	=		1






       def  _lowercase   (     self						):




              """simple docstring"""




              return XGLMConfig.from_pretrained('''facebook/xglm-564M'''						)






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Optional[int]   	=		tf.clip_by_value(
                  ids_tensor([self.batch_size, self.seq_length] ,					self.vocab_size						) ,					clip_value_min=0 ,					clip_value_max=3						)

              UpperCamelCase    :	int   	=		None
              if self.use_input_mask:
                     UpperCamelCase    :	Any   	=		random_attention_mask([self.batch_size, self.seq_length]						)

              UpperCamelCase    :	Tuple   	=		self.get_config()

              UpperCamelCase    :	str   	=		floats_tensor([self.num_hidden_layers, self.num_attention_heads] ,					2						)

              return (
                  config,
                  input_ids,
                  input_mask,
                  head_mask,
              )






       def  _lowercase   (     self						):




              """simple docstring"""




              return XGLMConfig(
                  vocab_size=self.vocab_size ,					d_model=self.hidden_size ,					num_layers=self.num_hidden_layers ,					attention_heads=self.num_attention_heads ,					ffn_dim=self.ffn_dim ,					activation_function=self.activation_function ,					activation_dropout=self.activation_dropout ,					attention_dropout=self.attention_dropout ,					max_position_embeddings=self.max_position_embeddings ,					initializer_range=self.initializer_range ,					use_cache=__SCREAMING_SNAKE_CASE ,					bos_token_id=self.bos_token_id ,					eos_token_id=self.eos_token_id ,					pad_token_id=self.pad_token_id ,					return_dict=__SCREAMING_SNAKE_CASE ,					)






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	List[str]   	=		self.prepare_config_and_inputs()

              (
                  (
                  UpperCamelCase
              )	, (
                  UpperCamelCase
              )	, (
                  UpperCamelCase
              )	, (
                  UpperCamelCase
              )	, 
              )    :	Dict   	=		config_and_inputs

              UpperCamelCase    :	List[str]   	=		{
                  '''input_ids''': input_ids,
                  '''head_mask''': head_mask,
              }

              return config, inputs_dict




@require_tf
class    UpperCAmelCase_	(							_a,     _a,     unittest.TestCase):
       '''simple docstring'''
       __UpperCamelCase      :     Optional[Any]							=					(TFXGLMModel, TFXGLMForCausalLM) if is_tf_available() else ()
       __UpperCamelCase      :     Union[str, Any]							=					(TFXGLMForCausalLM,) if is_tf_available() else ()
       __UpperCamelCase      :     Any							=					(
           {"feature-extraction": TFXGLMModel, "text-generation": TFXGLMForCausalLM} if is_tf_available() else {}
       )
       __UpperCamelCase      :     Optional[int]							=					False
       __UpperCamelCase      :     List[Any]							=					False
       __UpperCamelCase      :     List[Any]							=					False






       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	List[Any]   	=		TFXGLMModelTester(self						)
              UpperCamelCase    :	Any   	=		ConfigTester(self ,					config_class=__SCREAMING_SNAKE_CASE ,					n_embd=37						)






       def  _lowercase   (     self						):




              """simple docstring"""




              self.config_tester.run_common_tests()






       @slow
       def  _lowercase   (     self						):




              """simple docstring"""




              for model_name in TF_XGLM_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     UpperCamelCase    :	List[Any]   	=		TFXGLMModel.from_pretrained(__SCREAMING_SNAKE_CASE						)
                     self.assertIsNotNone(__SCREAMING_SNAKE_CASE						)






       @unittest.skip(reason='''Currently, model embeddings are going to undergo a major refactor.'''						)
       def  _lowercase   (     self						):




              """simple docstring"""




              super().test_resize_token_embeddings()




@require_tf
class    UpperCAmelCase_	(							unittest.TestCase):
       '''simple docstring'''






       @slow
       def  _lowercase   (     self ,					__SCREAMING_SNAKE_CASE=True						):




              """simple docstring"""




              UpperCamelCase    :	List[str]   	=		TFXGLMForCausalLM.from_pretrained('''facebook/xglm-564M'''						)
              UpperCamelCase    :	List[Any]   	=		tf.convert_to_tensor([[2, 268, 9_865]] ,					dtype=tf.intaa						)  # The dog
              # </s> The dog is a very friendly dog. He is very affectionate and loves to play with other
              # fmt: off
              UpperCamelCase    :	str   	=		[2, 268, 9_865, 67, 11, 1_988, 57_252, 9_865, 5, 984, 67, 1_988, 213_838, 1_658, 53, 70_446, 33, 6_657, 278, 1_581]
              # fmt: on
              UpperCamelCase    :	Union[str, Any]   	=		model.generate(__SCREAMING_SNAKE_CASE ,					do_sample=__SCREAMING_SNAKE_CASE ,					num_beams=1						)
              if verify_outputs:
                     self.assertListEqual(output_ids[0].numpy().tolist() ,					__SCREAMING_SNAKE_CASE						)






       @slow
       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	str   	=		XGLMTokenizer.from_pretrained('''facebook/xglm-564M'''						)
              UpperCamelCase    :	List[str]   	=		TFXGLMForCausalLM.from_pretrained('''facebook/xglm-564M'''						)

              tf.random.set_seed(0						)
              UpperCamelCase    :	Tuple   	=		tokenizer('''Today is a nice day and''' ,					return_tensors='''tf'''						)
              UpperCamelCase    :	int   	=		tokenized.input_ids
              # forces the generation to happen on CPU, to avoid GPU-related quirks (and assure same output regardless of the available devices)
              with tf.device(''':/CPU:0'''						):
                     UpperCamelCase    :	str   	=		model.generate(__SCREAMING_SNAKE_CASE ,					do_sample=__SCREAMING_SNAKE_CASE ,					seed=[7, 0]						)
              UpperCamelCase    :	Dict   	=		tokenizer.decode(output_ids[0] ,					skip_special_tokens=__SCREAMING_SNAKE_CASE						)

              UpperCamelCase    :	Optional[int]   	=		(
                  '''Today is a nice day and warm evening here over Southern Alberta!! Today when they closed schools due'''
              )
              self.assertEqual(__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE						)






       @slow
       def  _lowercase   (     self						):




              """simple docstring"""




              UpperCamelCase    :	Dict   	=		TFXGLMForCausalLM.from_pretrained('''facebook/xglm-564M'''						)
              UpperCamelCase    :	Tuple   	=		XGLMTokenizer.from_pretrained('''facebook/xglm-564M'''						)

              UpperCamelCase    :	Tuple   	=		'''left'''

              # use different length sentences to test batching
              UpperCamelCase    :	Any   	=		[
                  '''This is an extremelly long sentence that only exists to test the ability of the model to cope with '''
                  '''left-padding, such as in batched generation. The output for the sequence below should be the same '''
                  '''regardless of whether left padding is applied or not. When''',
                  '''Hello, my dog is a little''',
              ]

              UpperCamelCase    :	List[Any]   	=		tokenizer(__SCREAMING_SNAKE_CASE ,					return_tensors='''tf''' ,					padding=__SCREAMING_SNAKE_CASE						)
              UpperCamelCase    :	List[str]   	=		inputs['''input_ids''']

              UpperCamelCase    :	Optional[int]   	=		model.generate(input_ids=__SCREAMING_SNAKE_CASE ,					attention_mask=inputs['''attention_mask'''] ,					max_new_tokens=12						)

              UpperCamelCase    :	Optional[int]   	=		tokenizer(sentences[0] ,					return_tensors='''tf'''						).input_ids
              UpperCamelCase    :	Optional[Any]   	=		model.generate(input_ids=__SCREAMING_SNAKE_CASE ,					max_new_tokens=12						)

              UpperCamelCase    :	str   	=		tokenizer(sentences[1] ,					return_tensors='''tf'''						).input_ids
              UpperCamelCase    :	List[Any]   	=		model.generate(input_ids=__SCREAMING_SNAKE_CASE ,					max_new_tokens=12						)

              UpperCamelCase    :	Any   	=		tokenizer.batch_decode(__SCREAMING_SNAKE_CASE ,					skip_special_tokens=__SCREAMING_SNAKE_CASE						)
              UpperCamelCase    :	List[str]   	=		tokenizer.decode(output_non_padded[0] ,					skip_special_tokens=__SCREAMING_SNAKE_CASE						)
              UpperCamelCase    :	Tuple   	=		tokenizer.decode(output_padded[0] ,					skip_special_tokens=__SCREAMING_SNAKE_CASE						)

              UpperCamelCase    :	Optional[int]   	=		[
                  '''This is an extremelly long sentence that only exists to test the ability of the model to cope with '''
                  '''left-padding, such as in batched generation. The output for the sequence below should be the same '''
                  '''regardless of whether left padding is applied or not. When left padding is applied, the sequence will be '''
                  '''a single''',
                  '''Hello, my dog is a little bit of a shy one, but he is very friendly''',
              ]
              self.assertListEqual(__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE						)
              self.assertListEqual(__SCREAMING_SNAKE_CASE ,					[non_padded_sentence, padded_sentence]						)

