






'''simple docstring'''



import collections.abc
from typing import Optional, Tuple, Union

import torch
import torch.utils.checkpoint
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_poolformer import PoolFormerConfig


SCREAMING_SNAKE_CASE							=						logging.get_logger(__name__)

# General docstring
SCREAMING_SNAKE_CASE							=						'PoolFormerConfig'

# Base docstring
SCREAMING_SNAKE_CASE							=						'sail/poolformer_s12'
SCREAMING_SNAKE_CASE							=						[1, 512, 7, 7]

# Image classification docstring
SCREAMING_SNAKE_CASE							=						'sail/poolformer_s12'
SCREAMING_SNAKE_CASE							=						'tabby, tabby cat'

SCREAMING_SNAKE_CASE							=						[
    'sail/poolformer_s12',
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
]


def 				lowercase_					(     __A			:							Optional[Any]       ,   __A			:							float = 0.0       ,   __A			:							bool = False      )							->   Tuple:



 """simple docstring"""




 if drop_prob == 0.0 or not training:
  return input
 lowercase       : str						=1 - drop_prob
 lowercase       : int						=(input.shape[0],) + (1,) * (input.ndim - 1)  # work with diff dim tensors, not just 2D ConvNets
 lowercase       : int						=keep_prob + torch.rand(__A       ,   dtype=input.dtype       ,   device=input.device      )
 random_tensor.floor_()  # binarize
 lowercase       : int						=input.div(__A      ) * random_tensor
 return output
class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Dict  ,   UpperCAmelCase      :		Optional[float] = None		)	->	None:


       '''simple docstring'''

       super().__init__()
       lowercase       : Optional[Any]						=drop_prob






      def 					A__   (			self      :		Optional[Any]  ,   UpperCAmelCase      :		torch.Tensor		)	->	torch.Tensor:


       '''simple docstring'''

       return drop_path(UpperCAmelCase  ,   self.drop_prob  ,   self.training		)






      def 					A__   (			self      :		List[Any]		)	->	str:


       '''simple docstring'''

       return "p={}".format(self.drop_prob		)





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Tuple  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[int]  ,   UpperCAmelCase      :		int  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[Any]  ,   UpperCAmelCase      :		Union[str, Any]=None		)	->	Union[str, Any]:


       '''simple docstring'''

       super().__init__()
       lowercase       : Union[str, Any]						=patch_size if isinstance(UpperCAmelCase  ,   collections.abc.Iterable		) else (patch_size, patch_size)
       lowercase       : Optional[Any]						=stride if isinstance(UpperCAmelCase  ,   collections.abc.Iterable		) else (stride, stride)
       lowercase       : Dict						=padding if isinstance(UpperCAmelCase  ,   collections.abc.Iterable		) else (padding, padding)

       lowercase       : Tuple						=nn.Convad(UpperCAmelCase  ,   UpperCAmelCase  ,   kernel_size=UpperCAmelCase  ,   stride=UpperCAmelCase  ,   padding=UpperCAmelCase		)
       lowercase       : Tuple						=norm_layer(UpperCAmelCase		) if norm_layer else nn.Identity()






      def 					A__   (			self      :		Union[str, Any]  ,   UpperCAmelCase      :		List[Any]		)	->	int:


       '''simple docstring'''

       lowercase       : Optional[Any]						=self.projection(UpperCAmelCase		)
       lowercase       : Dict						=self.norm(UpperCAmelCase		)
       return embeddings





