




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


_lowerCamelCase							=      {
    '''configuration_speech_to_text_2''': ['''SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Speech2Text2Config'''],
    '''processing_speech_to_text_2''': ['''Speech2Text2Processor'''],
    '''tokenization_speech_to_text_2''': ['''Speech2Text2Tokenizer'''],
}


try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _lowerCamelCase							=      [
        '''SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''Speech2Text2ForCausalLM''',
        '''Speech2Text2PreTrainedModel''',
    ]


if TYPE_CHECKING:
    from .configuration_speech_to_text_a import SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextaConfig
    from .processing_speech_to_text_a import SpeechaTextaProcessor
    from .tokenization_speech_to_text_a import SpeechaTextaTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_speech_to_text_a import (
            SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST,
            SpeechaTextaForCausalLM,
            SpeechaTextaPreTrainedModel,
        )

else:
    import sys

    _lowerCamelCase							=      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






import math
from timeit import timeit





def 							lowerCamelCase    (							UpperCAmelCase_	:      int      )->			int:

       """simple docstring"""




       a			   =0
       a			   =abs(UpperCAmelCase_      )
       while True:
              a			   =n // 10
              digits += 1
              if n == 0:
                     break
       return digits





def 							lowerCamelCase    (							UpperCAmelCase_	:      int      )->			int:

       """simple docstring"""




       return 1 if n == 0 else math.floor(math.log(abs(UpperCAmelCase_      )   ,       10      ) + 1      )





def 							lowerCamelCase    (							UpperCAmelCase_	:      int      )->			int:

       """simple docstring"""




       return len(str(abs(UpperCAmelCase_      )      )      )





def 							lowerCamelCase    (							)->			None:

       """simple docstring"""




       from collections.abc import Callable

       def benchmark_a_function(UpperCAmelCase_	:      Callable   ,       UpperCAmelCase_	:      int      ) -> None:
              a			   =F'''{func.__name__}({value})'''
              a			   =timeit(F'''__main__.{call}'''   ,       setup="""import __main__"""      )
              print(F'''{call}: {func(UpperCAmelCase_      )} -- {timing} seconds'''      )

       for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
              for func in (num_digits, num_digits_fast, num_digits_faster):
                     benchmark_a_function(UpperCAmelCase_   ,       UpperCAmelCase_      )
              print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()
