





'''simple docstring'''

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__				(				lowercase					:     Optional[int]      )		->		Optional[Any]:





     """simple docstring"""

     return EnvironmentCommand()







def 					a__				(				lowercase					:     List[Any]      )		->		List[str]:





     """simple docstring"""

     return EnvironmentCommand(args.accelerate_config_file      )




class 				__lowerCAmelCase     (    __snake_case ):






       """simple docstring"""





       @staticmethod
       def snake_case__						(							lowerCAmelCase__   :		Union[str, Any]     )    ->     List[Any]:

            '''simple docstring'''




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





       def __init__(							self   :		List[Any]       , lowerCAmelCase__   :		List[Any]       , *lowerCAmelCase__   :		int     )    ->     Optional[Any]:

            '''simple docstring'''




            _UpperCamelCase				    =       accelerate_config_file





       def snake_case__						(							self   :		Optional[Any]     )    ->     List[Any]:

            '''simple docstring'''




            _UpperCamelCase				    =       "not installed"
            if is_safetensors_available():
                 import safetensors

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

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

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

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

                 _UpperCamelCase				    =       (
                     "\n".join([f"""\t- {prop}: {val}""" for prop, val in accelerate_config.items()]     )
                     if isinstance(A_       , A_     )
                     else f"""\t{accelerate_config}"""
                 )

            _UpperCamelCase				    =       "not installed"
            _UpperCamelCase				    =       "NA"
            if is_torch_available():
                 import torch

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

            _UpperCamelCase				    =       "not installed"
            _UpperCamelCase				    =       "NA"
            if is_tf_available():
                 import tensorflow as tf

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

            _UpperCamelCase				    =       "not installed"
            _UpperCamelCase				    =       "not installed"
            _UpperCamelCase				    =       "not installed"
            _UpperCamelCase				    =       "NA"
            if is_flax_available():
                 import flax
                 import jax
                 import jaxlib

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

            _UpperCamelCase				    =       {
                "`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(A_     )     )

            return info







       @staticmethod
       def snake_case__						(							lowerCAmelCase__   :		str     )    ->     str:

            '''simple docstring'''




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










from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__lowerCamelCase       :     str   =     logging.get_logger(__name__)

__lowerCamelCase       :     str   =     {
    """facebook/convnextv2-tiny-1k-224""": """https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json""",
}



class 					A__   (       __snake_case       ,   __snake_case			):
      _UpperCAmelCase	:Optional[int]						    =   'convnextv2'





      def __init__( self       ,							A_=3       ,							A_=4       ,							A_=4       ,							A_=None       ,							A_=None       ,							A_="gelu"       ,							A_=0.02       ,							A_=1e-12       ,							A_=0.0       ,							A_=224       ,							A_=None       ,							A_=None       ,							**A_       ,							):
       '''simple docstring'''




       super().__init__(**A_   )

       UpperCamelCase	:					Dict       	=   num_channels
       UpperCamelCase	:					Union[str, Any]       	=   patch_size
       UpperCamelCase	:					Union[str, Any]       	=   num_stages
       UpperCamelCase	:					List[Any]       	=   [96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
       UpperCamelCase	:					List[str]       	=   [3, 3, 9, 3] if depths is None else depths
       UpperCamelCase	:					Dict       	=   hidden_act
       UpperCamelCase	:					Union[str, Any]       	=   initializer_range
       UpperCamelCase	:					Tuple       	=   layer_norm_eps
       UpperCamelCase	:					str       	=   drop_path_rate
       UpperCamelCase	:					List[str]       	=   image_size
       UpperCamelCase	:					List[str]       	=   ["stem"] + [F"""stage{idx}""" for idx in range(1       ,							len(self.depths   ) + 1   )]
       UpperCamelCase	,    UpperCamelCase	:					str       	=   get_aligned_output_features_output_indices(
           out_features=A_       ,							out_indices=A_       ,							stage_names=self.stage_names   )