class UpperCAmelCase_       (     nn.GroupNorm					):




      """simple docstring"""




      def __init__(			self      :		int  ,   UpperCAmelCase      :		List[str]  ,   **UpperCAmelCase      :		int		)	->	List[Any]:


       '''simple docstring'''

       super().__init__(1  ,   UpperCAmelCase  ,   **UpperCAmelCase		)





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		List[str]  ,   UpperCAmelCase      :		List[str]		)	->	Tuple:


       '''simple docstring'''

       super().__init__()
       lowercase       : Optional[Any]						=nn.AvgPoolad(UpperCAmelCase  ,   stride=1  ,   padding=pool_size // 2  ,   count_include_pad=UpperCAmelCase		)






      def 					A__   (			self      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[Any]		)	->	int:


       '''simple docstring'''

       return self.pool(UpperCAmelCase		) - hidden_states





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Union[str, Any]  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		List[str]  ,   UpperCAmelCase      :		List[Any]  ,   UpperCAmelCase      :		List[str]		)	->	Optional[Any]:


       '''simple docstring'''

       super().__init__()
       lowercase       : List[str]						=nn.Convad(UpperCAmelCase  ,   UpperCAmelCase  ,   1		)
       lowercase       : List[str]						=nn.Convad(UpperCAmelCase  ,   UpperCAmelCase  ,   1		)
       lowercase       : int						=PoolFormerDropPath(UpperCAmelCase		)
       if isinstance(config.hidden_act  ,   UpperCAmelCase		):
        lowercase       : List[str]						=ACTaFN[config.hidden_act]
       else:
        lowercase       : str						=config.hidden_act






      def 					A__   (			self      :		str  ,   UpperCAmelCase      :		Optional[int]		)	->	Tuple:


       '''simple docstring'''

       lowercase       : int						=self.conva(UpperCAmelCase		)
       lowercase       : str						=self.act_fn(UpperCAmelCase		)
       lowercase       : str						=self.drop(UpperCAmelCase		)
       lowercase       : Optional[int]						=self.conva(UpperCAmelCase		)
       lowercase       : List[str]						=self.drop(UpperCAmelCase		)

       return hidden_states





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		List[str]  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		str  ,   UpperCAmelCase      :		List[Any]  ,   UpperCAmelCase      :		Optional[Any]  ,   UpperCAmelCase      :		Optional[Any]  ,   UpperCAmelCase      :		int		)	->	str:


       '''simple docstring'''

       super().__init__()
       lowercase       : Tuple						=PoolFormerPooling(UpperCAmelCase		)
       lowercase       : Dict						=PoolFormerOutput(UpperCAmelCase  ,   UpperCAmelCase  ,   UpperCAmelCase  ,   UpperCAmelCase		)
       lowercase       : Optional[Any]						=PoolFormerGroupNorm(UpperCAmelCase		)
       lowercase       : Union[str, Any]						=PoolFormerGroupNorm(UpperCAmelCase		)

       # Useful for training neural nets
       lowercase       : Dict						=PoolFormerDropPath(UpperCAmelCase		) if drop_path > 0.0 else nn.Identity()
       lowercase       : Any						=config.use_layer_scale
       if config.use_layer_scale:
        lowercase       : Dict						=nn.Parameter(
            config.layer_scale_init_value * torch.ones((UpperCAmelCase)		)  ,   requires_grad=UpperCAmelCase		)
        lowercase       : Dict						=nn.Parameter(
            config.layer_scale_init_value * torch.ones((UpperCAmelCase)		)  ,   requires_grad=UpperCAmelCase		)






      def 					A__   (			self      :		Tuple  ,   UpperCAmelCase      :		str		)	->	int:


       '''simple docstring'''

       if self.use_layer_scale:
        lowercase       : Dict						=self.pooling(self.before_norm(UpperCAmelCase		)		)
        lowercase       : Any						=self.layer_scale_a.unsqueeze(-1		).unsqueeze(-1		) * pooling_output
        # First residual connection
        lowercase       : int						=hidden_states + self.drop_path(UpperCAmelCase		)
        lowercase       : Optional[Any]						=()

        lowercase       : Optional[Any]						=self.output(self.after_norm(UpperCAmelCase		)		)
        lowercase       : List[str]						=self.layer_scale_a.unsqueeze(-1		).unsqueeze(-1		) * layer_output
        # Second residual connection
        lowercase       : Optional[int]						=hidden_states + self.drop_path(UpperCAmelCase		)

        lowercase       : Dict						=(output,) + outputs
        return outputs

       else:
        lowercase       : List[Any]						=self.drop_path(self.pooling(self.before_norm(UpperCAmelCase		)		)		)
        # First residual connection
        lowercase       : Optional[Any]						=pooling_output + hidden_states
        lowercase       : int						=()

        # Second residual connection inside the PoolFormerOutput block
        lowercase       : Tuple						=self.drop_path(self.output(self.after_norm(UpperCAmelCase		)		)		)
        lowercase       : List[Any]						=hidden_states + layer_output

        lowercase       : Dict						=(output,) + outputs
        return outputs





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Union[str, Any]  ,   UpperCAmelCase      :		Optional[int]		)	->	Tuple:


       '''simple docstring'''

       super().__init__()
       lowercase       : Tuple						=config
       # stochastic depth decay rule
       lowercase       : Optional[Any]						=[x.item() for x in torch.linspace(0  ,   config.drop_path_rate  ,   sum(config.depths		)		)]

       # patch embeddings
       lowercase       : Union[str, Any]						=[]
       for i in range(config.num_encoder_blocks		):
        embeddings.append(
            PoolFormerEmbeddings(
                patch_size=config.patch_sizes[i]  ,   stride=config.strides[i]  ,   padding=config.padding[i]  ,   num_channels=config.num_channels if i == 0 else config.hidden_sizes[i - 1]  ,   hidden_size=config.hidden_sizes[i]  ,   )		)
       lowercase       : Union[str, Any]						=nn.ModuleList(UpperCAmelCase		)

       # Transformer blocks
       lowercase       : Any						=[]
       lowercase       : Any						=0
       for i in range(config.num_encoder_blocks		):
        # each block consists of layers
        lowercase       : Tuple						=[]
        if i != 0:
         cur += config.depths[i - 1]
        for j in range(config.depths[i]		):
         layers.append(
             PoolFormerLayer(
                 UpperCAmelCase  ,   num_channels=config.hidden_sizes[i]  ,   pool_size=config.pool_size  ,   hidden_size=config.hidden_sizes[i]  ,   intermediate_size=int(config.hidden_sizes[i] * config.mlp_ratio		)  ,   drop_path=dpr[cur + j]  ,   )		)
        blocks.append(nn.ModuleList(UpperCAmelCase		)		)

       lowercase       : Union[str, Any]						=nn.ModuleList(UpperCAmelCase		)






      def 					A__   (			self      :		List[Any]  ,   UpperCAmelCase      :		Union[str, Any]  ,   UpperCAmelCase      :		Dict=False  ,   UpperCAmelCase      :		Optional[int]=True		)	->	List[Any]:


       '''simple docstring'''

       lowercase       : List[str]						=() if output_hidden_states else None

       lowercase       : int						=pixel_values
       for idx, layers in enumerate(zip(self.patch_embeddings  ,   self.block		)		):
        lowercase	,		lowercase       : List[Any]						=layers
        # Get patch embeddings from hidden_states
        lowercase       : List[Any]						=embedding_layer(UpperCAmelCase		)
        # Send the embeddings through the blocks
        for _, blk in enumerate(UpperCAmelCase		):
         lowercase       : str						=blk(UpperCAmelCase		)
         lowercase       : Dict						=layer_outputs[0]

        if output_hidden_states:
         lowercase       : int						=all_hidden_states + (hidden_states,)

       if not return_dict:
        return tuple(v for v in [hidden_states, all_hidden_states] if v is not None		)

       return BaseModelOutputWithNoAttention(last_hidden_state=UpperCAmelCase  ,   hidden_states=UpperCAmelCase		)





