




'''simple docstring'''

import os
import re
import shutil
import sys
import tempfile
import unittest

import black


a    :							Optional[int]										=    os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, 'utils'))

import check_copies  # noqa: E402


# This is the reference code that will be used in the tests.
# If BertLMPredictionHead is changed in modeling_bert.py, this code needs to be manually updated.
a    :							Tuple										=    '    def __init__(self, config):\n        super().__init__()\n        self.transform = BertPredictionHeadTransform(config)\n\n        # The output weights are the same as the input embeddings, but there is\n        # an output-only bias for each token.\n        self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)\n\n        self.bias = nn.Parameter(torch.zeros(config.vocab_size))\n\n        # Need a link between the two variables so that the bias is correctly resized with `resize_token_embeddings`\n        self.decoder.bias = self.bias\n\n    def forward(self, hidden_states):\n        hidden_states = self.transform(hidden_states)\n        hidden_states = self.decoder(hidden_states)\n        return hidden_states\n'






class 		a							(  unittest.TestCase	):


				def     A_					(						self       :   Dict   ):
									snake_case_		     =							tempfile.mkdtemp()
									os.makedirs(os.path.join(self.transformer_dir			,							'''models/bert/'''   )   )
									snake_case_		     =							self.transformer_dir
									shutil.copy(
									    os.path.join(lowercase_			,							'''src/transformers/models/bert/modeling_bert.py'''   )			,							os.path.join(self.transformer_dir			,							'''models/bert/modeling_bert.py'''   )			,							)


				def     A_					(						self       :   Optional[Any]   ):
									snake_case_		     =							'''src/transformers'''
									shutil.rmtree(self.transformer_dir   )


				def     A_					(						self       :   List[str]			,							lowercase_       :   int			,							lowercase_       :   List[str]			,							lowercase_       :   List[str]			,							lowercase_       :   str=None   ):
									snake_case_		     =							comment + F"\nclass {class_name}(nn.Module):\n" + class_code
									if overwrite_result is not None:
														snake_case_		     =							comment + F"\nclass {class_name}(nn.Module):\n" + overwrite_result
									snake_case_		     =							black.Mode(target_versions={black.TargetVersion.PYaa}			,							line_length=119   )
									snake_case_		     =							black.format_str(lowercase_			,							mode=lowercase_   )
									snake_case_		     =							os.path.join(self.transformer_dir			,							'''new_code.py'''   )
									with open(lowercase_			,							'''w'''			,							newline='''\n'''   ) as f:
														f.write(lowercase_   )
									if overwrite_result is None:
														self.assertTrue(len(check_copies.is_copy_consistent(lowercase_   )   ) == 0   )
									else:
														check_copies.is_copy_consistent(f.name			,							overwrite=lowercase_   )
														with open(lowercase_			,							'''r'''   ) as f:
																			self.assertTrue(f.read()			,							lowercase_   )


				def     A_					(						self       :   Tuple   ):
									snake_case_		     =							check_copies.find_code_in_transformers('''models.bert.modeling_bert.BertLMPredictionHead'''   )
									self.assertEqual(lowercase_			,							lowercase_   )


				def     A_					(						self       :   int   ):
									# Base copy consistency
									self.check_copy_consistency(
									    '''# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead'''			,							'''BertLMPredictionHead'''			,							REFERENCE_CODE + '''\n'''			,							)

									# With no empty line at the end
									self.check_copy_consistency(
									    '''# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead'''			,							'''BertLMPredictionHead'''			,							lowercase_			,							)

									# Copy consistency with rename
									self.check_copy_consistency(
									    '''# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead with Bert->TestModel'''			,							'''TestModelLMPredictionHead'''			,							re.sub('''Bert'''			,							'''TestModel'''			,							lowercase_   )			,							)

									# Copy consistency with a really long name
									snake_case_		     =							'''TestModelWithAReallyLongNameBecauseSomePeopleLikeThatForSomeReason'''
									self.check_copy_consistency(
									    F"# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead with Bert->{long_class_name}"			,							F"{long_class_name}LMPredictionHead"			,							re.sub('''Bert'''			,							lowercase_			,							lowercase_   )			,							)

									# Copy consistency with overwrite
									self.check_copy_consistency(
									    '''# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead with Bert->TestModel'''			,							'''TestModelLMPredictionHead'''			,							lowercase_			,							overwrite_result=re.sub('''Bert'''			,							'''TestModel'''			,							lowercase_   )			,							)


				def     A_					(						self       :   Dict   ):
									snake_case_		     =							check_copies.LOCALIZED_READMES['''README_zh-hans.md''']

									snake_case_		     =							(
									    '''1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (from Google Research and the'''
									    ''' Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for'''
									    ''' Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong'''
									    ''' Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.\n1.'''
									    ''' **[DistilBERT](https://huggingface.co/transformers/model_doc/distilbert.html)** (from HuggingFace),'''
									    ''' released together with the paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and'''
									    ''' lighter](https://arxiv.org/abs/1910.01108) by Victor Sanh, Lysandre Debut and Thomas Wolf. The same'''
									    ''' method has been applied to compress GPT2 into'''
									    ''' [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/distillation), RoBERTa into'''
									    ''' [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/distillation),'''
									    ''' Multilingual BERT into'''
									    ''' [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/distillation) and a German'''
									    ''' version of DistilBERT.\n1. **[ELECTRA](https://huggingface.co/transformers/model_doc/electra.html)**'''
									    ''' (from Google Research/Stanford University) released with the paper [ELECTRA: Pre-training text encoders'''
									    ''' as discriminators rather than generators](https://arxiv.org/abs/2003.10555) by Kevin Clark, Minh-Thang'''
									    ''' Luong, Quoc V. Le, Christopher D. Manning.'''
									)
									snake_case_		     =							(
									    '''1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the'''
									    ''' Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of'''
									    ''' Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian'''
									    ''' Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n'''
									)
									snake_case_		     =							(
									    '''1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the'''
									    ''' Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of'''
									    ''' Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian'''
									    ''' Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n1.'''
									    ''' **[DistilBERT](https://huggingface.co/transformers/model_doc/distilbert.html)** (来自 HuggingFace) 伴随论文'''
									    ''' [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and'''
									    ''' lighter](https://arxiv.org/abs/1910.01108) 由 Victor Sanh, Lysandre Debut and Thomas Wolf 发布。 The same'''
									    ''' method has been applied to compress GPT2 into'''
									    ''' [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/distillation), RoBERTa into'''
									    ''' [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/distillation),'''
									    ''' Multilingual BERT into'''
									    ''' [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/distillation) and a German'''
									    ''' version of DistilBERT.\n1. **[ELECTRA](https://huggingface.co/transformers/model_doc/electra.html)** (来自'''
									    ''' Google Research/Stanford University) 伴随论文 [ELECTRA: Pre-training text encoders as discriminators rather'''
									    ''' than generators](https://arxiv.org/abs/2003.10555) 由 Kevin Clark, Minh-Thang Luong, Quoc V. Le,'''
									    ''' Christopher D. Manning 发布。\n'''
									)

									snake_case_     ,snake_case_		     =							check_copies.convert_to_localized_md(
									    lowercase_			,							lowercase_			,							localized_readme['''format_model_list''']   )

									self.assertFalse(lowercase_   )
									self.assertEqual(lowercase_			,							lowercase_   )

									snake_case_     ,snake_case_		     =							check_copies.convert_to_localized_md(
									    lowercase_			,							lowercase_			,							localized_readme['''format_model_list''']   )

									# Check whether the number of models is equal to README.md after conversion.
									self.assertTrue(lowercase_   )

									snake_case_		     =							(
									    '''1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (from Google Research and the'''
									    ''' Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for'''
									    ''' Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong'''
									    ''' Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.'''
									)
									snake_case_		     =							(
									    '''1. **[ALBERT](https://huggingface.co/transformers/main/model_doc/albert.html)** (来自 Google Research and'''
									    ''' the Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of'''
									    ''' Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian'''
									    ''' Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n'''
									)
									snake_case_		     =							(
									    '''1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the'''
									    ''' Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of'''
									    ''' Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian'''
									    ''' Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n'''
									)

									snake_case_     ,snake_case_		     =							check_copies.convert_to_localized_md(
									    lowercase_			,							lowercase_			,							localized_readme['''format_model_list''']   )

									# Check if the model link is synchronized.
									self.assertEqual(lowercase_			,							lowercase_   )







