


"""simple docstring"""







from math import ceil
def 					a__			(				SCREAMING_SNAKE_CASE    :    List[str]				,      SCREAMING_SNAKE_CASE    :    Tuple				):


  '''simple docstring'''







  lowerCAmelCase     :     Union[str, Any]								=							list(range(0				,      SCREAMING_SNAKE_CASE				)				)

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

  # Duplicate check
  lowerCAmelCase     :     Optional[Any]								=							[]
  for i in device_map_blocks:
    if device_map_blocks.count(SCREAMING_SNAKE_CASE				) > 1 and i not in duplicate_blocks:
      duplicate_blocks.append(SCREAMING_SNAKE_CASE				)
    # Missing blocks
  lowerCAmelCase     :     Any								=							[i for i in blocks if i not in device_map_blocks]
  lowerCAmelCase     :     Any								=							[i for i in device_map_blocks if i not in blocks]

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





def 					a__			(				SCREAMING_SNAKE_CASE    :    Dict				,      SCREAMING_SNAKE_CASE    :    Any				):


  '''simple docstring'''







  lowerCAmelCase     :     List[Any]								=							list(range(SCREAMING_SNAKE_CASE				)				)
  lowerCAmelCase     :     Union[str, Any]								=							int(ceil(n_layers / len(SCREAMING_SNAKE_CASE				)				)				)
  lowerCAmelCase     :     int								=							[layers[i : i + n_blocks] for i in range(0				,      SCREAMING_SNAKE_CASE				,      SCREAMING_SNAKE_CASE				)]

  return dict(zip(SCREAMING_SNAKE_CASE				,      SCREAMING_SNAKE_CASE				)				)









"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase__      				=   logging.get_logger(__name__)

lowerCAmelCase__      				=   {
    '''facebook/dpr-ctx_encoder-single-nq-base''': (
        '''https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.json'''
    ),
    '''facebook/dpr-question_encoder-single-nq-base''': (
        '''https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/config.json'''
    ),
    '''facebook/dpr-reader-single-nq-base''': (
        '''https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/config.json'''
    ),
    '''facebook/dpr-ctx_encoder-multiset-base''': (
        '''https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/config.json'''
    ),
    '''facebook/dpr-question_encoder-multiset-base''': (
        '''https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/config.json'''
    ),
    '''facebook/dpr-reader-multiset-base''': (
        '''https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/config.json'''
    ),
}


class       SCREAMING_SNAKE_CASE__				(		lowercase				):
       """simple docstring"""


       a  :				int   ="dpr"

       def __init__(						self		,     snake_case__=30_522		,     snake_case__=768		,     snake_case__=12		,     snake_case__=12		,     snake_case__=3_072		,     snake_case__="gelu"		,     snake_case__=0.1		,     snake_case__=0.1		,     snake_case__=512		,     snake_case__=2		,     snake_case__=0.02		,     snake_case__=1e-12		,     snake_case__=0		,     snake_case__="absolute"		,     snake_case__ = 0		,     **snake_case__		,     ):






         """simple docstring"""





         super().__init__(pad_token_id=snake_case__		,     **snake_case__						)

         lowerCAmelCase     :     Union[str, Any]								=							vocab_size
         lowerCAmelCase     :     str								=							hidden_size
         lowerCAmelCase     :     Any								=							num_hidden_layers
         lowerCAmelCase     :     Optional[int]								=							num_attention_heads
         lowerCAmelCase     :     Union[str, Any]								=							hidden_act
         lowerCAmelCase     :     Dict								=							intermediate_size
         lowerCAmelCase     :     Union[str, Any]								=							hidden_dropout_prob
         lowerCAmelCase     :     Dict								=							attention_probs_dropout_prob
         lowerCAmelCase     :     Dict								=							max_position_embeddings
         lowerCAmelCase     :     Tuple								=							type_vocab_size
         lowerCAmelCase     :     Any								=							initializer_range
         lowerCAmelCase     :     Any								=							layer_norm_eps
         lowerCAmelCase     :     Dict								=							projection_dim
         lowerCAmelCase     :     Dict								=							position_embedding_type