class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      UpperCamelCase_             =      PoolFormerConfig
      UpperCamelCase_             =      '''poolformer'''
      UpperCamelCase_             =      '''pixel_values'''
      UpperCamelCase_             =      True






      def 					A__   (			self      :		str  ,   UpperCAmelCase      :		Any		)	->	Any:


       '''simple docstring'''

       if isinstance(UpperCAmelCase  ,   (nn.Linear, nn.Convad)		):
        module.weight.data.normal_(mean=0.0  ,   std=self.config.initializer_range		)
        if module.bias is not None:
         module.bias.data.zero_()
       elif isinstance(UpperCAmelCase  ,   nn.LayerNorm		):
        module.bias.data.zero_()
        module.weight.data.fill_(1.0		)






      def 					A__   (			self      :		Dict  ,   UpperCAmelCase      :		Tuple  ,   UpperCAmelCase      :		Optional[int]=False		)	->	int:


       '''simple docstring'''

       if isinstance(UpperCAmelCase  ,   UpperCAmelCase		):
        lowercase       : Optional[int]						=value





SCREAMING_SNAKE_CASE							=						r'\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use\n    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`PoolFormerConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n'

SCREAMING_SNAKE_CASE							=						r'\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`PoolFormerImageProcessor.__call__`] for details.\n'
@add_start_docstrings(
    '''The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.'''					,							__A					,							)
