


from __future__ import annotations

import os
import tempfile
import unittest

from transformers import ConvBertConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

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


if is_tf_available():
    import tensorflow as tf

    from transformers import (
        TFConvBertForMaskedLM,
        TFConvBertForMultipleChoice,
        TFConvBertForQuestionAnswering,
        TFConvBertForSequenceClassification,
        TFConvBertForTokenClassification,
        TFConvBertModel,
    )







class     _lowercase				:


       """simple docstring"""




       def __init__(     self							:    Dict      ,   __lowerCamelCase							:    List[Any]      ,   __lowerCamelCase							:    Any=13      ,   __lowerCamelCase							:    List[Any]=7      ,   __lowerCamelCase							:    Optional[int]=True      ,   __lowerCamelCase							:    Union[str, Any]=True      ,   __lowerCamelCase							:    Dict=True      ,   __lowerCamelCase							:    Optional[Any]=True      ,   __lowerCamelCase							:    Union[str, Any]=99      ,   __lowerCamelCase							:    int=32      ,   __lowerCamelCase							:    Dict=2      ,   __lowerCamelCase							:    List[str]=4      ,   __lowerCamelCase							:    Dict=37      ,   __lowerCamelCase							:    List[Any]="gelu"      ,   __lowerCamelCase							:    Union[str, Any]=0.1      ,   __lowerCamelCase							:    Optional[int]=0.1      ,   __lowerCamelCase							:    List[Any]=512      ,   __lowerCamelCase							:    Union[str, Any]=16      ,   __lowerCamelCase							:    Optional[int]=2      ,   __lowerCamelCase							:    Union[str, Any]=0.0_2      ,   __lowerCamelCase							:    Tuple=3      ,   __lowerCamelCase							:    Optional[Any]=4      ,   __lowerCamelCase							:    str=None      ,   ):


             '''simple docstring'''



             lowerCamelCase__	:       Any					=						parent
             lowerCamelCase__	:       List[str]					=						13
             lowerCamelCase__	:       Any					=						7
             lowerCamelCase__	:       Dict					=						True
             lowerCamelCase__	:       Optional[int]					=						True
             lowerCamelCase__	:       List[Any]					=						True
             lowerCamelCase__	:       List[str]					=						True
             lowerCamelCase__	:       Union[str, Any]					=						99
             lowerCamelCase__	:       Optional[int]					=						384
             lowerCamelCase__	:       Any					=						2
             lowerCamelCase__	:       Union[str, Any]					=						4
             lowerCamelCase__	:       Optional[Any]					=						37
             lowerCamelCase__	:       Tuple					=						"gelu"
             lowerCamelCase__	:       Dict					=						0.1
             lowerCamelCase__	:       Union[str, Any]					=						0.1
             lowerCamelCase__	:       List[str]					=						512
             lowerCamelCase__	:       Tuple					=						16
             lowerCamelCase__	:       List[str]					=						2
             lowerCamelCase__	:       Dict					=						0.0_2
             lowerCamelCase__	:       Dict					=						3
             lowerCamelCase__	:       List[Any]					=						4
             lowerCamelCase__	:       Optional[Any]					=						128
             lowerCamelCase__	:       Optional[Any]					=						2
             lowerCamelCase__	:       Any					=						9
             lowerCamelCase__	:       Tuple					=						1
             lowerCamelCase__	:       Union[str, Any]					=						None





       def 		lowerCAmelCase  (     self							:    Dict ):


             '''simple docstring'''



             lowerCamelCase__	:       Optional[Any]					=						ids_tensor([self.batch_size, self.seq_length]      ,   self.vocab_size )

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

             lowerCamelCase__	:       List[Any]					=						None
             if self.use_token_type_ids:
                   lowerCamelCase__	:       Union[str, Any]					=						ids_tensor([self.batch_size, self.seq_length]      ,   self.type_vocab_size )

             lowerCamelCase__	:       int					=						None
             lowerCamelCase__	:       Any					=						None
             lowerCamelCase__	:       str					=						None
             if self.use_labels:
                   lowerCamelCase__	:       List[str]					=						ids_tensor([self.batch_size]      ,   self.type_sequence_label_size )
                   lowerCamelCase__	:       Optional[Any]					=						ids_tensor([self.batch_size, self.seq_length]      ,   self.num_labels )
                   lowerCamelCase__	:       Tuple					=						ids_tensor([self.batch_size]      ,   self.num_choices )

             lowerCamelCase__	:       Union[str, Any]					=						ConvBertConfig(
                 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_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      ,   max_position_embeddings=self.max_position_embeddings      ,   type_vocab_size=self.type_vocab_size      ,   initializer_range=self.initializer_range      ,   return_dict=__lowerCamelCase      ,   )

             return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels





       def 		lowerCAmelCase  (     self							:    Dict      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    List[Any]      ,   __lowerCamelCase							:    List[str]      ,   __lowerCamelCase							:    List[Any]      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    Optional[Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						TFConvBertModel(config=__lowerCamelCase )
             lowerCamelCase__	:       Tuple					=						{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}

             lowerCamelCase__	:       Any					=						[input_ids, input_mask]
             lowerCamelCase__	:       Any					=						model(__lowerCamelCase )

             lowerCamelCase__	:       Any					=						model(__lowerCamelCase )

             self.parent.assertEqual(result.last_hidden_state.shape      ,   (self.batch_size, self.seq_length, self.hidden_size) )





       def 		lowerCAmelCase  (     self							:    Tuple      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    int ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						TFConvBertForMaskedLM(config=__lowerCamelCase )
             lowerCamelCase__	:       Dict					=						{
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }
             lowerCamelCase__	:       Union[str, Any]					=						model(__lowerCamelCase )
             self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.seq_length, self.vocab_size) )





       def 		lowerCAmelCase  (     self							:    int      ,   __lowerCamelCase							:    Union[str, Any]      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    Tuple      ,   __lowerCamelCase							:    Any      ,   __lowerCamelCase							:    List[Any]      ,   __lowerCamelCase							:    int      ,   __lowerCamelCase							:    Union[str, Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       Optional[int]					=						self.num_labels
             lowerCamelCase__	:       List[str]					=						TFConvBertForSequenceClassification(config=__lowerCamelCase )
             lowerCamelCase__	:       str					=						{
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }

             lowerCamelCase__	:       Any					=						model(__lowerCamelCase )
             self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.num_labels) )





       def 		lowerCAmelCase  (     self							:    List[str]      ,   __lowerCamelCase							:    Tuple      ,   __lowerCamelCase							:    List[str]      ,   __lowerCamelCase							:    Union[str, Any]      ,   __lowerCamelCase							:    List[str]      ,   __lowerCamelCase							:    int      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    Tuple ):


             '''simple docstring'''



             lowerCamelCase__	:       Union[str, Any]					=						self.num_choices
             lowerCamelCase__	:       List[str]					=						TFConvBertForMultipleChoice(config=__lowerCamelCase )
             lowerCamelCase__	:       Union[str, Any]					=						tf.tile(tf.expand_dims(__lowerCamelCase      ,   1 )      ,   (1, self.num_choices, 1) )
             lowerCamelCase__	:       List[str]					=						tf.tile(tf.expand_dims(__lowerCamelCase      ,   1 )      ,   (1, self.num_choices, 1) )
             lowerCamelCase__	:       Any					=						tf.tile(tf.expand_dims(__lowerCamelCase      ,   1 )      ,   (1, self.num_choices, 1) )
             lowerCamelCase__	:       Optional[int]					=						{
                 "input_ids": multiple_choice_inputs_ids,
                 "attention_mask": multiple_choice_input_mask,
                 "token_type_ids": multiple_choice_token_type_ids,
             }
             lowerCamelCase__	:       str					=						model(__lowerCamelCase )
             self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.num_choices) )





       def 		lowerCAmelCase  (     self							:    Optional[Any]      ,   __lowerCamelCase							:    Optional[int]      ,   __lowerCamelCase							:    Tuple      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    Tuple      ,   __lowerCamelCase							:    str      ,   __lowerCamelCase							:    Optional[int]      ,   __lowerCamelCase							:    Dict ):


             '''simple docstring'''



             lowerCamelCase__	:       str					=						self.num_labels
             lowerCamelCase__	:       List[Any]					=						TFConvBertForTokenClassification(config=__lowerCamelCase )
             lowerCamelCase__	:       Optional[Any]					=						{
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }
             lowerCamelCase__	:       List[Any]					=						model(__lowerCamelCase )
             self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.seq_length, self.num_labels) )





       def 		lowerCAmelCase  (     self							:    Any      ,   __lowerCamelCase							:    Union[str, Any]      ,   __lowerCamelCase							:    List[Any]      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    Tuple      ,   __lowerCamelCase							:    Dict      ,   __lowerCamelCase							:    int      ,   __lowerCamelCase							:    Union[str, Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						TFConvBertForQuestionAnswering(config=__lowerCamelCase )
             lowerCamelCase__	:       int					=						{
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }

             lowerCamelCase__	:       int					=						model(__lowerCamelCase )
             self.parent.assertEqual(result.start_logits.shape      ,   (self.batch_size, self.seq_length) )
             self.parent.assertEqual(result.end_logits.shape      ,   (self.batch_size, self.seq_length) )





       def 		lowerCAmelCase  (     self							:    List[str] ):


             '''simple docstring'''



             lowerCamelCase__	:       int					=						self.prepare_config_and_inputs()
             (
                 (
                 lowerCamelCase__
             )					,     (
                 lowerCamelCase__
             )					,     (
                 lowerCamelCase__
             )					,     (
                 lowerCamelCase__
             )					,     (
                 lowerCamelCase__
             )					,     (
                 lowerCamelCase__
             )					,     (
                 lowerCamelCase__
             )					,     
             )	:       List[str]					=						config_and_inputs
             lowerCamelCase__	:       int					=						{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
             return config, inputs_dict







@require_tf
class     _lowercase				(							lowercase__							,						lowercase__							,						unittest.TestCase):


       """simple docstring"""




       A__      		=    (
           (
               TFConvBertModel,
               TFConvBertForMaskedLM,
               TFConvBertForQuestionAnswering,
               TFConvBertForSequenceClassification,
               TFConvBertForTokenClassification,
               TFConvBertForMultipleChoice,
           )
           if is_tf_available()
           else ()
       )
       A__      		=    (
           {
               "feature-extraction": TFConvBertModel,
               "fill-mask": TFConvBertForMaskedLM,
               "question-answering": TFConvBertForQuestionAnswering,
               "text-classification": TFConvBertForSequenceClassification,
               "token-classification": TFConvBertForTokenClassification,
               "zero-shot": TFConvBertForSequenceClassification,
           }
           if is_tf_available()
           else {}
       )
       A__      		=    False
       A__      		=    False
       A__      		=    False





       def 		lowerCAmelCase  (     self							:    List[Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						TFConvBertModelTester(self )
             lowerCamelCase__	:       List[Any]					=						ConfigTester(self      ,   config_class=__lowerCamelCase      ,   hidden_size=37 )





       def 		lowerCAmelCase  (     self							:    Optional[int] ):


             '''simple docstring'''



             self.config_tester.run_common_tests()





       def 		lowerCAmelCase  (     self							:    Dict ):


             '''simple docstring'''



             lowerCamelCase__	:       int					=						self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_model(*__lowerCamelCase )





       def 		lowerCAmelCase  (     self							:    Dict ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_masked_lm(*__lowerCamelCase )





       def 		lowerCAmelCase  (     self							:    str ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_multiple_choice(*__lowerCamelCase )





       def 		lowerCAmelCase  (     self							:    List[str] ):


             '''simple docstring'''



             lowerCamelCase__	:       Any					=						self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_question_answering(*__lowerCamelCase )





       def 		lowerCAmelCase  (     self							:    Optional[int] ):


             '''simple docstring'''



             lowerCamelCase__	:       Tuple					=						self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_sequence_classification(*__lowerCamelCase )





       def 		lowerCAmelCase  (     self							:    Optional[Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       Optional[Any]					=						self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_token_classification(*__lowerCamelCase )





       @slow
       def 		lowerCAmelCase  (     self							:    str ):


             '''simple docstring'''



             lowerCamelCase__					,     lowerCamelCase__	:       str					=						self.model_tester.prepare_config_and_inputs_for_common()
             lowerCamelCase__	:       List[Any]					=						True
             lowerCamelCase__	:       List[Any]					=						True

             if hasattr(__lowerCamelCase      ,   "use_cache" ):
                   lowerCamelCase__	:       Tuple					=						True

             lowerCamelCase__	:       str					=						getattr(self.model_tester      ,   "encoder_seq_length"      ,   self.model_tester.seq_length )
             lowerCamelCase__	:       List[str]					=						getattr(self.model_tester      ,   "key_length"      ,   __lowerCamelCase )

             for model_class in self.all_model_classes:
                   lowerCamelCase__	:       Dict					=						self._prepare_for_class(__lowerCamelCase      ,   __lowerCamelCase )
                   lowerCamelCase__	:       int					=						model_class(__lowerCamelCase )
                   lowerCamelCase__	:       int					=						len(model(__lowerCamelCase ) )

                   with tempfile.TemporaryDirectory() as tmpdirname:
                         model.save_pretrained(__lowerCamelCase      ,   saved_model=__lowerCamelCase )
                         lowerCamelCase__	:       Any					=						os.path.join(__lowerCamelCase      ,   "saved_model"      ,   "1" )
                         lowerCamelCase__	:       List[Any]					=						tf.keras.models.load_model(__lowerCamelCase )
                         lowerCamelCase__	:       List[str]					=						model(__lowerCamelCase )

                         if self.is_encoder_decoder:
                               lowerCamelCase__	:       Tuple					=						outputs["encoder_hidden_states"]
                               lowerCamelCase__	:       Tuple					=						outputs["encoder_attentions"]
                         else:
                               lowerCamelCase__	:       List[str]					=						outputs["hidden_states"]
                               lowerCamelCase__	:       Optional[int]					=						outputs["attentions"]

                         self.assertEqual(len(__lowerCamelCase )      ,   __lowerCamelCase )

                         lowerCamelCase__	:       Optional[int]					=						getattr(
                             self.model_tester      ,   "expected_num_hidden_layers"      ,   self.model_tester.num_hidden_layers + 1 )

                         self.assertEqual(len(__lowerCamelCase )      ,   __lowerCamelCase )
                         self.assertListEqual(
                             list(output_hidden_states[0].shape[-2:] )      ,   [self.model_tester.seq_length, self.model_tester.hidden_size]      ,   )

                         self.assertEqual(len(__lowerCamelCase )      ,   self.model_tester.num_hidden_layers )
                         self.assertListEqual(
                             list(output_attentions[0].shape[-3:] )      ,   [self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]      ,   )





       @slow
       def 		lowerCAmelCase  (     self							:    Union[str, Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       List[str]					=						TFConvBertModel.from_pretrained("YituTech/conv-bert-base" )
             self.assertIsNotNone(__lowerCamelCase )





       def 		lowerCAmelCase  (     self							:    Union[str, Any] ):


             '''simple docstring'''



             lowerCamelCase__					,     lowerCamelCase__	:       Union[str, Any]					=						self.model_tester.prepare_config_and_inputs_for_common()
             lowerCamelCase__	:       Dict					=						True
             lowerCamelCase__	:       Dict					=						getattr(self.model_tester      ,   "decoder_seq_length"      ,   self.model_tester.seq_length )
             lowerCamelCase__	:       Dict					=						getattr(self.model_tester      ,   "encoder_seq_length"      ,   self.model_tester.seq_length )
             lowerCamelCase__	:       str					=						getattr(self.model_tester      ,   "key_length"      ,   __lowerCamelCase )
             lowerCamelCase__	:       Tuple					=						getattr(self.model_tester      ,   "key_length"      ,   __lowerCamelCase )

             def check_decoder_attentions_output(__lowerCamelCase							:    Optional[int] ):
                   lowerCamelCase__	:       Dict					=						len(__lowerCamelCase )
                   self.assertEqual(out_len % 2      ,   0 )
                   lowerCamelCase__	:       Optional[int]					=						outputs.decoder_attentions
                   self.assertEqual(len(__lowerCamelCase )      ,   self.model_tester.num_hidden_layers )
                   self.assertListEqual(
                       list(decoder_attentions[0].shape[-3:] )      ,   [self.model_tester.num_attention_heads / 2, decoder_seq_length, decoder_key_length]      ,   )

             def check_encoder_attentions_output(__lowerCamelCase							:    int ):
                   lowerCamelCase__	:       Union[str, Any]					=						[
                       t.numpy() for t in (outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions)
                   ]
                   self.assertEqual(len(__lowerCamelCase )      ,   self.model_tester.num_hidden_layers )
                   self.assertListEqual(
                       list(attentions[0].shape[-3:] )      ,   [self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]      ,   )

             for model_class in self.all_model_classes:
                   lowerCamelCase__	:       Union[str, Any]					=						True
                   lowerCamelCase__	:       Tuple					=						False
                   lowerCamelCase__	:       str					=						model_class(__lowerCamelCase )
                   lowerCamelCase__	:       Tuple					=						model(self._prepare_for_class(__lowerCamelCase      ,   __lowerCamelCase ) )
                   lowerCamelCase__	:       List[str]					=						len(__lowerCamelCase )
                   self.assertEqual(config.output_hidden_states      ,   __lowerCamelCase )
                   check_encoder_attentions_output(__lowerCamelCase )

                   if self.is_encoder_decoder:
                         lowerCamelCase__	:       Union[str, Any]					=						model_class(__lowerCamelCase )
                         lowerCamelCase__	:       Optional[Any]					=						model(self._prepare_for_class(__lowerCamelCase      ,   __lowerCamelCase ) )
                         self.assertEqual(config.output_hidden_states      ,   __lowerCamelCase )
                         check_decoder_attentions_output(__lowerCamelCase )

                   # Check that output attentions can also be changed via the config
                   del inputs_dict["output_attentions"]
                   lowerCamelCase__	:       Any					=						True
                   lowerCamelCase__	:       int					=						model_class(__lowerCamelCase )
                   lowerCamelCase__	:       List[Any]					=						model(self._prepare_for_class(__lowerCamelCase      ,   __lowerCamelCase ) )
                   self.assertEqual(config.output_hidden_states      ,   __lowerCamelCase )
                   check_encoder_attentions_output(__lowerCamelCase )

                   # Check attention is always last and order is fine
                   lowerCamelCase__	:       Optional[int]					=						True
                   lowerCamelCase__	:       Any					=						True
                   lowerCamelCase__	:       Tuple					=						model_class(__lowerCamelCase )
                   lowerCamelCase__	:       Any					=						model(self._prepare_for_class(__lowerCamelCase      ,   __lowerCamelCase ) )

                   self.assertEqual(out_len + (2 if self.is_encoder_decoder else 1)      ,   len(__lowerCamelCase ) )
                   self.assertEqual(model.config.output_hidden_states      ,   __lowerCamelCase )
                   check_encoder_attentions_output(__lowerCamelCase )







@require_tf
class     _lowercase				(							unittest.TestCase):


       """simple docstring"""




       @slow
       def 		lowerCAmelCase  (     self							:    Optional[Any] ):


             '''simple docstring'''



             lowerCamelCase__	:       int					=						TFConvBertModel.from_pretrained("YituTech/conv-bert-base" )
             lowerCamelCase__	:       Any					=						tf.constant([[0, 1, 2, 3, 4, 5]] )
             lowerCamelCase__	:       Optional[int]					=						model(__lowerCamelCase )[0]

             lowerCamelCase__	:       List[Any]					=						[1, 6, 768]
             self.assertEqual(output.shape      ,   __lowerCamelCase )

             lowerCamelCase__	:       int					=						tf.constant(
                 [
                     [
                         [-0.0_3_4_7_5_4_9_3, -0.4_6_8_6_0_3_4, -0.3_0_6_3_8_8_3_2],
                         [0.2_2_6_3_7_2_4_8, -0.2_6_9_8_8_6_4_6, -0.7_4_2_3_4_2_4],
                         [0.1_0_3_2_4_8_6_8, -0.4_5_0_1_3_5_0_8, -0.5_8_2_8_0_7_8_4],
                     ]
                 ] )
             tf.debugging.assert_near(output[:, :3, :3]      ,   __lowerCamelCase      ,   atol=1E-4 )






from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
    import numpy as np
    import tensorflow as tf

    from transformers import TFCamembertModel







@require_tf
@require_sentencepiece
@require_tokenizers
class     _lowercase				(							unittest.TestCase):


       """simple docstring"""




       @slow
       def 		lowerCAmelCase  (     self							:    Any ):


             '''simple docstring'''



             lowerCamelCase__	:       Dict					=						TFCamembertModel.from_pretrained("jplu/tf-camembert-base" )

             lowerCamelCase__	:       str					=						tf.convert_to_tensor(
                 [[5, 121, 11, 660, 16, 730, 25543, 110, 83, 6]]      ,   dtype=tf.intaa      ,   )  # J'aime le camembert !"

             lowerCamelCase__	:       Any					=						model(__lowerCamelCase )["last_hidden_state"]
             lowerCamelCase__	:       List[str]					=						tf.TensorShape((1, 10, 768) )
             self.assertEqual(output.shape      ,   __lowerCamelCase )
             # compare the actual values for a slice.
             lowerCamelCase__	:       str					=						tf.convert_to_tensor(
                 [[[-0.0_2_5_4, 0.0_2_3_5, 0.1_0_2_7], [0.0_6_0_6, -0.1_8_1_1, -0.0_4_1_8], [-0.1_5_6_1, -0.1_1_2_7, 0.2_6_8_7]]]      ,   dtype=tf.floataa      ,   )
             # camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
             # camembert.eval()
             # expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

             self.assertTrue(np.allclose(output[:, :3, :3].numpy()      ,   expected_slice.numpy()      ,   atol=1E-4 ) )


