





"""simple docstring"""






from math import ceil






def      lowercase__ (					lowerCAmelCase__   :			Dict							,			lowerCAmelCase__   :			int			)    ->			Optional[Any]:



			'''simple docstring'''
			a__  :	Tuple		 =			list(range(0							,			lowerCAmelCase__			)			)

			a__  :	Union[str, Any]		 =			[item for sublist in list(device_map.values()			) for item in sublist]

			# Duplicate check
			a__  :	Union[str, Any]		 =			[]
			for i in device_map_blocks:
						if device_map_blocks.count(lowerCAmelCase__			) > 1 and i not in duplicate_blocks:
									duplicate_blocks.append(lowerCAmelCase__			)
    # Missing blocks
			a__  :	Any		 =			[i for i in blocks if i not in device_map_blocks]
			a__  :	List[str]		 =			[i for i in device_map_blocks if i not in blocks]

			if len(lowerCAmelCase__			) != 0:
						raise ValueError(
						    "Duplicate attention blocks specified in device_map. Attention blocks must be specified to one device."
						    " These attention blocks were specified more than once: " + str(lowerCAmelCase__			)			)
			if len(lowerCAmelCase__			) != 0:
						raise ValueError(
						    "There are attention blocks for this model that are not specified in the device_map. Add these attention "
						    "blocks to a device on the device_map: " + str(lowerCAmelCase__			)			)
			if len(lowerCAmelCase__			) != 0:
						raise ValueError(
						    "The device_map contains more attention blocks than this model has. Remove these from the device_map:"
						    + str(lowerCAmelCase__			)			)






def      lowercase__ (					lowerCAmelCase__   :			Optional[int]							,			lowerCAmelCase__   :			List[str]			)    ->			Dict:



			'''simple docstring'''
			a__  :	List[Any]		 =			list(range(lowerCAmelCase__			)			)
			a__  :	Any		 =			int(ceil(n_layers / len(lowerCAmelCase__			)			)			)
			a__  :	Optional[Any]		 =			[layers[i : i + n_blocks] for i in range(0							,			lowerCAmelCase__							,			lowerCAmelCase__			)]

			return dict(zip(lowerCAmelCase__							,			lowerCAmelCase__			)			)






"""simple docstring"""






from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__UpperCAmelCase						=			{
    '''configuration_informer''': [
        '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''InformerConfig''',
    ],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__UpperCAmelCase						=			[
		    '''INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''InformerForPrediction''',
		    '''InformerModel''',
		    '''InformerPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_informer import INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, InformerConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_informer import (
				    INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    InformerForPrediction,
				    InformerModel,
				    InformerPreTrainedModel,
				)

else:
		import sys

		__UpperCAmelCase						=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)