class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      def __init__(			self      :		str  ,   UpperCAmelCase      :		Union[str, Any]		)	->	Any:


       '''simple docstring'''

       super().__init__(UpperCAmelCase		)
       lowercase       : str						=config

       lowercase       : str						=PoolFormerEncoder(UpperCAmelCase		)

       # Initialize weights and apply final processing
       self.post_init()






      def 					A__   (			self      :		str		)	->	Tuple:


       '''simple docstring'''

       return self.embeddings.patch_embeddings






      @add_start_docstrings_to_model_forward(UpperCAmelCase		)
      @add_code_sample_docstrings(
          checkpoint=_CHECKPOINT_FOR_DOC  ,   output_type=UpperCAmelCase  ,   config_class=_CONFIG_FOR_DOC  ,   modality='''vision'''  ,   expected_output=_EXPECTED_OUTPUT_SHAPE  ,   )
      def 					A__   (			self      :		Any  ,   UpperCAmelCase      :		Optional[torch.FloatTensor] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   )	->	Union[Tuple, BaseModelOutputWithNoAttention]:


       '''simple docstring'''

       lowercase       : List[Any]						=(
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       lowercase       : int						=return_dict if return_dict is not None else self.config.use_return_dict

       if pixel_values is None:
        raise ValueError('''You have to specify pixel_values'''		)

       lowercase       : Optional[int]						=self.encoder(
           UpperCAmelCase  ,   output_hidden_states=UpperCAmelCase  ,   return_dict=UpperCAmelCase  ,   )
       lowercase       : Dict						=encoder_outputs[0]

       if not return_dict:
        return (sequence_output, None) + encoder_outputs[1:]

       return BaseModelOutputWithNoAttention(
           last_hidden_state=UpperCAmelCase  ,   hidden_states=encoder_outputs.hidden_states  ,   )





class UpperCAmelCase_       (     nn.Module					):




      """simple docstring"""




      def __init__(			self      :		Tuple  ,   UpperCAmelCase      :		Dict		)	->	int:


       '''simple docstring'''

       super().__init__()
       lowercase       : int						=nn.Linear(config.hidden_size  ,   config.hidden_size		)






      def 					A__   (			self      :		str  ,   UpperCAmelCase      :		List[str]		)	->	Tuple:


       '''simple docstring'''

       lowercase       : Tuple						=self.dense(UpperCAmelCase		)
       return output





@add_start_docstrings(
    '''
    PoolFormer Model transformer with an image classification head on top
    '''					,							__A					,							)
class UpperCAmelCase_       (     __A					):




      """simple docstring"""




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


       '''simple docstring'''

       super().__init__(UpperCAmelCase		)
       lowercase       : List[Any]						=config.num_labels
       lowercase       : str						=PoolFormerModel(UpperCAmelCase		)

       # Final norm
       lowercase       : Dict						=PoolFormerGroupNorm(config.hidden_sizes[-1]		)
       # Classifier head
       lowercase       : List[str]						=(
           nn.Linear(config.hidden_sizes[-1]  ,   config.num_labels		) if config.num_labels > 0 else nn.Identity()
       )

       # Initialize weights and apply final processing
       self.post_init()






      @add_start_docstrings_to_model_forward(UpperCAmelCase		)
      @add_code_sample_docstrings(
          checkpoint=_IMAGE_CLASS_CHECKPOINT  ,   output_type=UpperCAmelCase  ,   config_class=_CONFIG_FOR_DOC  ,   expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT  ,   )
      def 					A__   (			self      :		Tuple  ,   UpperCAmelCase      :		Optional[torch.FloatTensor] = None  ,   UpperCAmelCase      :		Optional[torch.LongTensor] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   UpperCAmelCase      :		Optional[bool] = None  ,   )	->	Union[Tuple, ImageClassifierOutputWithNoAttention]:


       '''simple docstring'''

       lowercase       : int						=return_dict if return_dict is not None else self.config.use_return_dict

       lowercase       : Tuple						=self.poolformer(
           UpperCAmelCase  ,   output_hidden_states=UpperCAmelCase  ,   return_dict=UpperCAmelCase  ,   )

       lowercase       : Optional[Any]						=outputs[0]

       lowercase       : Tuple						=self.classifier(self.norm(UpperCAmelCase		).mean([-2, -1]		)		)

       lowercase       : List[Any]						=None
       if labels is not None:
        if self.config.problem_type is None:
         if self.num_labels == 1:
          lowercase       : int						='''regression'''
         elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
          lowercase       : int						='''single_label_classification'''
         else:
          lowercase       : Optional[Any]						='''multi_label_classification'''

        if self.config.problem_type == "regression":
         lowercase       : Optional[Any]						=MSELoss()
         if self.num_labels == 1:
          lowercase       : Dict						=loss_fct(logits.squeeze()  ,   labels.squeeze()		)
         else:
          lowercase       : List[Any]						=loss_fct(UpperCAmelCase  ,   UpperCAmelCase		)
        elif self.config.problem_type == "single_label_classification":
         lowercase       : List[Any]						=CrossEntropyLoss()
         lowercase       : List[str]						=loss_fct(logits.view(-1  ,   self.num_labels		)  ,   labels.view(-1		)		)
        elif self.config.problem_type == "multi_label_classification":
         lowercase       : Union[str, Any]						=BCEWithLogitsLoss()
         lowercase       : Union[str, Any]						=loss_fct(UpperCAmelCase  ,   UpperCAmelCase		)

       if not return_dict:
        lowercase       : str						=(logits,) + outputs[2:]
        return ((loss,) + output) if loss is not None else output

       return ImageClassifierOutputWithNoAttention(loss=UpperCAmelCase  ,   logits=UpperCAmelCase  ,   hidden_states=outputs.hidden_states		)











'''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 				lowercase_					(     __A			:							List[Any]      )							->   Union[str, Any]:



 """simple docstring"""




 return EnvironmentCommand()


def 				lowercase_					(     __A			:							int      )							->   Dict:



 """simple docstring"""




 return EnvironmentCommand(args.accelerate_config_file      )





class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      @staticmethod
      def 					A__   (			UpperCAmelCase      :		ArgumentParser		)	->	List[str]:


       '''simple docstring'''

       lowercase       : Optional[int]						=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      :		Dict  ,   UpperCAmelCase      :		Tuple  ,   *UpperCAmelCase      :		Tuple		)	->	None:


       '''simple docstring'''

       lowercase       : List[str]						=accelerate_config_file






      def 					A__   (			self      :		Tuple		)	->	int:


       '''simple docstring'''

       lowercase       : Optional[Any]						='''not installed'''
       if is_safetensors_available():
        import safetensors

        lowercase       : List[Any]						=safetensors.__version__
       elif importlib.util.find_spec('''safetensors'''		) is not None:
        import safetensors

        lowercase       : List[str]						=f'{safetensors.__version__} but is ignored because of PyTorch version too old.'

       lowercase       : List[str]						='''not installed'''
       lowercase       : str						='''not found'''
       if is_accelerate_available():
        import accelerate
        from accelerate.commands.config import default_config_file, load_config_from_file

        lowercase       : List[str]						=accelerate.__version__
        # Get the default from the config file.
        if self._accelerate_config_file is not None or os.path.isfile(UpperCAmelCase		):
         lowercase       : Dict						=load_config_from_file(self._accelerate_config_file		).to_dict()

        lowercase       : Optional[int]						=(
            '''\n'''.join([f'\t- {prop}: {val}' for prop, val in accelerate_config.items()]		)
            if isinstance(UpperCAmelCase  ,   UpperCAmelCase		)
            else f'\t{accelerate_config}'
        )

       lowercase       : Optional[int]						='''not installed'''
       lowercase       : Optional[Any]						='''NA'''
       if is_torch_available():
        import torch

        lowercase       : List[Any]						=torch.__version__
        lowercase       : Dict						=torch.cuda.is_available()

       lowercase       : Optional[Any]						='''not installed'''
       lowercase       : List[str]						='''NA'''
       if is_tf_available():
        import tensorflow as tf

        lowercase       : List[Any]						=tf.__version__
        try:
         # deprecated in v2.1
         lowercase       : Optional[Any]						=tf.test.is_gpu_available()
        except AttributeError:
         # returns list of devices, convert to bool
         lowercase       : Optional[int]						=bool(tf.config.list_physical_devices('''GPU'''		)		)

       lowercase       : Optional[Any]						='''not installed'''
       lowercase       : Optional[Any]						='''not installed'''
       lowercase       : Optional[Any]						='''not installed'''
       lowercase       : List[str]						='''NA'''
       if is_flax_available():
        import flax
        import jax
        import jaxlib

        lowercase       : Dict						=flax.__version__
        lowercase       : List[Any]						=jax.__version__
        lowercase       : Any						=jaxlib.__version__
        lowercase       : Tuple						=jax.lib.xla_bridge.get_backend().platform

       lowercase       : str						={
           '''`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 					A__   (			UpperCAmelCase      :		Any		)	->	Any:


       '''simple docstring'''

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



