
'''simple docstring'''
from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
     import accelerate







def        A_     (						__SCREAMING_SNAKE_CASE						:  Dict )				->       Optional[int]:





  """simple docstring"""

  if not is_accelerate_available():
    return method
  __A		:     int												=		version.parse(accelerate.__version__ ).base_version
  if version.parse(__SCREAMING_SNAKE_CASE ) < version.parse("""0.17.0""" ):
    return method

  def wrapper(self						:  str			,     *__SCREAMING_SNAKE_CASE						:  Tuple			,     **__SCREAMING_SNAKE_CASE						:  Tuple ):
    if hasattr(self			,     """_hf_hook""" ) and hasattr(self._hf_hook			,     """pre_forward""" ):
      self._hf_hook.pre_forward(self )
    return method(self			,     *__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE )

  return wrapper





'''simple docstring'''
from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
     import accelerate







def        A_     (						__SCREAMING_SNAKE_CASE						:  Dict )				->       Optional[int]:





  """simple docstring"""

  if not is_accelerate_available():
    return method
  __A		:     int												=		version.parse(accelerate.__version__ ).base_version
  if version.parse(__SCREAMING_SNAKE_CASE ) < version.parse("""0.17.0""" ):
    return method

  def wrapper(self						:  str			,     *__SCREAMING_SNAKE_CASE						:  Tuple			,     **__SCREAMING_SNAKE_CASE						:  Tuple ):
    if hasattr(self			,     """_hf_hook""" ) and hasattr(self._hf_hook			,     """pre_forward""" ):
      self._hf_hook.pre_forward(self )
    return method(self			,     *__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE )

  return wrapper



