





"""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 			__UpperCamelCase							(		unittest.TestCase		):






							@slow
							def        __a  (  self )      ->					Any:

								for model_name in ["bert-base-uncased"]:
									a :						Optional[int]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Dict      =							TFAutoModel.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Optional[int]      =							AutoModel.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					Tuple:

								for model_name in ["bert-base-uncased"]:
									a :						List[str]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Optional[int]      =							TFAutoModelForPreTraining.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Dict      =							AutoModelForPreTraining.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					str:

								for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									a :						List[str]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Any      =							TFAutoModelForCausalLM.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									a :						Optional[Any]      =							TFAutoModelForCausalLM.from_pretrained(
									    _lowerCamelCase ,   output_loading_info=_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						List[str]      =							AutoModelForCausalLM.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									a :						List[Any]      =							AutoModelForCausalLM.from_pretrained(
									    _lowerCamelCase ,   output_loading_info=_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					Any:

								for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									a :						Optional[Any]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Any      =							TFAutoModelWithLMHead.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Any      =							AutoModelWithLMHead.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					Optional[Any]:

								for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									a :						List[str]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						int      =							TFAutoModelForMaskedLM.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									a :						List[Any]      =							TFAutoModelForMaskedLM.from_pretrained(
									    _lowerCamelCase ,   output_loading_info=_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Optional[Any]      =							AutoModelForMaskedLM.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									a :						str      =							AutoModelForMaskedLM.from_pretrained(
									    _lowerCamelCase ,   output_loading_info=_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					List[str]:

								for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									a :						Union[str, Any]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						List[str]      =							TFAutoModelForSeqaSeqLM.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									a :						Tuple      =							TFAutoModelForSeqaSeqLM.from_pretrained(
									    _lowerCamelCase ,   output_loading_info=_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Union[str, Any]      =							AutoModelForSeqaSeqLM.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									a :						int      =							AutoModelForSeqaSeqLM.from_pretrained(
									    _lowerCamelCase ,   output_loading_info=_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					Dict:

								for model_name in ["bert-base-uncased"]:
									a :						Optional[Any]      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						List[str]      =							TFAutoModelForSequenceClassification.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						List[str]      =							AutoModelForSequenceClassification.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							@slow
							def        __a  (  self )      ->					Dict:

								for model_name in ["bert-base-uncased"]:
									a :						Tuple      =							AutoConfig.from_pretrained(_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						Any      =							TFAutoModelForQuestionAnswering.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )

									a :						List[Any]      =							AutoModelForQuestionAnswering.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
									self.assertIsNotNone(_lowerCamelCase )
									self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )






							def        __a  (  self )      ->					List[Any]:
								a :						str      =							TFAutoModelWithLMHead.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
								self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )
								self.assertEqual(model.num_parameters() ,   1_4410 )
								self.assertEqual(model.num_parameters(only_trainable=_lowerCamelCase ) ,   1_4410 )

								a :						int      =							AutoModelWithLMHead.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
								self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )
								self.assertEqual(model.num_parameters() ,   1_4410 )
								self.assertEqual(model.num_parameters(only_trainable=_lowerCamelCase ) ,   1_4410 )






							def        __a  (  self )      ->					List[str]:
								a :						List[str]      =							TFAutoModelWithLMHead.from_pretrained(_lowerCamelCase ,   from_pt=_lowerCamelCase )
								self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )
								self.assertEqual(model.num_parameters() ,   1_4410 )
								self.assertEqual(model.num_parameters(only_trainable=_lowerCamelCase ) ,   1_4410 )

								a :						List[Any]      =							AutoModelWithLMHead.from_pretrained(_lowerCamelCase ,   from_tf=_lowerCamelCase )
								self.assertIsInstance(_lowerCamelCase ,   _lowerCamelCase )
								self.assertEqual(model.num_parameters() ,   1_4410 )
								self.assertEqual(model.num_parameters(only_trainable=_lowerCamelCase ) ,   1_4410 )





"""simple docstring"""
# Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved.
#
# 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.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


_A							=  {
    """configuration_cpmant""": ["""CPMANT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CpmAntConfig"""],
    """tokenization_cpmant""": ["""CpmAntTokenizer"""],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _A							=  [
        """CPMANT_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """CpmAntForCausalLM""",
        """CpmAntModel""",
        """CpmAntPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_cpmant import CPMANT_PRETRAINED_CONFIG_ARCHIVE_MAP, CpmAntConfig
    from .tokenization_cpmant import CpmAntTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_cpmant import (
            CPMANT_PRETRAINED_MODEL_ARCHIVE_LIST,
            CpmAntForCausalLM,
            CpmAntModel,
            CpmAntPreTrainedModel,
        )


else:
    import sys

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

