
class 		lowercase_							:

 def __init__(   self  ,						__UpperCamelCase  ):




        """simple docstring"""


        UpperCamelCase_											=							data
        UpperCamelCase_											=							None
        UpperCamelCase_											=							None

 def __str__(   self  ):




        """simple docstring"""


        return f'''{self.data}'''



class 		lowercase_							:

 def __init__(   self  ):




        """simple docstring"""


        UpperCamelCase_											=							None
        UpperCamelCase_											=							None

 def __iter__(   self  ):




        """simple docstring"""


        UpperCamelCase_											=							self.head
        while node:
               yield node.data
               UpperCamelCase_											=							node.next

 def __str__(   self  ):




        """simple docstring"""


        return "->".join([str(__UpperCamelCase  ) for item in self]  )

 def __len__(   self  ):




        """simple docstring"""


        return sum(1 for _ in self  )

 def lowerCamelCase_					(   self  ,						__UpperCamelCase  ):




        """simple docstring"""


        self.insert_at_nth(0  ,						__UpperCamelCase  )

 def lowerCamelCase_					(   self  ,						__UpperCamelCase  ):




        """simple docstring"""


        self.insert_at_nth(len(self  )  ,						__UpperCamelCase  )

 def lowerCamelCase_					(   self  ,						__UpperCamelCase  ,						__UpperCamelCase  ):




        """simple docstring"""


        UpperCamelCase_											=							len(self  )

        if not 0 <= index <= length:
               raise IndexError("""list index out of range"""  )
        UpperCamelCase_											=							Node(__UpperCamelCase  )
        if self.head is None:
               UpperCamelCase_											=							UpperCamelCase_											=							new_node
        elif index == 0:
               UpperCamelCase_											=							new_node
               UpperCamelCase_											=							self.head
               UpperCamelCase_											=							new_node
        elif index == length:
               UpperCamelCase_											=							new_node
               UpperCamelCase_											=							self.tail
               UpperCamelCase_											=							new_node
        else:
               UpperCamelCase_											=							self.head
               for _ in range(0  ,						__UpperCamelCase  ):
                      UpperCamelCase_											=							temp.next
               UpperCamelCase_											=							new_node
               UpperCamelCase_											=							temp.previous
               UpperCamelCase_											=							temp
               UpperCamelCase_											=							new_node

 def lowerCamelCase_					(   self  ):




        """simple docstring"""


        return self.delete_at_nth(0  )

 def lowerCamelCase_					(   self  ):




        """simple docstring"""


        return self.delete_at_nth(len(self  ) - 1  )

 def lowerCamelCase_					(   self  ,						__UpperCamelCase  ):




        """simple docstring"""


        UpperCamelCase_											=							len(self  )

        if not 0 <= index <= length - 1:
               raise IndexError("""list index out of range"""  )
        UpperCamelCase_											=							self.head  # default first node
        if length == 1:
               UpperCamelCase_											=							UpperCamelCase_											=							None
        elif index == 0:
               UpperCamelCase_											=							self.head.next
               UpperCamelCase_											=							None
        elif index == length - 1:
               UpperCamelCase_											=							self.tail
               UpperCamelCase_											=							self.tail.previous
               UpperCamelCase_											=							None
        else:
               UpperCamelCase_											=							self.head
               for _ in range(0  ,						__UpperCamelCase  ):
                      UpperCamelCase_											=							temp.next
               UpperCamelCase_											=							temp
               UpperCamelCase_											=							temp.previous
               UpperCamelCase_											=							temp.next
        return delete_node.data

 def lowerCamelCase_					(   self  ,						__UpperCamelCase  ):




        """simple docstring"""


        UpperCamelCase_											=							self.head

        while current.data != data:  # Find the position to delete
               if current.next:
                      UpperCamelCase_											=							current.next
               else:  # We have reached the end an no value matches
                      raise ValueError("""No data matching given value"""  )

        if current == self.head:
               self.delete_head()

        elif current == self.tail:
               self.delete_tail()

        else:  # Before: 1 <--> 2(current) <--> 3
               UpperCamelCase_											=							current.next  # 1 --> 3
               UpperCamelCase_											=							current.previous  # 1 <--> 3
        return data

 def lowerCamelCase_					(   self  ):




        """simple docstring"""


        return len(self  ) == 0