'''simple docstring'''

from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, 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 numpy as np
							import tensorflow as tf

							from transformers import (
							    TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
							    FlaubertConfig,
							    TFFlaubertForMultipleChoice,
							    TFFlaubertForQuestionAnsweringSimple,
							    TFFlaubertForSequenceClassification,
							    TFFlaubertForTokenClassification,
							    TFFlaubertModel,
							    TFFlaubertWithLMHeadModel,
							)






class 		a							:


				def __init__(						self       :   Tuple			,							lowercase_       :   Any			,							):
									snake_case_		     =							parent
									snake_case_		     =							13
									snake_case_		     =							7
									snake_case_		     =							True
									snake_case_		     =							True
									snake_case_		     =							True
									snake_case_		     =							True
									snake_case_		     =							True
									snake_case_		     =							False
									snake_case_		     =							False
									snake_case_		     =							False
									snake_case_		     =							2
									snake_case_		     =							99
									snake_case_		     =							0
									snake_case_		     =							32
									snake_case_		     =							2
									snake_case_		     =							4
									snake_case_		     =							0.1
									snake_case_		     =							0.1
									snake_case_		     =							512
									snake_case_		     =							16
									snake_case_		     =							2
									snake_case_		     =							0.02
									snake_case_		     =							3
									snake_case_		     =							4
									snake_case_		     =							'''last'''
									snake_case_		     =							True
									snake_case_		     =							None
									snake_case_		     =							0


				def     A_					(						self       :   Union[str, Any]   ):
									snake_case_		     =							ids_tensor([self.batch_size, self.seq_length]			,							self.vocab_size   )
									snake_case_		     =							random_attention_mask([self.batch_size, self.seq_length]			,							dtype=tf.floataa   )

									snake_case_		     =							None
									if self.use_input_lengths:
														snake_case_		     =							(
														    ids_tensor([self.batch_size]			,							vocab_size=2   ) + self.seq_length - 2
														)  # small variation of seq_length

									snake_case_		     =							None
									if self.use_token_type_ids:
														snake_case_		     =							ids_tensor([self.batch_size, self.seq_length]			,							self.n_langs   )

									snake_case_		     =							None
									snake_case_		     =							None
									snake_case_		     =							None
									if self.use_labels:
														snake_case_		     =							ids_tensor([self.batch_size]			,							self.type_sequence_label_size   )
														snake_case_		     =							ids_tensor([self.batch_size, self.seq_length]			,							self.num_labels   )
														snake_case_		     =							ids_tensor([self.batch_size]			,							2			,							dtype=tf.floataa   )
														snake_case_		     =							ids_tensor([self.batch_size]			,							self.num_choices   )

									snake_case_		     =							FlaubertConfig(
									    vocab_size=self.vocab_size			,							n_special=self.n_special			,							emb_dim=self.hidden_size			,							n_layers=self.num_hidden_layers			,							n_heads=self.num_attention_heads			,							dropout=self.hidden_dropout_prob			,							attention_dropout=self.attention_probs_dropout_prob			,							gelu_activation=self.gelu_activation			,							sinusoidal_embeddings=self.sinusoidal_embeddings			,							asm=self.asm			,							causal=self.causal			,							n_langs=self.n_langs			,							max_position_embeddings=self.max_position_embeddings			,							initializer_range=self.initializer_range			,							summary_type=self.summary_type			,							use_proj=self.use_proj			,							bos_token_id=self.bos_token_id			,							)

									return (
									    config,
									    input_ids,
									    token_type_ids,
									    input_lengths,
									    sequence_labels,
									    token_labels,
									    is_impossible_labels,
									    choice_labels,
									    input_mask,
									)


				def     A_					(						self       :   List[Any]			,							lowercase_       :   Dict			,							lowercase_       :   Optional[int]			,							lowercase_       :   Any			,							lowercase_       :   List[Any]			,							lowercase_       :   Optional[int]			,							lowercase_       :   int			,							lowercase_       :   int			,							lowercase_       :   str			,							lowercase_       :   int			,							):
									snake_case_		     =							TFFlaubertModel(config=lowercase_   )
									snake_case_		     =							{'''input_ids''': input_ids, '''lengths''': input_lengths, '''langs''': token_type_ids}
									snake_case_		     =							model(lowercase_   )

									snake_case_		     =							[input_ids, input_mask]
									snake_case_		     =							model(lowercase_   )
									self.parent.assertEqual(result.last_hidden_state.shape			,							(self.batch_size, self.seq_length, self.hidden_size)   )


				def     A_					(						self       :   List[str]			,							lowercase_       :   int			,							lowercase_       :   List[str]			,							lowercase_       :   Optional[Any]			,							lowercase_       :   str			,							lowercase_       :   Tuple			,							lowercase_       :   Tuple			,							lowercase_       :   Any			,							lowercase_       :   Dict			,							lowercase_       :   List[Any]			,							):
									snake_case_		     =							TFFlaubertWithLMHeadModel(lowercase_   )

									snake_case_		     =							{'''input_ids''': input_ids, '''lengths''': input_lengths, '''langs''': token_type_ids}
									snake_case_		     =							model(lowercase_   )

									self.parent.assertEqual(result.logits.shape			,							(self.batch_size, self.seq_length, self.vocab_size)   )


				def     A_					(						self       :   str			,							lowercase_       :   Dict			,							lowercase_       :   Union[str, Any]			,							lowercase_       :   Dict			,							lowercase_       :   Any			,							lowercase_       :   str			,							lowercase_       :   List[str]			,							lowercase_       :   List[Any]			,							lowercase_       :   Union[str, Any]			,							lowercase_       :   str			,							):
									snake_case_		     =							TFFlaubertForQuestionAnsweringSimple(lowercase_   )

									snake_case_		     =							{'''input_ids''': input_ids, '''lengths''': input_lengths}

									snake_case_		     =							model(lowercase_   )

									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     A_					(						self       :   Optional[Any]			,							lowercase_       :   Any			,							lowercase_       :   int			,							lowercase_       :   List[Any]			,							lowercase_       :   Any			,							lowercase_       :   Optional[Any]			,							lowercase_       :   str			,							lowercase_       :   int			,							lowercase_       :   int			,							lowercase_       :   Dict			,							):
									snake_case_		     =							TFFlaubertForSequenceClassification(lowercase_   )

									snake_case_		     =							{'''input_ids''': input_ids, '''lengths''': input_lengths}

									snake_case_		     =							model(lowercase_   )

									self.parent.assertEqual(result.logits.shape			,							(self.batch_size, self.type_sequence_label_size)   )


				def     A_					(						self       :   List[Any]			,							lowercase_       :   Optional[Any]			,							lowercase_       :   Any			,							lowercase_       :   Any			,							lowercase_       :   List[Any]			,							lowercase_       :   List[Any]			,							lowercase_       :   Dict			,							lowercase_       :   int			,							lowercase_       :   Tuple			,							lowercase_       :   Union[str, Any]			,							):
									snake_case_		     =							self.num_labels
									snake_case_		     =							TFFlaubertForTokenClassification(config=lowercase_   )
									snake_case_		     =							{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
									snake_case_		     =							model(lowercase_   )
									self.parent.assertEqual(result.logits.shape			,							(self.batch_size, self.seq_length, self.num_labels)   )


				def     A_					(						self       :   Dict			,							lowercase_       :   Tuple			,							lowercase_       :   Optional[int]			,							lowercase_       :   Any			,							lowercase_       :   List[Any]			,							lowercase_       :   int			,							lowercase_       :   Tuple			,							lowercase_       :   List[str]			,							lowercase_       :   List[Any]			,							lowercase_       :   Any			,							):
									snake_case_		     =							self.num_choices
									snake_case_		     =							TFFlaubertForMultipleChoice(config=lowercase_   )
									snake_case_		     =							tf.tile(tf.expand_dims(lowercase_			,							1   )			,							(1, self.num_choices, 1)   )
									snake_case_		     =							tf.tile(tf.expand_dims(lowercase_			,							1   )			,							(1, self.num_choices, 1)   )
									snake_case_		     =							tf.tile(tf.expand_dims(lowercase_			,							1   )			,							(1, self.num_choices, 1)   )
									snake_case_		     =							{
									    '''input_ids''': multiple_choice_inputs_ids,
									    '''attention_mask''': multiple_choice_input_mask,
									    '''token_type_ids''': multiple_choice_token_type_ids,
									}
									snake_case_		     =							model(lowercase_   )
									self.parent.assertEqual(result.logits.shape			,							(self.batch_size, self.num_choices)   )


				def     A_					(						self       :   Dict   ):
									snake_case_		     =							self.prepare_config_and_inputs()
									(
									    (
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,(
									    snake_case_
									)     ,
									)		     =							config_and_inputs
									snake_case_		     =							{
									    '''input_ids''': input_ids,
									    '''token_type_ids''': token_type_ids,
									    '''langs''': token_type_ids,
									    '''lengths''': input_lengths,
									}
									return config, inputs_dict







@require_tf
class 		a							(  _lowerCamelCase  ,	_lowerCamelCase  ,	unittest.TestCase	):
				snake_case_           =						(
				    (
				        TFFlaubertModel,
				        TFFlaubertWithLMHeadModel,
				        TFFlaubertForSequenceClassification,
				        TFFlaubertForQuestionAnsweringSimple,
				        TFFlaubertForTokenClassification,
				        TFFlaubertForMultipleChoice,
				    )
				    if is_tf_available()
				    else ()
				)
				snake_case_           =						(
				    (TFFlaubertWithLMHeadModel,) if is_tf_available() else ()
				)  # TODO (PVP): Check other models whether language generation is also applicable
				snake_case_           =						(
				    {
				        "feature-extraction": TFFlaubertModel,
				        "fill-mask": TFFlaubertWithLMHeadModel,
				        "question-answering": TFFlaubertForQuestionAnsweringSimple,
				        "text-classification": TFFlaubertForSequenceClassification,
				        "token-classification": TFFlaubertForTokenClassification,
				        "zero-shot": TFFlaubertForSequenceClassification,
				    }
				    if is_tf_available()
				    else {}
				)
				snake_case_           =						False
				snake_case_           =						False


				def     A_					(						self       :   str			,							lowercase_       :   Optional[Any]			,							lowercase_       :   Optional[Any]			,							lowercase_       :   Union[str, Any]			,							lowercase_       :   Union[str, Any]			,							lowercase_       :   Optional[Any]   ):
									if (
									    pipeline_test_casse_name == "QAPipelineTests"
									    and tokenizer_name is not None
									    and not tokenizer_name.endswith('''Fast'''   )
									):
														# `QAPipelineTests` fails for a few models when the slower tokenizer are used.
														# (The slower tokenizers were never used for pipeline tests before the pipeline testing rework)
														# TODO: check (and possibly fix) the `QAPipelineTests` with slower tokenizer
														return True

									return False


				def     A_					(						self       :   int   ):
									snake_case_		     =							TFFlaubertModelTester(self   )
									snake_case_		     =							ConfigTester(self			,							config_class=lowercase_			,							emb_dim=37   )


				def     A_					(						self       :   List[str]   ):
									self.config_tester.run_common_tests()


				def     A_					(						self       :   Optional[Any]   ):
									snake_case_		     =							self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_flaubert_model(*lowercase_   )


				def     A_					(						self       :   Union[str, Any]   ):
									snake_case_		     =							self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_flaubert_lm_head(*lowercase_   )


				def     A_					(						self       :   Tuple   ):
									snake_case_		     =							self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_flaubert_qa(*lowercase_   )


				def     A_					(						self       :   Tuple   ):
									snake_case_		     =							self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_flaubert_sequence_classif(*lowercase_   )


				def     A_					(						self       :   List[str]   ):
									snake_case_		     =							self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_flaubert_for_token_classification(*lowercase_   )


				def     A_					(						self       :   Union[str, Any]   ):
									snake_case_		     =							self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_flaubert_for_multiple_choice(*lowercase_   )


				@slow
				def     A_					(						self       :   Optional[int]   ):
									for model_name in TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														snake_case_		     =							TFFlaubertModel.from_pretrained(lowercase_   )
														self.assertIsNotNone(lowercase_   )







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


				@slow
				def     A_					(						self       :   int   ):
									snake_case_		     =							TFFlaubertModel.from_pretrained('''jplu/tf-flaubert-small-cased'''   )

									snake_case_		     =							tf.convert_to_tensor(
									    [[0, 158, 735, 2592, 1424, 6727, 82, 1]]			,							dtype=tf.intaa			,							)  # "J'aime flaubert !"

									snake_case_		     =							model(lowercase_   )[0]
									snake_case_		     =							tf.TensorShape((1, 8, 512)   )
									self.assertEqual(output.shape			,							lowercase_   )
									# compare the actual values for a slice.
									snake_case_		     =							tf.convert_to_tensor(
									    [
									        [
									            [-1.876_8773, -1.56_6555, 0.2707_2418],
									            [-1.692_0038, -0.587_3505, 1.932_9599],
									            [-2.956_3985, -1.699_3835, 1.797_2052],
									        ]
									    ]			,							dtype=tf.floataa			,							)

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

