


import os
import tempfile
import unittest

from transformers import DistilBertConfig, is_torch_available
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device

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


if is_torch_available():
				import torch

				from transformers import (
				    DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    DistilBertForMaskedLM,
				    DistilBertForMultipleChoice,
				    DistilBertForQuestionAnswering,
				    DistilBertForSequenceClassification,
				    DistilBertForTokenClassification,
				    DistilBertModel,
				)







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							def __init__(      self			,						lowerCAmelCase__			,						lowerCAmelCase__=1_3			,						lowerCAmelCase__=7			,						lowerCAmelCase__=True			,						lowerCAmelCase__=True			,						lowerCAmelCase__=False			,						lowerCAmelCase__=True			,						lowerCAmelCase__=9_9			,						lowerCAmelCase__=3_2			,						lowerCAmelCase__=5			,						lowerCAmelCase__=4			,						lowerCAmelCase__=3_7			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=5_1_2			,						lowerCAmelCase__=1_6			,						lowerCAmelCase__=2			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=3			,						lowerCAmelCase__=4			,						lowerCAmelCase__=None			,						):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     str					=					parent
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					batch_size
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					seq_length
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					is_training
										SCREAMING_SNAKE_CASE_		:     Dict					=					use_input_mask
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					use_token_type_ids
										SCREAMING_SNAKE_CASE_		:     Dict					=					use_labels
										SCREAMING_SNAKE_CASE_		:     str					=					vocab_size
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					hidden_size
										SCREAMING_SNAKE_CASE_		:     Tuple					=					num_hidden_layers
										SCREAMING_SNAKE_CASE_		:     Tuple					=					num_attention_heads
										SCREAMING_SNAKE_CASE_		:     str					=					intermediate_size
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     int					=					hidden_dropout_prob
										SCREAMING_SNAKE_CASE_		:     Any					=					attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					max_position_embeddings
										SCREAMING_SNAKE_CASE_		:     Dict					=					type_vocab_size
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					type_sequence_label_size
										SCREAMING_SNAKE_CASE_		:     int					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					num_labels
										SCREAMING_SNAKE_CASE_		:     int					=					num_choices
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					scope






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




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

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

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

										SCREAMING_SNAKE_CASE_		:     Any					=					self.get_config()

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






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										return DistilBertConfig(
										    vocab_size=self.vocab_size			,						dim=self.hidden_size			,						n_layers=self.num_hidden_layers			,						n_heads=self.num_attention_heads			,						hidden_dim=self.intermediate_size			,						hidden_act=self.hidden_act			,						dropout=self.hidden_dropout_prob			,						attention_dropout=self.attention_probs_dropout_prob			,						max_position_embeddings=self.max_position_embeddings			,						initializer_range=self.initializer_range			,						)






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Tuple					=					DistilBertModel(config=lowerCAmelCase__       )
										model.to(lowerCAmelCase__       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     List[str]					=					model(lowerCAmelCase__			,						lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					model(lowerCAmelCase__       )
										self.parent.assertEqual(result.last_hidden_state.shape			,						(self.batch_size, self.seq_length, self.hidden_size)       )






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					DistilBertForMaskedLM(config=lowerCAmelCase__       )
										model.to(lowerCAmelCase__       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     Dict					=					model(lowerCAmelCase__			,						attention_mask=lowerCAmelCase__			,						labels=lowerCAmelCase__       )
										self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.seq_length, self.vocab_size)       )






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					DistilBertForQuestionAnswering(config=lowerCAmelCase__       )
										model.to(lowerCAmelCase__       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					model(
										    lowerCAmelCase__			,						attention_mask=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 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.num_labels
										SCREAMING_SNAKE_CASE_		:     str					=					DistilBertForSequenceClassification(lowerCAmelCase__       )
										model.to(lowerCAmelCase__       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     int					=					model(lowerCAmelCase__			,						attention_mask=lowerCAmelCase__			,						labels=lowerCAmelCase__       )
										self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.num_labels)       )






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					self.num_labels
										SCREAMING_SNAKE_CASE_		:     str					=					DistilBertForTokenClassification(config=lowerCAmelCase__       )
										model.to(lowerCAmelCase__       )
										model.eval()

										SCREAMING_SNAKE_CASE_		:     str					=					model(lowerCAmelCase__			,						attention_mask=lowerCAmelCase__			,						labels=lowerCAmelCase__       )
										self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.seq_length, self.num_labels)       )






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     str					=					self.num_choices
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					DistilBertForMultipleChoice(config=lowerCAmelCase__       )
										model.to(lowerCAmelCase__       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     Any					=					input_ids.unsqueeze(1       ).expand(-1			,						self.num_choices			,						-1       ).contiguous()
										SCREAMING_SNAKE_CASE_		:     Tuple					=					input_mask.unsqueeze(1       ).expand(-1			,						self.num_choices			,						-1       ).contiguous()
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					model(
										    lowerCAmelCase__			,						attention_mask=lowerCAmelCase__			,						labels=lowerCAmelCase__			,						)
										self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.num_choices)       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Dict					=					self.prepare_config_and_inputs()
										((SCREAMING_SNAKE_CASE_)		,      (SCREAMING_SNAKE_CASE_)		,      (SCREAMING_SNAKE_CASE_)		,      (SCREAMING_SNAKE_CASE_)		,      (SCREAMING_SNAKE_CASE_)		,      (SCREAMING_SNAKE_CASE_))		:     Union[str, Any]					=					config_and_inputs
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					{'input_ids': input_ids, 'attention_mask': input_mask}
										return config, inputs_dict







