






import importlib.util
import os
import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import (
    is_accelerate_available,
    is_flax_available,
    is_safetensors_available,
    is_tf_available,
    is_torch_available,
)
from . import BaseTransformersCLICommand
def 						_a    (      a :Any )							->			Dict:
 return EnvironmentCommand()
def 						_a    (      a :Optional[Any] )							->			List[Any]:
 return EnvironmentCommand(args.accelerate_config_file )






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      @staticmethod
      def       __lowerCAmelCase					(      __UpperCAmelCase      :						ArgumentParser  )    ->str:




       """simple docstring"""


       a		  =      parser.add_parser('''env'''  )
       download_parser.set_defaults(func=__UpperCAmelCase  )
       download_parser.add_argument(
           '''--accelerate-config_file''' ,					default=__UpperCAmelCase ,					help='''The accelerate config file to use for the default values in the launching script.''' ,					)
       download_parser.set_defaults(func=__UpperCAmelCase  )







      def __init__(      self      :						Union[str, Any] ,					__UpperCAmelCase      :						Any ,					*__UpperCAmelCase      :						List[Any]  )    ->None:




       """simple docstring"""


       a		  =      accelerate_config_file







      def       __lowerCAmelCase					(      self      :						int  )    ->Tuple:




       """simple docstring"""


       a		  =      '''not installed'''
       if is_safetensors_available():
        import safetensors

        a		  =      safetensors.__version__
       elif importlib.util.find_spec('''safetensors'''  ) is not None:
        import safetensors

        a		  =      F"""{safetensors.__version__} but is ignored because of PyTorch version too old."""

       a		  =      '''not installed'''
       a		  =      a		  =      '''not found'''
       if is_accelerate_available():
        import accelerate
        from accelerate.commands.config import default_config_file, load_config_from_file

        a		  =      accelerate.__version__
        # Get the default from the config file.
        if self._accelerate_config_file is not None or os.path.isfile(__UpperCAmelCase  ):
         a		  =      load_config_from_file(self._accelerate_config_file  ).to_dict()

        a		  =      (
            '''\n'''.join([F"""\t- {prop}: {val}""" for prop, val in accelerate_config.items()]  )
            if isinstance(__UpperCAmelCase ,					__UpperCAmelCase  )
            else F"""\t{accelerate_config}"""
        )

       a		  =      '''not installed'''
       a		  =      '''NA'''
       if is_torch_available():
        import torch

        a		  =      torch.__version__
        a		  =      torch.cuda.is_available()

       a		  =      '''not installed'''
       a		  =      '''NA'''
       if is_tf_available():
        import tensorflow as tf

        a		  =      tf.__version__
        try:
         # deprecated in v2.1
         a		  =      tf.test.is_gpu_available()
        except AttributeError:
         # returns list of devices, convert to bool
         a		  =      bool(tf.config.list_physical_devices('''GPU'''  )  )

       a		  =      '''not installed'''
       a		  =      '''not installed'''
       a		  =      '''not installed'''
       a		  =      '''NA'''
       if is_flax_available():
        import flax
        import jax
        import jaxlib

        a		  =      flax.__version__
        a		  =      jax.__version__
        a		  =      jaxlib.__version__
        a		  =      jax.lib.xla_bridge.get_backend().platform

       a		  =      {
           '''`transformers` version''': version,
           '''Platform''': platform.platform(),
           '''Python version''': platform.python_version(),
           '''Huggingface_hub version''': huggingface_hub.__version__,
           '''Safetensors version''': F"""{safetensors_version}""",
           '''Accelerate version''': F"""{accelerate_version}""",
           '''Accelerate config''': F"""{accelerate_config_str}""",
           '''PyTorch version (GPU?)''': F"""{pt_version} ({pt_cuda_available})""",
           '''Tensorflow version (GPU?)''': F"""{tf_version} ({tf_cuda_available})""",
           '''Flax version (CPU?/GPU?/TPU?)''': F"""{flax_version} ({jax_backend})""",
           '''Jax version''': F"""{jax_version}""",
           '''JaxLib version''': F"""{jaxlib_version}""",
           '''Using GPU in script?''': '''<fill in>''',
           '''Using distributed or parallel set-up in script?''': '''<fill in>''',
       }

       print('''\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n'''  )
       print(self.format_dict(__UpperCAmelCase  )  )

       return info







      @staticmethod
      def       __lowerCAmelCase					(      __UpperCAmelCase      :						List[Any]  )    ->Any:




       """simple docstring"""


       return "\n".join([F"""- {prop}: {val}""" for prop, val in d.items()]  ) + "\n"









from math import factorial




def 		lowerCAmelCase_    (  __UpperCAmelCase:			int		,   __UpperCAmelCase:			int      )      ->	int:

    # If either of the conditions are true, the function is being asked
    # to calculate a factorial of a negative number, which is not possible
    if n < k or k < 0:
        raise ValueError('''Please enter positive integers for n and k where n >= k'''      )
    return factorial(__UpperCAmelCase      ) // (factorial(__UpperCAmelCase      ) * factorial(n - k      ))


if __name__ == "__main__":
  print(
      'The number of five-card hands possible from a standard',
      F'''fifty-two card deck is: {combinations(52, 5)}\n''',
  )

  print(
      'If a class of 40 students must be arranged into groups of',
      F'''4 for group projects, there are {combinations(40, 4)} ways''',
      'to arrange them.\n',
  )

  print(
      'If 10 teams are competing in a Formula One race, there',
      F'''are {combinations(10, 3)} ways that first, second and''',
      'third place can be awarded.',
  )

