

from math import ceil



def    __UpperCAmelCase (	__a      :			int		,__a      :			Any	)			->     Union[str, Any]:

					"""simple docstring"""

					_a	:    List[Any]         =		list(range(0		,__a	)	)

					_a	:    int         =		[item for sublist in list(device_map.values()	) for item in sublist]

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

					if len(__a	) != 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(__a	)	)
					if len(__a	) != 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(__a	)	)
					if len(__a	) != 0:
										raise ValueError(
										    '''The device_map contains more attention blocks than this model has. Remove these from the device_map:'''
										    + str(__a	)	)







def    __UpperCAmelCase (	__a      :			Optional[int]		,__a      :			int	)			->     List[str]:

					"""simple docstring"""

					_a	:    Any         =		list(range(__a	)	)
					_a	:    str         =		int(ceil(n_layers / len(__a	)	)	)
					_a	:    Optional[int]         =		[layers[i : i + n_blocks] for i in range(0		,__a		,__a	)]

					return dict(zip(__a		,__a	)	)






import logging

from transformers import PretrainedConfig


a__				=		logging.getLogger(__name__)


a__				=		{
    '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json''',
}

class 				UpperCAmelCase_		(			__lowercase   ):
							"""simple docstring"""







							UpperCAmelCase__       :						Any	    =    "bertabs"


							def __init__(			self       ,							_a=3_0_5_2_2       ,							_a=5_1_2       ,							_a=6       ,							_a=5_1_2       ,							_a=8       ,							_a=5_1_2       ,							_a=0.2       ,							_a=6       ,							_a=7_6_8       ,							_a=8       ,							_a=2_0_4_8       ,							_a=0.2       ,							**_a       ,							)    ->    Any:
												super().__init__(**_a       )

												_a	:    int         =		vocab_size
												_a	:    List[str]         =		max_pos

												_a	:    Tuple         =		enc_layers
												_a	:    Optional[Any]         =		enc_hidden_size
												_a	:    int         =		enc_heads
												_a	:    Optional[Any]         =		enc_ff_size
												_a	:    List[str]         =		enc_dropout

												_a	:    Tuple         =		dec_layers
												_a	:    Optional[Any]         =		dec_hidden_size
												_a	:    Optional[Any]         =		dec_heads
												_a	:    Optional[Any]         =		dec_ff_size
												_a	:    List[Any]         =		dec_dropout