@require_torch
class 	__lowercase    (__SCREAMING_SNAKE_CASE	,       __SCREAMING_SNAKE_CASE	,       unittest.TestCase  ):





							"""simple docstring"""







							_UpperCAmelCase      =						(
							    (
							        DistilBertModel,
							        DistilBertForMaskedLM,
							        DistilBertForMultipleChoice,
							        DistilBertForQuestionAnswering,
							        DistilBertForSequenceClassification,
							        DistilBertForTokenClassification,
							    )
							    if is_torch_available()
							    else None
							)
							_UpperCAmelCase      =						(
							    {
							        """feature-extraction""": DistilBertModel,
							        """fill-mask""": DistilBertForMaskedLM,
							        """question-answering""": DistilBertForQuestionAnswering,
							        """text-classification""": DistilBertForSequenceClassification,
							        """token-classification""": DistilBertForTokenClassification,
							        """zero-shot""": DistilBertForSequenceClassification,
							    }
							    if is_torch_available()
							    else {}
							)
							_UpperCAmelCase      =						True
							_UpperCAmelCase      =						True
							_UpperCAmelCase      =						True
							_UpperCAmelCase      =						True






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     List[str]					=					DistilBertModelTester(self       )
										SCREAMING_SNAKE_CASE_		:     List[str]					=					ConfigTester(self			,						config_class=lowerCAmelCase__			,						dim=3_7       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										self.config_tester.run_common_tests()






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Tuple					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_distilbert_model(*lowerCAmelCase__       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Any					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_distilbert_for_masked_lm(*lowerCAmelCase__       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_distilbert_for_question_answering(*lowerCAmelCase__       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_distilbert_for_sequence_classification(*lowerCAmelCase__       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_distilbert_for_token_classification(*lowerCAmelCase__       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_distilbert_for_multiple_choice(*lowerCAmelCase__       )






							@slow
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										for model_name in DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
													SCREAMING_SNAKE_CASE_		:     List[Any]					=					DistilBertModel.from_pretrained(lowerCAmelCase__       )
													self.assertIsNotNone(lowerCAmelCase__       )






							@slow
							@require_torch_gpu
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					self.model_tester.prepare_config_and_inputs_for_common()
										for model_class in self.all_model_classes:
													# BertForMultipleChoice behaves incorrectly in JIT environments.
													if model_class == DistilBertForMultipleChoice:
																return

													SCREAMING_SNAKE_CASE_		:     str					=					True
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					model_class(config=lowerCAmelCase__       )

													SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					self._prepare_for_class(lowerCAmelCase__			,						lowerCAmelCase__       )
													SCREAMING_SNAKE_CASE_		:     List[str]					=					torch.jit.trace(
													    lowerCAmelCase__			,						(inputs_dict['input_ids'].to('cpu'       ), inputs_dict['attention_mask'].to('cpu'       ))       )

													with tempfile.TemporaryDirectory() as tmp:
																torch.jit.save(lowerCAmelCase__			,						os.path.join(lowerCAmelCase__			,						'traced_model.pt'       )       )
																SCREAMING_SNAKE_CASE_		:     Any					=					torch.jit.load(os.path.join(lowerCAmelCase__			,						'traced_model.pt'       )			,						map_location=lowerCAmelCase__       )
																loaded(inputs_dict['input_ids'].to(lowerCAmelCase__       )			,						inputs_dict['attention_mask'].to(lowerCAmelCase__       )       )







@require_torch
class 	__lowercase    (unittest.TestCase  ):





							"""simple docstring"""







							@slow
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					DistilBertModel.from_pretrained('distilbert-base-uncased'       )
										SCREAMING_SNAKE_CASE_		:     str					=					torch.tensor([[0, 3_4_5, 2_3_2, 3_2_8, 7_4_0, 1_4_0, 1_6_9_5, 6_9, 6_0_7_8, 1_5_8_8, 2]]       )
										SCREAMING_SNAKE_CASE_		:     Tuple					=					torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]       )
										with torch.no_grad():
													SCREAMING_SNAKE_CASE_		:     Any					=					model(lowerCAmelCase__			,						attention_mask=lowerCAmelCase__       )[0]
										SCREAMING_SNAKE_CASE_		:     Dict					=					torch.Size((1, 1_1, 7_6_8)       )
										self.assertEqual(output.shape			,						lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     str					=					torch.tensor(
										    [[[-0.1_639, 0.3_299, 0.1_648], [-0.1_746, 0.3_289, 0.1_710], [-0.1_884, 0.3_357, 0.1_810]]]       )

										self.assertTrue(torch.allclose(output[:, 1:4, 1:4]			,						lowerCAmelCase__			,						atol=1E-4       )       )









import unittest

import numpy as np

from transformers import RobertaConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_flax_available():
				from transformers.models.roberta.modeling_flax_roberta import (
				    FlaxRobertaForCausalLM,
				    FlaxRobertaForMaskedLM,
				    FlaxRobertaForMultipleChoice,
				    FlaxRobertaForQuestionAnswering,
				    FlaxRobertaForSequenceClassification,
				    FlaxRobertaForTokenClassification,
				    FlaxRobertaModel,
				)







class 	__lowercase    (unittest.TestCase  ):





							"""simple docstring"""







							def __init__(      self			,						lowerCAmelCase__			,						lowerCAmelCase__=1_3			,						lowerCAmelCase__=7			,						lowerCAmelCase__=True			,						lowerCAmelCase__=True			,						lowerCAmelCase__=True			,						lowerCAmelCase__=True			,						lowerCAmelCase__=9_9			,						lowerCAmelCase__=3_2			,						lowerCAmelCase__=5			,						lowerCAmelCase__=4			,						lowerCAmelCase__=3_7			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=5_1_2			,						lowerCAmelCase__=1_6			,						lowerCAmelCase__=2			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=4			,						):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Dict					=					parent
										SCREAMING_SNAKE_CASE_		:     List[str]					=					batch_size
										SCREAMING_SNAKE_CASE_		:     Dict					=					seq_length
										SCREAMING_SNAKE_CASE_		:     Any					=					is_training
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					use_attention_mask
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					use_token_type_ids
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					use_labels
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					vocab_size
										SCREAMING_SNAKE_CASE_		:     Dict					=					hidden_size
										SCREAMING_SNAKE_CASE_		:     Any					=					num_hidden_layers
										SCREAMING_SNAKE_CASE_		:     List[str]					=					num_attention_heads
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					intermediate_size
										SCREAMING_SNAKE_CASE_		:     int					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					hidden_dropout_prob
										SCREAMING_SNAKE_CASE_		:     str					=					attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE_		:     Tuple					=					max_position_embeddings
										SCREAMING_SNAKE_CASE_		:     Any					=					type_vocab_size
										SCREAMING_SNAKE_CASE_		:     str					=					type_sequence_label_size
										SCREAMING_SNAKE_CASE_		:     str					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					num_choices






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					ids_tensor([self.batch_size, self.seq_length]			,						self.vocab_size       )

										SCREAMING_SNAKE_CASE_		:     str					=					None
										if self.use_attention_mask:
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					random_attention_mask([self.batch_size, self.seq_length]       )

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

										SCREAMING_SNAKE_CASE_		:     Any					=					RobertaConfig(
										    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			,						is_decoder=lowerCAmelCase__			,						initializer_range=self.initializer_range			,						)

										return config, input_ids, token_type_ids, attention_mask






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     str					=					self.prepare_config_and_inputs()
										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     str					=					config_and_inputs
										SCREAMING_SNAKE_CASE_		:     List[str]					=					{'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': attention_mask}
										return config, inputs_dict






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     List[str]					=					self.prepare_config_and_inputs()
										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					config_and_inputs

										SCREAMING_SNAKE_CASE_		:     str					=					True
										SCREAMING_SNAKE_CASE_		:     Dict					=					floats_tensor([self.batch_size, self.seq_length, self.hidden_size]       )
										SCREAMING_SNAKE_CASE_		:     int					=					ids_tensor([self.batch_size, self.seq_length]			,						vocab_size=2       )

										return (
										    config,
										    input_ids,
										    token_type_ids,
										    encoder_hidden_states,
										    encoder_attention_mask,
										)







@require_flax
class 	__lowercase    (__SCREAMING_SNAKE_CASE	,       unittest.TestCase  ):





							"""simple docstring"""







							_UpperCAmelCase      =						True

							_UpperCAmelCase      =						(
							    (
							        FlaxRobertaModel,
							        FlaxRobertaForCausalLM,
							        FlaxRobertaForMaskedLM,
							        FlaxRobertaForSequenceClassification,
							        FlaxRobertaForTokenClassification,
							        FlaxRobertaForMultipleChoice,
							        FlaxRobertaForQuestionAnswering,
							    )
							    if is_flax_available()
							    else ()
							)






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Any					=					FlaxRobertaModelTester(self       )






							@slow
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										for model_class_name in self.all_model_classes:
													SCREAMING_SNAKE_CASE_		:     List[str]					=					model_class_name.from_pretrained('roberta-base'			,						from_pt=lowerCAmelCase__       )
													SCREAMING_SNAKE_CASE_		:     str					=					model(np.ones((1, 1)       )       )
													self.assertIsNotNone(lowerCAmelCase__       )





