





'''simple docstring'''

import math





def lowerCamelCase						(     __lowerCamelCase :    int    )						->str:
    _SCREAMING_SNAKE_CASE									=			0
    _SCREAMING_SNAKE_CASE									=			0
    while num > 0:
        _SCREAMING_SNAKE_CASE									=			num % 8
        _SCREAMING_SNAKE_CASE									=			octal + (remainder * math.floor(math.pow(10					,       __lowerCamelCase    )    ))
        counter += 1
        _SCREAMING_SNAKE_CASE									=			math.floor(num / 8    )  # basically /= 8 without remainder if any
        # This formatting removes trailing '.0' from `octal`.
    return F'0o{int(__lowerCamelCase    )}'





def lowerCamelCase						(     )						->None:
    print("""\n2 in octal is:"""    )
    print(decimal_to_octal(2    )    )  # = 2
    print("""\n8 in octal is:"""    )
    print(decimal_to_octal(8    )    )  # = 10
    print("""\n65 in octal is:"""    )
    print(decimal_to_octal(65    )    )  # = 101
    print("""\n216 in octal is:"""    )
    print(decimal_to_octal(216    )    )  # = 330
    print("""\n512 in octal is:"""    )
    print(decimal_to_octal(512    )    )  # = 1000
    print("""\n"""    )


if __name__ == "__main__":
      main()








'''simple docstring'''






from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union

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


if TYPE_CHECKING:
   from ...onnx.config import PatchingSpec
   from ...tokenization_utils_base import PreTrainedTokenizerBase


A_							: Any						 =	logging.get_logger(__name__)

A_							: Optional[int]						 =	{
    """allenai/longformer-base-4096""": """https://huggingface.co/allenai/longformer-base-4096/resolve/main/config.json""",
    """allenai/longformer-large-4096""": """https://huggingface.co/allenai/longformer-large-4096/resolve/main/config.json""",
    """allenai/longformer-large-4096-finetuned-triviaqa""": (
        """https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/config.json"""
    ),
    """allenai/longformer-base-4096-extra.pos.embd.only""": (
        """https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/config.json"""
    ),
    """allenai/longformer-large-4096-extra.pos.embd.only""": (
        """https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/config.json"""
    ),
}



class 							lowercase       (  _lowerCamelCase				):


 """simple docstring"""


 UpperCAmelCase							=  """longformer"""







 def __init__(							self  ,a_ = 512  ,a_ = 2  ,a_ = 1  ,a_ = 0  ,a_ = 2  ,a_ = 30_522  ,a_ = 768  ,a_ = 12  ,a_ = 12  ,a_ = 3_072  ,a_ = "gelu"  ,a_ = 0.1  ,a_ = 0.1  ,a_ = 512  ,a_ = 2  ,a_ = 0.02  ,a_ = 1E-1_2  ,a_ = False  ,**a_  ,)		->   List[Any]:
        super().__init__(pad_token_id=a_  ,**a_							)

        _UpperCAmelCase  :						List[Any]			     = attention_window
        _UpperCAmelCase  :						Any			     = sep_token_id
        _UpperCAmelCase  :						Dict			     = bos_token_id
        _UpperCAmelCase  :						Tuple			     = eos_token_id
        _UpperCAmelCase  :						Tuple			     = vocab_size
        _UpperCAmelCase  :						Optional[Any]			     = hidden_size
        _UpperCAmelCase  :						Optional[int]			     = num_hidden_layers
        _UpperCAmelCase  :						Union[str, Any]			     = num_attention_heads
        _UpperCAmelCase  :						Optional[int]			     = hidden_act
        _UpperCAmelCase  :						str			     = intermediate_size
        _UpperCAmelCase  :						List[Any]			     = hidden_dropout_prob
        _UpperCAmelCase  :						Union[str, Any]			     = attention_probs_dropout_prob
        _UpperCAmelCase  :						List[str]			     = max_position_embeddings
        _UpperCAmelCase  :						Optional[int]			     = type_vocab_size
        _UpperCAmelCase  :						Any			     = initializer_range
        _UpperCAmelCase  :						Optional[int]			     = layer_norm_eps
        _UpperCAmelCase  :						Union[str, Any]			     = onnx_export







class 							lowercase       (  _lowerCamelCase				):


 """simple docstring"""


 def __init__(							self  ,a_  ,a_ = "default"  ,a_ = None							)		->   int:
        super().__init__(a_  ,a_  ,a_							)
        _UpperCAmelCase  :						Tuple			     = True







 @property
 def _snake_case (							self							)		->   Mapping[str, Mapping[int, str]]:
        if self.task == "multiple-choice":
               _UpperCAmelCase  :						Optional[int]			     = {0: """batch""", 1: """choice""", 2: """sequence"""}
        else:
               _UpperCAmelCase  :						Tuple			     = {0: """batch""", 1: """sequence"""}
        return OrderedDict(
            [
                ("""input_ids""", dynamic_axis),
                ("""attention_mask""", dynamic_axis),
                ("""global_attention_mask""", dynamic_axis),
            ]							)







 @property
 def _snake_case (							self							)		->   Mapping[str, Mapping[int, str]]:
        _UpperCAmelCase  :						str			     = super().outputs
        if self.task == "default":
               _UpperCAmelCase  :						int			     = {0: """batch"""}
        return outputs







 @property
 def _snake_case (							self							)		->   float:
        return 1E-4







 @property
 def _snake_case (							self							)		->   int:
        # needs to be >= 14 to support tril operator
        return max(super().default_onnx_opset  ,14							)







 def _snake_case (							self  ,a_  ,a_ = -1  ,a_ = -1  ,a_ = False  ,a_ = None  ,)		->   Mapping[str, Any]:
        _UpperCAmelCase  :						List[str]			     = super().generate_dummy_inputs(
            preprocessor=a_  ,batch_size=a_  ,seq_length=a_  ,is_pair=a_  ,framework=a_							)
        import torch

        # for some reason, replacing this code by inputs["global_attention_mask"] = torch.randint(2, inputs["input_ids"].shape, dtype=torch.int64)
        # makes the export fail randomly
        _UpperCAmelCase  :						int			     = torch.zeros_like(inputs["""input_ids"""]							)
        # make every second token global
        _UpperCAmelCase  :						List[str]			     = 1

        return inputs



