"""simple docstring"""







import unittest

from transformers import FunnelConfig, FunnelTokenizer, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
       import torch

       from transformers import (
           MODEL_FOR_PRETRAINING_MAPPING,
           FunnelBaseModel,
           FunnelForMaskedLM,
           FunnelForMultipleChoice,
           FunnelForPreTraining,
           FunnelForQuestionAnswering,
           FunnelForSequenceClassification,
           FunnelForTokenClassification,
           FunnelModel,
       )






class 							__snake_case:


    '''simple docstring'''





    def __init__(  self					,       __lowerCamelCase					,       __lowerCamelCase=13					,       __lowerCamelCase=7					,       __lowerCamelCase=True					,       __lowerCamelCase=True					,       __lowerCamelCase=True					,       __lowerCamelCase=True					,       __lowerCamelCase=99					,       __lowerCamelCase=[1, 1, 2]					,       __lowerCamelCase=1					,       __lowerCamelCase=32					,       __lowerCamelCase=4					,       __lowerCamelCase=8					,       __lowerCamelCase=37					,       __lowerCamelCase="gelu_new"					,       __lowerCamelCase=0.1					,       __lowerCamelCase=0.1					,       __lowerCamelCase=0.0					,       __lowerCamelCase=512					,       __lowerCamelCase=3					,       __lowerCamelCase=0.02					,       __lowerCamelCase=3					,       __lowerCamelCase=4					,       __lowerCamelCase=None					,       __lowerCamelCase=False					,       ):




         '''simple docstring'''



         __A					:					Optional[int]								=		parent
         __A					:					Dict								=		batch_size
         __A					:					List[Any]								=		seq_length
         __A					:					Any								=		is_training
         __A					:					Union[str, Any]								=		use_input_mask
         __A					:					Optional[int]								=		use_token_type_ids
         __A					:					int								=		use_labels
         __A					:					List[Any]								=		vocab_size
         __A					:					Dict								=		block_sizes
         __A					:					Any								=		num_decoder_layers
         __A					:					Tuple								=		d_model
         __A					:					Optional[Any]								=		n_head
         __A					:					List[Any]								=		d_head
         __A					:					Optional[Any]								=		d_inner
         __A					:					int								=		hidden_act
         __A					:					str								=		hidden_dropout
         __A					:					Dict								=		attention_dropout
         __A					:					Optional[int]								=		activation_dropout
         __A					:					List[Any]								=		max_position_embeddings
         __A					:					str								=		type_vocab_size
         __A					:					List[str]								=		2
         __A					:					Tuple								=		num_labels
         __A					:					Any								=		num_choices
         __A					:					Optional[Any]								=		scope
         __A					:					Dict								=		initializer_std

         # Used in the tests to check the size of the first attention layer
         __A					:					Any								=		n_head
         # Used in the tests to check the size of the first hidden state
         __A					:					int								=		self.d_model
         # Used in the tests to check the number of output hidden states/attentions
         __A					:					Dict								=		sum(self.block_sizes	) + (0 if base else self.num_decoder_layers)
         # FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
         # the last hidden state of the first block (which is the first hidden state of the decoder).
         if not base:
              __A					:					List[Any]								=		self.num_hidden_layers + 2
    def 						_a							(  self	):




         '''simple docstring'''



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

         __A					:					Optional[Any]								=		None
         if self.use_input_mask:
              __A					:					Union[str, Any]								=		ids_tensor([self.batch_size, self.seq_length]					,       vocab_size=2	)

         __A					:					Any								=		None
         if self.use_token_type_ids:
              __A					:					Optional[Any]								=		ids_tensor([self.batch_size, self.seq_length]					,       self.type_vocab_size	)

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

         __A					:					Any								=		self.get_config()

         return (
             config,
             input_ids,
             token_type_ids,
             input_mask,
             sequence_labels,
             token_labels,
             choice_labels,
             fake_token_labels,
         )
    def 						_a							(  self	):




         '''simple docstring'''



         return FunnelConfig(
             vocab_size=self.vocab_size					,       block_sizes=self.block_sizes					,       num_decoder_layers=self.num_decoder_layers					,       d_model=self.d_model					,       n_head=self.n_head					,       d_head=self.d_head					,       d_inner=self.d_inner					,       hidden_act=self.hidden_act					,       hidden_dropout=self.hidden_dropout					,       attention_dropout=self.attention_dropout					,       activation_dropout=self.activation_dropout					,       max_position_embeddings=self.max_position_embeddings					,       type_vocab_size=self.type_vocab_size					,       initializer_std=self.initializer_std					,       )
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					str								=		FunnelModel(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					int								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__	)
         __A					:					int								=		model(lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__	)
         __A					:					int								=		model(lowerCAmelCase__	)
         self.parent.assertEqual(result.last_hidden_state.shape					,       (self.batch_size, self.seq_length, self.d_model)	)

         __A					:					Tuple								=		False
         __A					:					Any								=		model(lowerCAmelCase__	)
         self.parent.assertEqual(result.last_hidden_state.shape					,       (self.batch_size, self.seq_length, self.d_model)	)

         __A					:					Optional[int]								=		False
         __A					:					List[Any]								=		model(lowerCAmelCase__	)
         self.parent.assertEqual(result.last_hidden_state.shape					,       (self.batch_size, self.seq_length, self.d_model)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					int								=		FunnelBaseModel(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					List[str]								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__	)
         __A					:					Union[str, Any]								=		model(lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__	)
         __A					:					str								=		model(lowerCAmelCase__	)
         self.parent.assertEqual(result.last_hidden_state.shape					,       (self.batch_size, 2, self.d_model)	)

         __A					:					str								=		False
         __A					:					Dict								=		model(lowerCAmelCase__	)
         self.parent.assertEqual(result.last_hidden_state.shape					,       (self.batch_size, 3, self.d_model)	)

         __A					:					Tuple								=		False
         __A					:					Optional[int]								=		model(lowerCAmelCase__	)
         self.parent.assertEqual(result.last_hidden_state.shape					,       (self.batch_size, 2, self.d_model)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					Optional[Any]								=		self.num_labels
         __A					:					List[str]								=		FunnelForPreTraining(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					Dict								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__					,       labels=lowerCAmelCase__	)
         self.parent.assertEqual(result.logits.shape					,       (self.batch_size, self.seq_length)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					List[str]								=		FunnelForMaskedLM(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					List[Any]								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__					,       labels=lowerCAmelCase__	)
         self.parent.assertEqual(result.logits.shape					,       (self.batch_size, self.seq_length, self.vocab_size)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					Optional[Any]								=		self.num_labels
         __A					:					List[str]								=		FunnelForSequenceClassification(lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					Union[str, Any]								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__					,       labels=lowerCAmelCase__	)
         self.parent.assertEqual(result.logits.shape					,       (self.batch_size, self.num_labels)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					Dict								=		self.num_choices
         __A					:					Union[str, Any]								=		FunnelForMultipleChoice(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					Union[str, Any]								=		input_ids.unsqueeze(1	).expand(-1					,       self.num_choices					,       -1	).contiguous()
         __A					:					Union[str, Any]								=		token_type_ids.unsqueeze(1	).expand(-1					,       self.num_choices					,       -1	).contiguous()
         __A					:					Dict								=		input_mask.unsqueeze(1	).expand(-1					,       self.num_choices					,       -1	).contiguous()
         __A					:					List[str]								=		model(
             lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__					,       labels=lowerCAmelCase__					,       )
         self.parent.assertEqual(result.logits.shape					,       (self.batch_size, self.num_choices)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					List[str]								=		self.num_labels
         __A					:					List[Any]								=		FunnelForTokenClassification(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					int								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__					,       labels=lowerCAmelCase__	)
         self.parent.assertEqual(result.logits.shape					,       (self.batch_size, self.seq_length, self.num_labels)	)
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase					,       ):




         '''simple docstring'''



         __A					:					List[str]								=		FunnelForQuestionAnswering(config=lowerCAmelCase__	)
         model.to(lowerCAmelCase__	)
         model.eval()
         __A					:					Dict								=		model(
             lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__					,       start_positions=lowerCAmelCase__					,       end_positions=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 						_a							(  self	):




         '''simple docstring'''



         __A					:					str								=		self.prepare_config_and_inputs()
         (
             __A				
         )					:					Any								=		config_and_inputs
         __A					:					Optional[Any]								=		{'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
         return config, inputs_dict







@require_torch
class 							__snake_case(					_lowerCAmelCase				,	_lowerCAmelCase				,	unittest.TestCase	):


    '''simple docstring'''





    _UpperCAmelCase       =			False
    _UpperCAmelCase       =			False
    _UpperCAmelCase       =			(
        (
            FunnelModel,
            FunnelForMaskedLM,
            FunnelForPreTraining,
            FunnelForQuestionAnswering,
            FunnelForTokenClassification,
        )
        if is_torch_available()
        else ()
    )
    _UpperCAmelCase       =			(
        {
            "feature-extraction": (FunnelBaseModel, FunnelModel),
            "fill-mask": FunnelForMaskedLM,
            "question-answering": FunnelForQuestionAnswering,
            "text-classification": FunnelForSequenceClassification,
            "token-classification": FunnelForTokenClassification,
            "zero-shot": FunnelForSequenceClassification,
        }
        if is_torch_available()
        else {}
    )
    def 						_a							(  self					,       __lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase=False	):




         '''simple docstring'''



         __A					:					str								=		super()._prepare_for_class(lowerCAmelCase__					,       lowerCAmelCase__					,       return_labels=lowerCAmelCase__	)

         if return_labels:
              if model_class in get_values(lowerCAmelCase__	):
                   __A					:					List[str]								=		torch.zeros(
                       (self.model_tester.batch_size, self.model_tester.seq_length)					,       dtype=torch.long					,       device=lowerCAmelCase__	)
         return inputs_dict
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Tuple								=		FunnelModelTester(self	)
         __A					:					List[Any]								=		ConfigTester(self					,       config_class=lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         self.config_tester.run_common_tests()
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					int								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_model(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					List[str]								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_pretraining(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Dict								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_masked_lm(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Optional[Any]								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_token_classification(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Optional[Any]								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_question_answering(*lowerCAmelCase__	)

    def 						_a							(  self					,       __lowerCamelCase	):




         '''simple docstring'''



         if hasattr(lowerCAmelCase__					,       'weight'	) and module.weight is not None:
              module.weight.data.fill_(3	)
         if hasattr(lowerCAmelCase__					,       'bias'	) and module.bias is not None:
              module.bias.data.fill_(3	)

         for param in ["r_w_bias", "r_r_bias", "r_kernel", "r_s_bias", "seg_embed"]:
              if hasattr(lowerCAmelCase__					,       lowerCAmelCase__	) and getattr(lowerCAmelCase__					,       lowerCAmelCase__	) is not None:
                   __A					:					str								=		getattr(lowerCAmelCase__					,       lowerCAmelCase__	)
                   weight.data.fill_(3	)







@require_torch
class 							__snake_case(					_lowerCAmelCase				,	unittest.TestCase	):


    '''simple docstring'''





    _UpperCAmelCase       =			False
    _UpperCAmelCase       =			False
    _UpperCAmelCase       =			(
        (FunnelBaseModel, FunnelForMultipleChoice, FunnelForSequenceClassification) if is_torch_available() else ()
    )
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Dict								=		FunnelModelTester(self					,       base=lowerCAmelCase__	)
         __A					:					Optional[Any]								=		ConfigTester(self					,       config_class=lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         self.config_tester.run_common_tests()
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Any								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_base_model(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Dict								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_sequence_classification(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Any								=		self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_multiple_choice(*lowerCAmelCase__	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Union[str, Any]								=		self.model_tester.prepare_config_and_inputs_for_common()
         __A					:					Tuple								=		True

         for model_class in self.all_model_classes:
              if model_class.__name__ == "FunnelBaseModel":
                   continue
              __A					:					Any								=		model_class(lowerCAmelCase__	)
              model.to(lowerCAmelCase__	)
              model.train()
              __A					:					Union[str, Any]								=		self._prepare_for_class(lowerCAmelCase__					,       lowerCAmelCase__					,       return_labels=lowerCAmelCase__	)
              __A					:					Optional[Any]								=		model(**lowerCAmelCase__	).loss
              loss.backward()

    def 						_a							(  self					,       __lowerCamelCase	):




         '''simple docstring'''



         if hasattr(lowerCAmelCase__					,       'weight'	) and module.weight is not None:
              module.weight.data.fill_(3	)
         if hasattr(lowerCAmelCase__					,       'bias'	) and module.bias is not None:
              module.bias.data.fill_(3	)

         for param in ["r_w_bias", "r_r_bias", "r_kernel", "r_s_bias", "seg_embed"]:
              if hasattr(lowerCAmelCase__					,       lowerCAmelCase__	) and getattr(lowerCAmelCase__					,       lowerCAmelCase__	) is not None:
                   __A					:					Optional[Any]								=		getattr(lowerCAmelCase__					,       lowerCAmelCase__	)
                   weight.data.fill_(3	)







@require_torch
@require_sentencepiece
@require_tokenizers
class 							__snake_case(					unittest.TestCase	):


    '''simple docstring'''





    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					List[Any]								=		13
         __A					:					List[Any]								=		7
         __A					:					int								=		torch.arange(0					,       batch_size * sequence_length	).long().reshape(lowerCAmelCase__					,       lowerCAmelCase__	)
         __A					:					int								=		[0, 1, 2, 3, 4, 5, 6, 4, 1, 3, 5, 0, 1]
         __A					:					Optional[int]								=		torch.tensor([[2] + [0] * a + [1] * (sequence_length - a - 1) for a in lengths]	)

         __A					:					List[Any]								=		FunnelModel.from_pretrained('sgugger/funnel-random-tiny'	)
         __A					:					str								=		model(lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__	)[0].abs()

         __A					:					Optional[Any]								=		torch.tensor(2344.8352	)
         __A					:					Union[str, Any]								=		torch.tensor(0.80_52	)
         self.assertTrue(torch.allclose(output.sum()					,       lowerCAmelCase__					,       atol=1e-4	)	)
         self.assertTrue(torch.allclose(output.mean()					,       lowerCAmelCase__					,       atol=1e-4	)	)

         __A					:					Union[str, Any]								=		torch.tensor([[1] * 7, [1] * 4 + [0] * 3] * 6 + [[0, 1, 1, 0, 0, 1, 1]]	)
         __A					:					Optional[Any]								=		model(lowerCAmelCase__					,       attention_mask=lowerCAmelCase__					,       token_type_ids=lowerCAmelCase__	)[0].abs()

         __A					:					str								=		torch.tensor(2343.8425	)
         __A					:					List[Any]								=		torch.tensor(0.80_49	)
         self.assertTrue(torch.allclose(output.sum()					,       lowerCAmelCase__					,       atol=1e-4	)	)
         self.assertTrue(torch.allclose(output.mean()					,       lowerCAmelCase__					,       atol=1e-4	)	)

    @slow
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Optional[int]								=		FunnelTokenizer.from_pretrained('huggingface/funnel-small'	)
         __A					:					Optional[Any]								=		FunnelModel.from_pretrained('huggingface/funnel-small'	)
         __A					:					Tuple								=		tokenizer('Hello! I am the Funnel Transformer model.'					,       return_tensors='pt'	)
         __A					:					Union[str, Any]								=		model(**lowerCAmelCase__	)[0]

         __A					:					Tuple								=		torch.tensor(2_35.72_46	)
         __A					:					Union[str, Any]								=		torch.tensor(0.02_56	)
         self.assertTrue(torch.allclose(output.sum()					,       lowerCAmelCase__					,       atol=1e-4	)	)
         self.assertTrue(torch.allclose(output.mean()					,       lowerCAmelCase__					,       atol=1e-4	)	)










"""simple docstring"""




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCamelCase_	 ={
    """configuration_camembert""": ["""CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CamembertConfig""", """CamembertOnnxConfig"""],
}

try:
						if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =["""CamembertTokenizer"""]

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =["""CamembertTokenizerFast"""]

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =[
						    """CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
						    """CamembertForCausalLM""",
						    """CamembertForMaskedLM""",
						    """CamembertForMultipleChoice""",
						    """CamembertForQuestionAnswering""",
						    """CamembertForSequenceClassification""",
						    """CamembertForTokenClassification""",
						    """CamembertModel""",
						    """CamembertPreTrainedModel""",
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =[
						    """TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
						    """TFCamembertForCausalLM""",
						    """TFCamembertForMaskedLM""",
						    """TFCamembertForMultipleChoice""",
						    """TFCamembertForQuestionAnswering""",
						    """TFCamembertForSequenceClassification""",
						    """TFCamembertForTokenClassification""",
						    """TFCamembertModel""",
						    """TFCamembertPreTrainedModel""",
						]


if TYPE_CHECKING:
						from .configuration_camembert import CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CamembertConfig, CamembertOnnxConfig

						try:
												if not is_sentencepiece_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_camembert import CamembertTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_camembert_fast import CamembertTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_camembert import (
												    CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    CamembertForCausalLM,
												    CamembertForMaskedLM,
												    CamembertForMultipleChoice,
												    CamembertForQuestionAnswering,
												    CamembertForSequenceClassification,
												    CamembertForTokenClassification,
												    CamembertModel,
												    CamembertPreTrainedModel,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_camembert import (
												    TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFCamembertForCausalLM,
												    TFCamembertForMaskedLM,
												    TFCamembertForMultipleChoice,
												    TFCamembertForQuestionAnswering,
												    TFCamembertForSequenceClassification,
												    TFCamembertForTokenClassification,
												    TFCamembertModel,
												    TFCamembertPreTrainedModel,
												)

else:
						import sys

						UpperCamelCase_	 =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