def 					lowerCamelCase__					(    )		->						None:
       UpperCamelCase_											=							DoublyLinkedList()
       assert linked_list.is_empty() is True
       assert str(a__  ) == ""

       try:
              linked_list.delete_head()
              raise AssertionError  # This should not happen.
       except IndexError:
              assert True  # This should happen.

       try:
              linked_list.delete_tail()
              raise AssertionError  # This should not happen.
       except IndexError:
              assert True  # This should happen.

       for i in range(10  ):
              assert len(a__  ) == i
              linked_list.insert_at_nth(a__						,   i + 1  )
       assert str(a__  ) == "->".join(str(a__  ) for i in range(1						,   11  )  )

       linked_list.insert_at_head(0  )
       linked_list.insert_at_tail(11  )
       assert str(a__  ) == "->".join(str(a__  ) for i in range(0						,   12  )  )

       assert linked_list.delete_head() == 0
       assert linked_list.delete_at_nth(9  ) == 10
       assert linked_list.delete_tail() == 11
       assert len(a__  ) == 9
       assert str(a__  ) == "->".join(str(a__  ) for i in range(1						,   10  )  )


if __name__ == "__main__":
      from doctest import testmod

      testmod()





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


_A							=       logging.get_logger(__name__)

_A							=       {
    '''facebook/opt-125m''': '''https://huggingface.co/facebook/opt-125m/blob/main/config.json''',
    '''facebook/opt-350m''': '''https://huggingface.co/facebook/opt-350m/blob/main/config.json''',
    '''facebook/opt-1.3b''': '''https://huggingface.co/facebook/opt-1.3b/blob/main/config.json''',
    '''facebook/opt-2.7b''': '''https://huggingface.co/facebook/opt-2.7b/blob/main/config.json''',
    '''facebook/opt-6.7b''': '''https://huggingface.co/facebook/opt-6.7b/blob/main/config.json''',
    '''facebook/opt-13b''': '''https://huggingface.co/facebook/opt-13b/blob/main/config.json''',
}

class 		lowercase_							(							__SCREAMING_SNAKE_CASE					):
 A__    :					Dict    =     """opt"""
 A__    :					int    =     ["""past_key_values"""]

 def __init__(   self  ,						__UpperCamelCase=5_0_2_7_2  ,						__UpperCamelCase=7_6_8  ,						__UpperCamelCase=1_2  ,						__UpperCamelCase=3_0_7_2  ,						__UpperCamelCase=2_0_4_8  ,						__UpperCamelCase=True  ,						__UpperCamelCase=False  ,						__UpperCamelCase=None  ,						__UpperCamelCase=0.1  ,						__UpperCamelCase=0.0  ,						__UpperCamelCase=1_2  ,						__UpperCamelCase="relu"  ,						__UpperCamelCase=0.0  ,						__UpperCamelCase=0.02  ,						__UpperCamelCase=True  ,						__UpperCamelCase=1  ,						__UpperCamelCase=2  ,						__UpperCamelCase=2  ,						__UpperCamelCase=True  ,						__UpperCamelCase=True  ,						**__UpperCamelCase  ,						):




        """simple docstring"""


        super().__init__(
            pad_token_id=__UpperCamelCase  ,						bos_token_id=__UpperCamelCase  ,						eos_token_id=__UpperCamelCase  ,						**__UpperCamelCase  ,						)
        UpperCamelCase_											=							vocab_size
        UpperCamelCase_											=							max_position_embeddings
        UpperCamelCase_											=							num_attention_heads
        UpperCamelCase_											=							word_embed_proj_dim if word_embed_proj_dim is not None else hidden_size
        UpperCamelCase_											=							ffn_dim
        UpperCamelCase_											=							hidden_size
        UpperCamelCase_											=							num_hidden_layers
        UpperCamelCase_											=							dropout
        UpperCamelCase_											=							attention_dropout
        UpperCamelCase_											=							activation_function
        UpperCamelCase_											=							init_std
        UpperCamelCase_											=							layerdrop
        UpperCamelCase_											=							use_cache
        UpperCamelCase_											=							do_layer_norm_before
        # We keep these variables at `True` for backward compatibility.
        UpperCamelCase_											=							enable_bias
        UpperCamelCase_											=							layer_norm_elementwise_affine

        # Note that the only purpose of `_remove_final_layer_norm` is to keep backward compatibility
        # with checkpoints that have been fine-tuned before transformers v4.20.1
        # see https://github.com/facebookresearch/metaseq/pull/164
        UpperCamelCase_											=							_remove_final_layer_norm



