


'''simple docstring'''







from math import ceil






def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _lowerCAmelCase    :							int   			=       list(range(0   ,						_A					)					)

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

       # Duplicate check
       _lowerCAmelCase    :							List[str]   			=       []
       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
       _lowerCAmelCase    :							int   			=       [i for i in blocks if i not in device_map_blocks]
       _lowerCAmelCase    :							Optional[int]   			=       [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 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _lowerCAmelCase    :							int   			=       list(range(_A					)					)
       _lowerCAmelCase    :							Dict   			=       int(ceil(n_layers / len(_A					)					)					)
       _lowerCAmelCase    :							Optional[Any]   			=       [layers[i : i + n_blocks] for i in range(0   ,						_A   ,						_A					)]

       return dict(zip(_A   ,						_A					)					)





'''simple docstring'''







from .configuration_bert_masked import MaskedBertConfig
from .modeling_bert_masked import (
    MaskedBertForMultipleChoice,
    MaskedBertForQuestionAnswering,
    MaskedBertForSequenceClassification,
    MaskedBertForTokenClassification,
    MaskedBertModel,
)
from .modules import *

