






from collections.abc import Sequence
from queue import Queue
class 		SCREAMING_SNAKE_CASE__	:

  '''simple docstring'''







  def __init__(      self		:			Optional[Any]       ,				lowerCamelCase		:			Union[str, Any]       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			str       ,				lowerCamelCase		:			List[str]=None       ,				lowerCamelCase		:			Optional[int]=None							)						->	Tuple:


         """simple docstring"""
         _UpperCAmelCase							=    start
         _UpperCAmelCase							=    end
         _UpperCAmelCase							=    val
         _UpperCAmelCase							=    (start + end) // 2
         _UpperCAmelCase							=    left
         _UpperCAmelCase							=    right





  def __repr__(      self		:			Optional[Any]							)						->	int:


         """simple docstring"""
         return f"""SegmentTreeNode(start={self.start}, end={self.end}, val={self.val})"""



class 		SCREAMING_SNAKE_CASE__	:

  '''simple docstring'''







  def __init__(      self		:			Union[str, Any]       ,				lowerCamelCase		:			Sequence       ,				lowerCamelCase		:			str							)						->	Union[str, Any]:


         """simple docstring"""
         _UpperCAmelCase							=    collection
         _UpperCAmelCase							=    function
         if self.collection:
                _UpperCAmelCase							=    self._build_tree(0       ,				len(lowerCamelCase							) - 1							)


  def  lowerCamelCase       (      self		:			int       ,				lowerCamelCase		:			Optional[int]       ,				lowerCamelCase		:			List[str]							)						->	Optional[int]:


         """simple docstring"""
         self._update_tree(self.root       ,				lowerCamelCase       ,				lowerCamelCase							)


  def  lowerCamelCase       (      self		:			Any       ,				lowerCamelCase		:			List[Any]       ,				lowerCamelCase		:			Tuple							)						->	Union[str, Any]:


         """simple docstring"""
         return self._query_range(self.root       ,				lowerCamelCase       ,				lowerCamelCase							)


  def  lowerCamelCase       (      self		:			int       ,				lowerCamelCase		:			Any       ,				lowerCamelCase		:			Union[str, Any]							)						->	List[Any]:


         """simple docstring"""
         if start == end:
                return SegmentTreeNode(lowerCamelCase       ,				lowerCamelCase       ,				self.collection[start]							)
         _UpperCAmelCase							=    (start + end) // 2
         _UpperCAmelCase							=    self._build_tree(lowerCamelCase       ,				lowerCamelCase							)
         _UpperCAmelCase							=    self._build_tree(mid + 1       ,				lowerCamelCase							)
         return SegmentTreeNode(lowerCamelCase       ,				lowerCamelCase       ,				self.fn(left.val       ,				right.val							)       ,				lowerCamelCase       ,				lowerCamelCase							)


  def  lowerCamelCase       (      self		:			List[str]       ,				lowerCamelCase		:			List[Any]       ,				lowerCamelCase		:			Dict       ,				lowerCamelCase		:			int							)						->	Union[str, Any]:


         """simple docstring"""
         if node.start == i and node.end == i:
                _UpperCAmelCase							=    val
                return
         if i <= node.mid:
                self._update_tree(node.left       ,				lowerCamelCase       ,				lowerCamelCase							)
         else:
                self._update_tree(node.right       ,				lowerCamelCase       ,				lowerCamelCase							)
         _UpperCAmelCase							=    self.fn(node.left.val       ,				node.right.val							)


  def  lowerCamelCase       (      self		:			Union[str, Any]       ,				lowerCamelCase		:			str       ,				lowerCamelCase		:			Any       ,				lowerCamelCase		:			Optional[int]							)						->	int:


         """simple docstring"""
         if node.start == i and node.end == j:
                return node.val

         if i <= node.mid:
                if j <= node.mid:
                       # range in left child tree
                       return self._query_range(node.left       ,				lowerCamelCase       ,				lowerCamelCase							)
                else:
                       # range in left child tree and right child tree
                       return self.fn(
                           self._query_range(node.left       ,				lowerCamelCase       ,				node.mid							)       ,				self._query_range(node.right       ,				node.mid + 1       ,				lowerCamelCase							)       ,				)
         else:
                # range in right child tree
                return self._query_range(node.right       ,				lowerCamelCase       ,				lowerCamelCase							)





  def  lowerCamelCase       (      self		:			Optional[Any]							)						->	Union[str, Any]:


         """simple docstring"""
         if self.root is not None:
                _UpperCAmelCase							=    Queue()
                queue.put(self.root							)
                while not queue.empty():
                       _UpperCAmelCase							=    queue.get()
                       yield node

                       if node.left is not None:
                              queue.put(node.left							)

                       if node.right is not None:
                              queue.put(node.right							)


