
'''simple docstring'''
from __future__ import annotations

import unittest

from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, 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 tensorflow as tf

    from transformers import (
        TFRoFormerForCausalLM,
        TFRoFormerForMaskedLM,
        TFRoFormerForMultipleChoice,
        TFRoFormerForQuestionAnswering,
        TFRoFormerForSequenceClassification,
        TFRoFormerForTokenClassification,
        TFRoFormerModel,
    )
    from transformers.models.roformer.modeling_tf_roformer import (
        TFRoFormerSelfAttention,
        TFRoFormerSinusoidalPositionalEmbedding,
    )


class        a__  :


   def __init__(			self      ,    _UpperCamelCase      ,    _UpperCamelCase=13      ,    _UpperCamelCase=7      ,    _UpperCamelCase=True      ,    _UpperCamelCase=True      ,    _UpperCamelCase=True      ,    _UpperCamelCase=True      ,    _UpperCamelCase=99      ,    _UpperCamelCase=32      ,    _UpperCamelCase=2      ,    _UpperCamelCase=4      ,    _UpperCamelCase=37      ,    _UpperCamelCase="gelu"      ,    _UpperCamelCase=0.1      ,    _UpperCamelCase=0.1      ,    _UpperCamelCase=512      ,    _UpperCamelCase=16      ,    _UpperCamelCase=2      ,    _UpperCamelCase=0.0_2      ,    _UpperCamelCase=3      ,    _UpperCamelCase=4      ,    _UpperCamelCase=None      ,    ):





      """simple docstring"""





      _lowercase      :				List[Any]      					=       parent
      _lowercase      :				str      					=       13
      _lowercase      :				Optional[int]      					=       7
      _lowercase      :				Union[str, Any]      					=       True
      _lowercase      :				Union[str, Any]      					=       True
      _lowercase      :				List[str]      					=       True
      _lowercase      :				Union[str, Any]      					=       True
      _lowercase      :				str      					=       99
      _lowercase      :				int      					=       32
      _lowercase      :				Dict      					=       2
      _lowercase      :				Union[str, Any]      					=       4
      _lowercase      :				Dict      					=       37
      _lowercase      :				List[str]      					=       """gelu"""
      _lowercase      :				List[str]      					=       0.1
      _lowercase      :				Union[str, Any]      					=       0.1
      _lowercase      :				List[Any]      					=       512
      _lowercase      :				Optional[int]      					=       16
      _lowercase      :				Dict      					=       2
      _lowercase      :				List[str]      					=       0.0_2
      _lowercase      :				List[Any]      					=       3
      _lowercase      :				Any      					=       4
      _lowercase      :				Union[str, Any]      					=       None


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





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

      _lowercase      :				Union[str, Any]      					=       None
      if self.use_input_mask:
         _lowercase      :				int      					=       random_attention_mask([self.batch_size, self.seq_length]  )

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

      _lowercase      :				Any      					=       None
      _lowercase      :				List[Any]      					=       None
      _lowercase      :				Union[str, Any]      					=       None
      if self.use_labels:
         _lowercase      :				List[Any]      					=       ids_tensor([self.batch_size]      ,    self.type_sequence_label_size  )
         _lowercase      :				List[Any]      					=       ids_tensor([self.batch_size, self.seq_length]      ,    self.num_labels  )
         _lowercase      :				Any      					=       ids_tensor([self.batch_size]      ,    self.num_choices  )

      _lowercase      :				int      					=       RoFormerConfig(
          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      ,    initializer_range=self.initializer_range      ,    return_dict=_lowerCAmelCase      ,    )

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


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				Optional[int]      					=       TFRoFormerModel(config=_lowerCAmelCase  )
      _lowercase      :				List[Any]      					=       {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}

      _lowercase      :				Union[str, Any]      					=       [input_ids, input_mask]
      _lowercase      :				Optional[int]      					=       model(_lowerCAmelCase  )

      _lowercase      :				str      					=       model(_lowerCAmelCase  )

      self.parent.assertEqual(result.last_hidden_state.shape      ,    (self.batch_size, self.seq_length, self.hidden_size)  )


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				List[str]      					=       True
      _lowercase      :				List[str]      					=       TFRoFormerForCausalLM(config=_lowerCAmelCase  )
      _lowercase      :				List[Any]      					=       {
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }
      _lowercase      :				Union[str, Any]      					=       model(_lowerCAmelCase  )["""logits"""]
      self.parent.assertListEqual(
          list(prediction_scores.numpy().shape  )      ,    [self.batch_size, self.seq_length, self.vocab_size]  )


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				Any      					=       TFRoFormerForMaskedLM(config=_lowerCAmelCase  )
      _lowercase      :				Union[str, Any]      					=       {
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }
      _lowercase      :				str      					=       model(_lowerCAmelCase  )
      self.parent.assertEqual(result.logits.shape      ,    (self.batch_size, self.seq_length, self.vocab_size)  )


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				List[Any]      					=       self.num_labels
      _lowercase      :				List[str]      					=       TFRoFormerForSequenceClassification(config=_lowerCAmelCase  )
      _lowercase      :				Union[str, Any]      					=       {
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }

      _lowercase      :				Dict      					=       model(_lowerCAmelCase  )
      self.parent.assertEqual(result.logits.shape      ,    (self.batch_size, self.num_labels)  )


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				Dict      					=       self.num_choices
      _lowercase      :				Optional[Any]      					=       TFRoFormerForMultipleChoice(config=_lowerCAmelCase  )
      _lowercase      :				str      					=       tf.tile(tf.expand_dims(_lowerCAmelCase      ,    1  )      ,    (1, self.num_choices, 1)  )
      _lowercase      :				Optional[int]      					=       tf.tile(tf.expand_dims(_lowerCAmelCase      ,    1  )      ,    (1, self.num_choices, 1)  )
      _lowercase      :				List[str]      					=       tf.tile(tf.expand_dims(_lowerCAmelCase      ,    1  )      ,    (1, self.num_choices, 1)  )
      _lowercase      :				List[str]      					=       {
          """input_ids""": multiple_choice_inputs_ids,
          """attention_mask""": multiple_choice_input_mask,
          """token_type_ids""": multiple_choice_token_type_ids,
      }
      _lowercase      :				Tuple      					=       model(_lowerCAmelCase  )
      self.parent.assertEqual(result.logits.shape      ,    (self.batch_size, self.num_choices)  )


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				str      					=       self.num_labels
      _lowercase      :				List[Any]      					=       TFRoFormerForTokenClassification(config=_lowerCAmelCase  )
      _lowercase      :				str      					=       {
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }
      _lowercase      :				Optional[Any]      					=       model(_lowerCAmelCase  )
      self.parent.assertEqual(result.logits.shape      ,    (self.batch_size, self.seq_length, self.num_labels)  )


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				Optional[Any]      					=       TFRoFormerForQuestionAnswering(config=_lowerCAmelCase  )
      _lowercase      :				Optional[int]      					=       {
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }

      _lowercase      :				List[str]      					=       model(_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 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				List[Any]      					=       self.prepare_config_and_inputs()
      (
          _lowercase				
      )      :				Optional[int]      					=       config_and_inputs
      _lowercase      :				List[Any]      					=       {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
      return config, inputs_dict




@require_tf
class        a__  (							__UpperCamelCase  ,				__UpperCamelCase  ,				unittest.TestCase  ):
   _SCREAMING_SNAKE_CASE   :					Union[str, Any]     	=							(
       (
           TFRoFormerModel,
           TFRoFormerForCausalLM,
           TFRoFormerForMaskedLM,
           TFRoFormerForQuestionAnswering,
           TFRoFormerForSequenceClassification,
           TFRoFormerForTokenClassification,
           TFRoFormerForMultipleChoice,
       )
       if is_tf_available()
       else ()
   )
   _SCREAMING_SNAKE_CASE   :					str     	=							(
       {
           "feature-extraction": TFRoFormerModel,
           "fill-mask": TFRoFormerForMaskedLM,
           "question-answering": TFRoFormerForQuestionAnswering,
           "text-classification": TFRoFormerForSequenceClassification,
           "text-generation": TFRoFormerForCausalLM,
           "token-classification": TFRoFormerForTokenClassification,
           "zero-shot": TFRoFormerForSequenceClassification,
       }
       if is_tf_available()
       else {}
   )

   _SCREAMING_SNAKE_CASE   :					Optional[int]     	=							False
   _SCREAMING_SNAKE_CASE   :					Optional[int]     	=							False


   def 						_lowerCamelCase       (			self      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase      ,    _UpperCamelCase  ):





      """simple docstring"""





      if pipeline_test_casse_name == "TextGenerationPipelineTests":
         return True

      return False


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				List[Any]      					=       TFRoFormerModelTester(self  )
      _lowercase      :				Dict      					=       ConfigTester(self      ,    config_class=_lowerCAmelCase      ,    hidden_size=37  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      self.config_tester.run_common_tests()


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				List[Any]      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_model(*_lowerCAmelCase  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Optional[Any]      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_masked_lm(*_lowerCAmelCase  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Tuple      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_lm_head(*_lowerCAmelCase  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				str      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_multiple_choice(*_lowerCAmelCase  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Dict      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_question_answering(*_lowerCAmelCase  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				List[str]      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_sequence_classification(*_lowerCAmelCase  )


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				List[Any]      					=       self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_token_classification(*_lowerCAmelCase  )






   @slow
   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Union[str, Any]      					=       TFRoFormerModel.from_pretrained("junnyu/roformer_chinese_base"  )
      self.assertIsNotNone(_lowerCAmelCase  )




@require_tf
class        a__  (							unittest.TestCase  ):


   @slow
   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Any      					=       TFRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_base"  )
      _lowercase      :				Union[str, Any]      					=       tf.constant([[0, 1, 2, 3, 4, 5]]  )
      _lowercase      :				Dict      					=       model(_lowerCAmelCase  )[0]

      # TODO Replace vocab size
      _lowercase      :				Any      					=       50000

      _lowercase      :				Union[str, Any]      					=       [1, 6, vocab_size]
      self.assertEqual(output.shape      ,    _lowerCAmelCase  )

      print(output[:, :3, :3]  )

      # TODO Replace values below with what was printed above.
      _lowercase      :				str      					=       tf.constant(
          [
              [
                  [-0.1_2_0_5_3_3_4_1, -1.0_2_6_4_9_0_1, 0.2_9_2_2_1_9_4_6],
                  [-1.5_1_3_3_7_8_3, 0.1_9_7_4_3_3, 0.1_5_1_9_0_6_0_7],
                  [-5.0_1_3_5_4_0_3, -3.9_0_0_2_5_6, -0.8_4_0_3_8_7_6_4],
              ]
          ]  )
      tf.debugging.assert_near(output[:, :3, :3]      ,    _lowerCAmelCase      ,    atol=1E-4  )




@require_tf
class        a__  (							unittest.TestCase  ):
   _SCREAMING_SNAKE_CASE   :					List[str]     	=							1E-4


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				List[str]      					=       tf.constant([[4, 10]]  )
      _lowercase      :				int      					=       TFRoFormerSinusoidalPositionalEmbedding(num_positions=6      ,    embedding_dim=6  )

      _lowercase      :				Tuple      					=       emba(input_ids.shape  )
      _lowercase      :				str      					=       tf.constant(
          [[0.0_0_0_0, 0.0_0_0_0, 0.0_0_0_0, 1.0_0_0_0, 1.0_0_0_0, 1.0_0_0_0], [0.8_4_1_5, 0.0_4_6_4, 0.0_0_2_2, 0.5_4_0_3, 0.9_9_8_9, 1.0_0_0_0]]  )

      tf.debugging.assert_near(_lowerCAmelCase      ,    _lowerCAmelCase      ,    atol=self.tolerance  )






   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Optional[int]      					=       tf.constant(
          [
              [0.0_0_0_0, 0.0_0_0_0, 0.0_0_0_0, 0.0_0_0_0, 0.0_0_0_0],
              [0.8_4_1_5, 0.8_2_1_9, 0.8_0_2_0, 0.7_8_1_9, 0.7_6_1_7],
              [0.9_0_9_3, 0.9_3_6_4, 0.9_5_8_1, 0.9_7_4_9, 0.9_8_7_0],
          ]  )
      _lowercase      :				List[Any]      					=       TFRoFormerSinusoidalPositionalEmbedding(num_positions=512      ,    embedding_dim=512  )
      emba([2, 16, 512]  )
      _lowercase      :				str      					=       emba.weight[:3, :5]

      tf.debugging.assert_near(_lowerCAmelCase      ,    _lowerCAmelCase      ,    atol=self.tolerance  )




@require_tf
class        a__  (							unittest.TestCase  ):
   _SCREAMING_SNAKE_CASE   :					Any     	=							1E-4


   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				Dict      					=       tf.reshape(tf.range(2 * 12 * 16 * 64      ,    dtype=tf.floataa  )      ,    shape=(2, 12, 16, 64)  ) / 100

      _lowercase      :				Optional[Any]      					=       -tf.reshape(tf.range(2 * 12 * 16 * 64      ,    dtype=tf.floataa  )      ,    shape=(2, 12, 16, 64)  ) / 100

      _lowercase      :				Union[str, Any]      					=       TFRoFormerSinusoidalPositionalEmbedding(num_positions=32      ,    embedding_dim=64  )
      _lowercase      :				Any      					=       embed_positions([2, 16, 768]  )[None, None, :, :]

      _lowercase      :				Optional[int]      					=       TFRoFormerSelfAttention.apply_rotary_position_embeddings(
          _lowerCAmelCase      ,    _lowerCAmelCase      ,    _lowerCAmelCase  )

      _lowercase      :				List[str]      					=       tf.constant(
          [
              [0.0_0_0_0, 0.0_1_0_0, 0.0_2_0_0, 0.0_3_0_0, 0.0_4_0_0, 0.0_5_0_0, 0.0_6_0_0, 0.0_7_0_0],
              [-0.2_0_1_2, 0.8_8_9_7, 0.0_2_6_3, 0.9_4_0_1, 0.2_0_7_4, 0.9_4_6_3, 0.3_4_8_1, 0.9_3_4_3],
              [-1.7_0_5_7, 0.6_2_7_1, -1.2_1_4_5, 1.3_8_9_7, -0.6_3_0_3, 1.7_6_4_7, -0.1_1_7_3, 1.8_9_8_5],
              [-2.1_7_3_1, -1.6_3_9_7, -2.7_3_5_8, 0.2_8_5_4, -2.1_8_4_0, 1.7_1_8_3, -1.3_0_1_8, 2.4_8_7_1],
              [0.2_7_1_7, -3.6_1_7_3, -2.9_2_0_6, -2.1_9_8_8, -3.6_6_3_8, 0.3_8_5_8, -2.9_1_5_5, 2.2_9_8_0],
              [3.9_8_5_9, -2.1_5_8_0, -0.7_9_8_4, -4.4_9_0_4, -4.1_1_8_1, -2.0_2_5_2, -4.4_7_8_2, 1.1_2_5_3],
          ]  )
      _lowercase      :				Tuple      					=       tf.constant(
          [
              [0.0_0_0_0, -0.0_1_0_0, -0.0_2_0_0, -0.0_3_0_0, -0.0_4_0_0, -0.0_5_0_0, -0.0_6_0_0, -0.0_7_0_0],
              [0.2_0_1_2, -0.8_8_9_7, -0.0_2_6_3, -0.9_4_0_1, -0.2_0_7_4, -0.9_4_6_3, -0.3_4_8_1, -0.9_3_4_3],
              [1.7_0_5_7, -0.6_2_7_1, 1.2_1_4_5, -1.3_8_9_7, 0.6_3_0_3, -1.7_6_4_7, 0.1_1_7_3, -1.8_9_8_5],
              [2.1_7_3_1, 1.6_3_9_7, 2.7_3_5_8, -0.2_8_5_4, 2.1_8_4_0, -1.7_1_8_3, 1.3_0_1_8, -2.4_8_7_1],
              [-0.2_7_1_7, 3.6_1_7_3, 2.9_2_0_6, 2.1_9_8_8, 3.6_6_3_8, -0.3_8_5_8, 2.9_1_5_5, -2.2_9_8_0],
              [-3.9_8_5_9, 2.1_5_8_0, 0.7_9_8_4, 4.4_9_0_4, 4.1_1_8_1, 2.0_2_5_2, 4.4_7_8_2, -1.1_2_5_3],
          ]  )

      tf.debugging.assert_near(query_layer[0, 0, :6, :8]      ,    _lowerCAmelCase      ,    atol=self.tolerance  )
      tf.debugging.assert_near(key_layer[0, 0, :6, :8]      ,    _lowerCAmelCase      ,    atol=self.tolerance  )









'''simple docstring'''
from . import __version__

# Backward compatibility imports, to make sure all those objects can be found in file_utils
from .utils import (
    CLOUDFRONT_DISTRIB_PREFIX,
    CONFIG_NAME,
    DISABLE_TELEMETRY,
    DUMMY_INPUTS,
    DUMMY_MASK,
    ENV_VARS_TRUE_AND_AUTO_VALUES,
    ENV_VARS_TRUE_VALUES,
    FEATURE_EXTRACTOR_NAME,
    FLAX_WEIGHTS_NAME,
    HF_MODULES_CACHE,
    HUGGINGFACE_CO_PREFIX,
    HUGGINGFACE_CO_RESOLVE_ENDPOINT,
    MODEL_CARD_NAME,
    MULTIPLE_CHOICE_DUMMY_INPUTS,
    PYTORCH_PRETRAINED_BERT_CACHE,
    PYTORCH_TRANSFORMERS_CACHE,
    S3_BUCKET_PREFIX,
    SENTENCEPIECE_UNDERLINE,
    SPIECE_UNDERLINE,
    TF2_WEIGHTS_NAME,
    TF_WEIGHTS_NAME,
    TORCH_FX_REQUIRED_VERSION,
    TRANSFORMERS_CACHE,
    TRANSFORMERS_DYNAMIC_MODULE_NAME,
    USE_JAX,
    USE_TF,
    USE_TORCH,
    WEIGHTS_INDEX_NAME,
    WEIGHTS_NAME,
    ContextManagers,
    DummyObject,
    EntryNotFoundError,
    ExplicitEnum,
    ModelOutput,
    PaddingStrategy,
    PushToHubMixin,
    RepositoryNotFoundError,
    RevisionNotFoundError,
    TensorType,
    _LazyModule,
    add_code_sample_docstrings,
    add_end_docstrings,
    add_start_docstrings,
    add_start_docstrings_to_model_forward,
    cached_property,
    copy_func,
    default_cache_path,
    define_sagemaker_information,
    get_cached_models,
    get_file_from_repo,
    get_full_repo_name,
    get_torch_version,
    has_file,
    http_user_agent,
    is_apex_available,
    is_bsa_available,
    is_coloredlogs_available,
    is_datasets_available,
    is_detectrona_available,
    is_faiss_available,
    is_flax_available,
    is_ftfy_available,
    is_in_notebook,
    is_ipex_available,
    is_librosa_available,
    is_offline_mode,
    is_onnx_available,
    is_pandas_available,
    is_phonemizer_available,
    is_protobuf_available,
    is_psutil_available,
    is_pyanvml_available,
    is_pyctcdecode_available,
    is_pytesseract_available,
    is_pytorch_quantization_available,
    is_rjieba_available,
    is_sagemaker_dp_enabled,
    is_sagemaker_mp_enabled,
    is_scipy_available,
    is_sentencepiece_available,
    is_seqio_available,
    is_sklearn_available,
    is_soundfile_availble,
    is_spacy_available,
    is_speech_available,
    is_tensor,
    is_tensorflow_probability_available,
    is_tfaonnx_available,
    is_tf_available,
    is_timm_available,
    is_tokenizers_available,
    is_torch_available,
    is_torch_bfaa_available,
    is_torch_cuda_available,
    is_torch_fx_available,
    is_torch_fx_proxy,
    is_torch_mps_available,
    is_torch_tfaa_available,
    is_torch_tpu_available,
    is_torchaudio_available,
    is_training_run_on_sagemaker,
    is_vision_available,
    replace_return_docstrings,
    requires_backends,
    to_numpy,
    to_py_obj,
    torch_only_method,
)






