





import enum
import inspect
import warnings
from functools import wraps
from typing import Callable, Optional

from .logging import get_logger


SCREAMING_SNAKE_CASE_		  =			set()
SCREAMING_SNAKE_CASE_		  =			get_logger(__name__)



def   __lowercase  ( _SCREAMING_SNAKE_CASE = None      )					->  Any:


      '''simple docstring'''


      def decorator(_SCREAMING_SNAKE_CASE      ):
            global _emitted_deprecation_warnings

            if inspect.isclass(_SCREAMING_SNAKE_CASE      ):
                  SCREAMING_SNAKE_CASE						=		deprecated_class_or_function.__init__
                  SCREAMING_SNAKE_CASE						=		deprecated_class_or_function.__name__
            else:
                  SCREAMING_SNAKE_CASE						=		deprecated_class_or_function
                  SCREAMING_SNAKE_CASE						=		deprecated_function.__name__
                  # Support deprecating __init__ class method: class name instead
                  SCREAMING_SNAKE_CASE						=		name if name != """__init__""" else deprecated_function.__qualname__.split("""."""      )[-2]

            SCREAMING_SNAKE_CASE						=		(
                F"""{name} is deprecated and will be removed in the next major version of datasets.""" + F""" {help_message}"""
                if help_message
                else """"""
            )

            @wraps(_SCREAMING_SNAKE_CASE      )
            def wrapper(*_SCREAMING_SNAKE_CASE					,		**_SCREAMING_SNAKE_CASE      ):
                  SCREAMING_SNAKE_CASE						=		hash(_SCREAMING_SNAKE_CASE      )
                  if func_hash not in _emitted_deprecation_warnings:
                        warnings.warn(_SCREAMING_SNAKE_CASE					,		category=_SCREAMING_SNAKE_CASE					,		stacklevel=2      )
                        _emitted_deprecation_warnings.add(_SCREAMING_SNAKE_CASE      )
                  return deprecated_function(*_SCREAMING_SNAKE_CASE					,		**_SCREAMING_SNAKE_CASE      )

            SCREAMING_SNAKE_CASE						=		"""deprecated"""

            if inspect.isclass(_SCREAMING_SNAKE_CASE      ):
                  SCREAMING_SNAKE_CASE						=		wrapper
                  return deprecated_class_or_function
            else:
                  return wrapper

      return decorator

class 						UpperCamelCase__					( enum.EnumMeta  ):



     '''simple docstring'''

     def __getattribute__(				cls		:       Any		,lowerCamelCase__		:       Tuple			)	->						Union[str, Any]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE						=		super().__getattribute__(lowerCamelCase__			)
           if isinstance(lowerCamelCase__		,enum.Enum			) and obj._on_access:
                 obj._on_access()
           return obj






     def __getitem__(				cls		:       Union[str, Any]		,lowerCamelCase__		:       Dict			)	->						Optional[int]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE						=		super().__getitem__(lowerCamelCase__			)
           if member._on_access:
                 member._on_access()
           return member






     def __call__(				cls		:       int		,lowerCamelCase__		:       Optional[int]		,lowerCamelCase__		:       Any=None		,*, lowerCamelCase__		:       List[Any]=None		,lowerCamelCase__		:       List[Any]=None		,lowerCamelCase__		:       int=None		,lowerCamelCase__		:       Optional[int]=1			)	->						str:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE						=		super().__call__(lowerCamelCase__		,lowerCamelCase__		,module=lowerCamelCase__		,qualname=lowerCamelCase__		,type=lowerCamelCase__		,start=lowerCamelCase__			)
           if isinstance(lowerCamelCase__		,enum.Enum			) and obj._on_access:
                 obj._on_access()
           return obj

class 						UpperCamelCase__					( enum.Enum				, metaclass=lowerCAmelCase_  ):



     '''simple docstring'''

     def __new__(				cls		:       int		,lowerCamelCase__		:       Tuple			)	->						Optional[int]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE						=		object.__new__(cls			)
           SCREAMING_SNAKE_CASE						=		value
           SCREAMING_SNAKE_CASE						=		member.deprecate
           return member






     @property
     def 							SCREAMING_SNAKE_CASE__    (				self		:       Optional[Any]			)	->						Union[str, Any]:




           '''simple docstring'''


           return ""






     def 							SCREAMING_SNAKE_CASE__    (				self		:       Optional[int]			)	->						List[str]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE						=		F""" {self.help_message}""" if self.help_message else """"""
           warnings.warn(
               F"""'{self.__objclass__.__name__}' is deprecated and will be removed in the next major version of datasets."""
               + help_message		,lowerCamelCase__		,stacklevel=3		,)









import argparse

from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta
from transformers.utils import logging


logging.set_verbosity_info()



def   __lowercase  ( _SCREAMING_SNAKE_CASE					,		_SCREAMING_SNAKE_CASE					,		_SCREAMING_SNAKE_CASE      )					->  List[Any]:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE						=		TaConfig.from_json_file(_SCREAMING_SNAKE_CASE      )
      print(F"""Building PyTorch model from configuration: {config}"""      )
      SCREAMING_SNAKE_CASE						=		TaForConditionalGeneration(_SCREAMING_SNAKE_CASE      )

      # Load weights from tf checkpoint
      load_tf_weights_in_ta(_SCREAMING_SNAKE_CASE					,		_SCREAMING_SNAKE_CASE					,		_SCREAMING_SNAKE_CASE      )

      # Save pytorch-model
      print(F"""Save PyTorch model to {pytorch_dump_path}"""      )
      model.save_pretrained(_SCREAMING_SNAKE_CASE      )


if __name__ == "__main__":
      SCREAMING_SNAKE_CASE_		  =			argparse.ArgumentParser()
      # Required parameters
      parser.add_argument(
          """--tf_checkpoint_path""", default=None, type=str, required=True, help="""Path to the TensorFlow checkpoint path."""
      )
      parser.add_argument(
          """--config_file""",
          default=None,
          type=str,
          required=True,
          help=(
              """The config json file corresponding to the pre-trained T5 model. \nThis specifies the model architecture."""
          ),
      )
      parser.add_argument(
          """--pytorch_dump_path""", default=None, type=str, required=True, help="""Path to the output PyTorch model."""
      )
      SCREAMING_SNAKE_CASE_		  =			parser.parse_args()
      convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)