if __name__ == "__main__":
  import operator

  for fn in [operator.add, max, min]:
    print('''*''' * 50)
    __a:     Union[str, Any]   					=					SegmentTree([2, 1, 5, 3, 4], fn)
    for node in arr.traverse():
      print(node)
    print()

    arr.update(1, 5)
    for node in arr.traverse():
      print(node)
    print()

    print(arr.query_range(3, 4))  # 7
    print(arr.query_range(2, 2))  # 5
    print(arr.query_range(1, 3))  # 13
    print()




'''simple docstring'''






from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCAmelCase:   List[str]					=		logging.get_logger(__name__)

lowerCAmelCase:   int					=		{
    'bert-base-uncased': 'https://huggingface.co/bert-base-uncased/resolve/main/config.json',
    'bert-large-uncased': 'https://huggingface.co/bert-large-uncased/resolve/main/config.json',
    'bert-base-cased': 'https://huggingface.co/bert-base-cased/resolve/main/config.json',
    'bert-large-cased': 'https://huggingface.co/bert-large-cased/resolve/main/config.json',
    'bert-base-multilingual-uncased': 'https://huggingface.co/bert-base-multilingual-uncased/resolve/main/config.json',
    'bert-base-multilingual-cased': 'https://huggingface.co/bert-base-multilingual-cased/resolve/main/config.json',
    'bert-base-chinese': 'https://huggingface.co/bert-base-chinese/resolve/main/config.json',
    'bert-base-german-cased': 'https://huggingface.co/bert-base-german-cased/resolve/main/config.json',
    'bert-large-uncased-whole-word-masking': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking': (
        'https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-uncased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-base-cased-finetuned-mrpc': 'https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/config.json',
    'bert-base-german-dbmdz-cased': 'https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/config.json',
    'bert-base-german-dbmdz-uncased': 'https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese': 'https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-cased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-uncased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json'
    ),
    'wietsedv/bert-base-dutch-cased': 'https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/config.json',
    # See all BERT models at https://huggingface.co/models?filter=bert
}

class 				a__(   lowerCamelCase__      ):
    lowercase__					=       """bert"""







    def __init__( self					:    List[str]		,     __snake_case					:    Optional[Any]=3_05_22		,     __snake_case					:    Any=7_68		,     __snake_case					:    str=12		,     __snake_case					:    Optional[int]=12		,     __snake_case					:    Tuple=30_72		,     __snake_case					:    Optional[Any]="gelu"		,     __snake_case					:    Dict=0.1		,     __snake_case					:    Optional[int]=0.1		,     __snake_case					:    List[Any]=5_12		,     __snake_case					:    Optional[Any]=2		,     __snake_case					:    Optional[Any]=0.02		,     __snake_case					:    List[str]=1e-1_2		,     __snake_case					:    Dict=0		,     __snake_case					:    List[str]="absolute"		,     __snake_case					:    List[Any]=True		,     __snake_case					:    List[str]=None		,     **__snake_case					:    Any		,     ):
      super().__init__(pad_token_id=__snake_case		,     **__snake_case      )

      a		:   str	  =	vocab_size
      a		:   List[Any]	  =	hidden_size
      a		:   Union[str, Any]	  =	num_hidden_layers
      a		:   List[Any]	  =	num_attention_heads
      a		:   str	  =	hidden_act
      a		:   str	  =	intermediate_size
      a		:   Tuple	  =	hidden_dropout_prob
      a		:   Union[str, Any]	  =	attention_probs_dropout_prob
      a		:   List[Any]	  =	max_position_embeddings
      a		:   Union[str, Any]	  =	type_vocab_size
      a		:   List[Any]	  =	initializer_range
      a		:   Dict	  =	layer_norm_eps
      a		:   Any	  =	position_embedding_type
      a		:   List[str]	  =	use_cache
      a		:   List[str]	  =	classifier_dropout

class 				a__(   lowerCamelCase__      ):







    @property
    def      lowercase_			( self					:    List[str]      ):
      if self.task == "multiple-choice":
        a		:   Tuple	  =	{0: 'batch', 1: 'choice', 2: 'sequence'}
      else:
        a		:   List[Any]	  =	{0: 'batch', 1: 'sequence'}
      return OrderedDict(
          [
              ('input_ids', dynamic_axis),
              ('attention_mask', dynamic_axis),
              ('token_type_ids', dynamic_axis),
          ]      )