




'''simple docstring'''





from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
		import accelerate



def       UpperCAmelCase       (     _snake_case							):
							if not is_accelerate_available():
														return method
							lowerCAmelCase   =		version.parse(accelerate.__version__							).base_version
							if version.parse(_snake_case							) < version.parse('''0.17.0'''							):
														return method

							def wrapper(self						, *_snake_case						, **_snake_case							):
														if hasattr(self						, '''_hf_hook'''							) and hasattr(self._hf_hook						, '''pre_forward'''							):
																					self._hf_hook.pre_forward(self							)
														return method(self						, *_snake_case						, **_snake_case							)

							return wrapper









from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase_						={
    """configuration_jukebox""": [
        """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """JukeboxConfig""",
        """JukeboxPriorConfig""",
        """JukeboxVQVAEConfig""",
    ],
    """tokenization_jukebox""": ["""JukeboxTokenizer"""],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase_						=[
		    """JUKEBOX_PRETRAINED_MODEL_ARCHIVE_LIST""",
		    """JukeboxModel""",
		    """JukeboxPreTrainedModel""",
		    """JukeboxVQVAE""",
		    """JukeboxPrior""",
		]

if TYPE_CHECKING:
		from .configuration_jukebox import (
		    JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    JukeboxConfig,
		    JukeboxPriorConfig,
		    JukeboxVQVAEConfig,
		)
		from .tokenization_jukebox import JukeboxTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_jukebox import (
				    JUKEBOX_PRETRAINED_MODEL_ARCHIVE_LIST,
				    JukeboxModel,
				    JukeboxPreTrainedModel,
				    JukeboxPrior,
				    JukeboxVQVAE,
				)

else:
		import sys

		UpperCAmelCase_						=_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



