






'''simple docstring'''







from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
			from transformers import (
			    AutoConfig,
			    BertConfig,
			    GPTaConfig,
			    TaConfig,
			    TFAutoModel,
			    TFAutoModelForCausalLM,
			    TFAutoModelForMaskedLM,
			    TFAutoModelForPreTraining,
			    TFAutoModelForQuestionAnswering,
			    TFAutoModelForSeqaSeqLM,
			    TFAutoModelForSequenceClassification,
			    TFAutoModelWithLMHead,
			    TFBertForMaskedLM,
			    TFBertForPreTraining,
			    TFBertForQuestionAnswering,
			    TFBertForSequenceClassification,
			    TFBertModel,
			    TFGPTaLMHeadModel,
			    TFRobertaForMaskedLM,
			    TFTaForConditionalGeneration,
			)
			from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
			from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
			from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST

if is_torch_available():
			from transformers import (
			    AutoModel,
			    AutoModelForCausalLM,
			    AutoModelForMaskedLM,
			    AutoModelForPreTraining,
			    AutoModelForQuestionAnswering,
			    AutoModelForSeqaSeqLM,
			    AutoModelForSequenceClassification,
			    AutoModelWithLMHead,
			    BertForMaskedLM,
			    BertForPreTraining,
			    BertForQuestionAnswering,
			    BertForSequenceClassification,
			    BertModel,
			    GPTaLMHeadModel,
			    RobertaForMaskedLM,
			    TaForConditionalGeneration,
			)

@is_pt_tf_cross_test
class _lowercase			(       unittest.TestCase	):




							@slow
							def 	lowerCamelCase_       (							self:       int  ):
														# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														for model_name in ["bert-base-uncased"]:
																					lowerCamelCase__      :			List[str] 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			List[Any] 						= TFAutoModel.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Dict 						= AutoModel.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       List[str]  ):
														# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														for model_name in ["bert-base-uncased"]:
																					lowerCamelCase__      :			List[Any] 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Optional[Any] 						= TFAutoModelForPreTraining.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			List[str] 						= AutoModelForPreTraining.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       Optional[int]  ):
														for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																					lowerCamelCase__      :			Any 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Union[str, Any] 						= TFAutoModelForCausalLM.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					lowerCamelCase__						,	lowerCamelCase__      :			int 						= TFAutoModelForCausalLM.from_pretrained(
																					    UpperCamelCase__    ,							output_loading_info=UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Tuple 						= AutoModelForCausalLM.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					lowerCamelCase__						,	lowerCamelCase__      :			Optional[Any] 						= AutoModelForCausalLM.from_pretrained(
																					    UpperCamelCase__    ,							output_loading_info=UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       List[Any]  ):
														for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																					lowerCamelCase__      :			Dict 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			List[str] 						= TFAutoModelWithLMHead.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Any 						= AutoModelWithLMHead.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       Optional[int]  ):
														for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																					lowerCamelCase__      :			List[Any] 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			int 						= TFAutoModelForMaskedLM.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					lowerCamelCase__						,	lowerCamelCase__      :			Union[str, Any] 						= TFAutoModelForMaskedLM.from_pretrained(
																					    UpperCamelCase__    ,							output_loading_info=UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Dict 						= AutoModelForMaskedLM.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					lowerCamelCase__						,	lowerCamelCase__      :			Any 						= AutoModelForMaskedLM.from_pretrained(
																					    UpperCamelCase__    ,							output_loading_info=UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       Tuple  ):
														for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																					lowerCamelCase__      :			int 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			str 						= TFAutoModelForSeqaSeqLM.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					lowerCamelCase__						,	lowerCamelCase__      :			str 						= TFAutoModelForSeqaSeqLM.from_pretrained(
																					    UpperCamelCase__    ,							output_loading_info=UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Tuple 						= AutoModelForSeqaSeqLM.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					lowerCamelCase__						,	lowerCamelCase__      :			Optional[int] 						= AutoModelForSeqaSeqLM.from_pretrained(
																					    UpperCamelCase__    ,							output_loading_info=UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       Tuple  ):
														# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														for model_name in ["bert-base-uncased"]:
																					lowerCamelCase__      :			List[Any] 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			str 						= TFAutoModelForSequenceClassification.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			int 						= AutoModelForSequenceClassification.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       str  ):
														# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														for model_name in ["bert-base-uncased"]:
																					lowerCamelCase__      :			Optional[int] 						= AutoConfig.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			Any 						= TFAutoModelForQuestionAnswering.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )

																					lowerCamelCase__      :			List[str] 						= AutoModelForQuestionAnswering.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )
																					self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )




							def 	lowerCamelCase_       (							self:       Union[str, Any]  ):
														lowerCamelCase__      :			List[str] 						= TFAutoModelWithLMHead.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														self.assertEqual(model.num_parameters()    ,							14_410  )
														self.assertEqual(model.num_parameters(only_trainable=UpperCamelCase__  )    ,							14_410  )

														lowerCamelCase__      :			Union[str, Any] 						= AutoModelWithLMHead.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														self.assertEqual(model.num_parameters()    ,							14_410  )
														self.assertEqual(model.num_parameters(only_trainable=UpperCamelCase__  )    ,							14_410  )




							def 	lowerCamelCase_       (							self:       Tuple  ):
														lowerCamelCase__      :			Optional[Any] 						= TFAutoModelWithLMHead.from_pretrained(UpperCamelCase__    ,							from_pt=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														self.assertEqual(model.num_parameters()    ,							14_410  )
														self.assertEqual(model.num_parameters(only_trainable=UpperCamelCase__  )    ,							14_410  )

														lowerCamelCase__      :			Tuple 						= AutoModelWithLMHead.from_pretrained(UpperCamelCase__    ,							from_tf=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														self.assertEqual(model.num_parameters()    ,							14_410  )
														self.assertEqual(model.num_parameters(only_trainable=UpperCamelCase__  )    ,							14_410  )









'''simple docstring'''







# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# this script dumps information about the environment

import os
import platform
import sys


_A			:    Dict					  ='''3'''

print('''Python version:''', sys.version)

print('''OS platform:''', platform.platform())
print('''OS architecture:''', platform.machine())

try:
			import torch

			print('''Torch version:''', torch.__version__)
			print('''Cuda available:''', torch.cuda.is_available())
			print('''Cuda version:''', torch.version.cuda)
			print('''CuDNN version:''', torch.backends.cudnn.version())
			print('''Number of GPUs available:''', torch.cuda.device_count())
except ImportError:
			print('''Torch version:''', None)

try:
			import transformers

			print('''transformers version:''', transformers.__version__)
except ImportError:
			print('''transformers version:''', None)

