



"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCamelCase       	=						{"""configuration_xlnet""": ["""XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLNetConfig"""]}

try:
  if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase       	=						["""XLNetTokenizer"""]

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase       	=						["""XLNetTokenizerFast"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase       	=						[
      """XLNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """XLNetForMultipleChoice""",
      """XLNetForQuestionAnswering""",
      """XLNetForQuestionAnsweringSimple""",
      """XLNetForSequenceClassification""",
      """XLNetForTokenClassification""",
      """XLNetLMHeadModel""",
      """XLNetModel""",
      """XLNetPreTrainedModel""",
      """load_tf_weights_in_xlnet""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase       	=						[
      """TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFXLNetForMultipleChoice""",
      """TFXLNetForQuestionAnsweringSimple""",
      """TFXLNetForSequenceClassification""",
      """TFXLNetForTokenClassification""",
      """TFXLNetLMHeadModel""",
      """TFXLNetMainLayer""",
      """TFXLNetModel""",
      """TFXLNetPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig

  try:
    if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_xlnet import XLNetTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_xlnet_fast import XLNetTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_xlnet import (
        XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
        XLNetForMultipleChoice,
        XLNetForQuestionAnswering,
        XLNetForQuestionAnsweringSimple,
        XLNetForSequenceClassification,
        XLNetForTokenClassification,
        XLNetLMHeadModel,
        XLNetModel,
        XLNetPreTrainedModel,
        load_tf_weights_in_xlnet,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_xlnet import (
        TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFXLNetForMultipleChoice,
        TFXLNetForQuestionAnsweringSimple,
        TFXLNetForSequenceClassification,
        TFXLNetForTokenClassification,
        TFXLNetLMHeadModel,
        TFXLNetMainLayer,
        TFXLNetModel,
        TFXLNetPreTrainedModel,
    )

else:
  import sys

  lowerCamelCase       	=						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)









"""simple docstring"""





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


lowerCamelCase       	=						logging.get_logger(__name__)

lowerCamelCase       	=						{
    """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-430m-pile""": """https://huggingface.co/RWKV/rwkv-4-430m-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-1b5-pile""": """https://huggingface.co/RWKV/rwkv-4-1b5-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-3b-pile""": """https://huggingface.co/RWKV/rwkv-4-3b-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-7b-pile""": """https://huggingface.co/RWKV/rwkv-4-7b-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-14b-pile""": """https://huggingface.co/RWKV/rwkv-4-14b-pile/resolve/main/config.json""",
    """RWKV/rwkv-raven-1b5""": """https://huggingface.co/RWKV/rwkv-raven-1b5/resolve/main/config.json""",
    """RWKV/rwkv-raven-3b""": """https://huggingface.co/RWKV/rwkv-raven-3b/resolve/main/config.json""",
    """RWKV/rwkv-raven-7b""": """https://huggingface.co/RWKV/rwkv-raven-7b/resolve/main/config.json""",
    """RWKV/rwkv-raven-14b""": """https://huggingface.co/RWKV/rwkv-raven-14b/resolve/main/config.json""",
}
class 				lowercase__       (   SCREAMING_SNAKE_CASE				):







       '''simple docstring'''


       UpperCamelCase						=					'''rwkv'''
       UpperCamelCase						=					{'''max_position_embeddings''': '''context_length'''}



       def __init__(							self      :  str		,    _UpperCAmelCase      :  int=50277		,    _UpperCAmelCase      :  Optional[Any]=1024		,    _UpperCAmelCase      :  str=4096		,    _UpperCAmelCase      :  Any=32		,    _UpperCAmelCase      :  Any=None		,    _UpperCAmelCase      :  Optional[int]=None		,    _UpperCAmelCase      :  Tuple=1e-5		,    _UpperCAmelCase      :  str=0		,    _UpperCAmelCase      :  Any=0		,    _UpperCAmelCase      :  Union[str, Any]=6		,    _UpperCAmelCase      :  Dict=False		,    _UpperCAmelCase      :  Any=True		,    **_UpperCAmelCase      :  Optional[Any]		,    )			->						str:


             '''simple docstring'''




             UpperCAmelCase_      			=							vocab_size
             UpperCAmelCase_      			=							context_length
             UpperCAmelCase_      			=							hidden_size
             UpperCAmelCase_      			=							num_hidden_layers
             UpperCAmelCase_      			=							attention_hidden_size if attention_hidden_size is not None else hidden_size
             UpperCAmelCase_      			=							intermediate_size if intermediate_size is not None else 4 * hidden_size
             UpperCAmelCase_      			=							layer_norm_epsilon
             UpperCAmelCase_      			=							rescale_every
             UpperCAmelCase_      			=							use_cache

             UpperCAmelCase_      			=							bos_token_id
             UpperCAmelCase_      			=							eos_token_id

             super().__init__(
                 tie_word_embeddings=_UpperCAmelCase		,    bos_token_id=_UpperCAmelCase		,    eos_token_id=_UpperCAmelCase		,    **_UpperCAmelCase   )




