


from typing import TYPE_CHECKING

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


_A			=		{
    'configuration_xlm_roberta': [
        'XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'XLMRobertaConfig',
        'XLMRobertaOnnxConfig',
    ],
}

try:
   if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A			=		['XLMRobertaTokenizer']

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A			=		['XLMRobertaTokenizerFast']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A			=		[
       'XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
       'XLMRobertaForCausalLM',
       'XLMRobertaForMaskedLM',
       'XLMRobertaForMultipleChoice',
       'XLMRobertaForQuestionAnswering',
       'XLMRobertaForSequenceClassification',
       'XLMRobertaForTokenClassification',
       'XLMRobertaModel',
       'XLMRobertaPreTrainedModel',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A			=		[
       'TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
       'TFXLMRobertaForCausalLM',
       'TFXLMRobertaForMaskedLM',
       'TFXLMRobertaForMultipleChoice',
       'TFXLMRobertaForQuestionAnswering',
       'TFXLMRobertaForSequenceClassification',
       'TFXLMRobertaForTokenClassification',
       'TFXLMRobertaModel',
       'TFXLMRobertaPreTrainedModel',
   ]

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A			=		[
       'FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
       'FlaxXLMRobertaForMaskedLM',
       'FlaxXLMRobertaForCausalLM',
       'FlaxXLMRobertaForMultipleChoice',
       'FlaxXLMRobertaForQuestionAnswering',
       'FlaxXLMRobertaForSequenceClassification',
       'FlaxXLMRobertaForTokenClassification',
       'FlaxXLMRobertaModel',
       'FlaxXLMRobertaPreTrainedModel',
   ]

if TYPE_CHECKING:
   from .configuration_xlm_roberta import (
       XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
       XLMRobertaConfig,
       XLMRobertaOnnxConfig,
   )

   try:
      if not is_sentencepiece_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_xlm_roberta import XLMRobertaTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_xlm_roberta_fast import XLMRobertaTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_xlm_roberta import (
          XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
          XLMRobertaForCausalLM,
          XLMRobertaForMaskedLM,
          XLMRobertaForMultipleChoice,
          XLMRobertaForQuestionAnswering,
          XLMRobertaForSequenceClassification,
          XLMRobertaForTokenClassification,
          XLMRobertaModel,
          XLMRobertaPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_xlm_roberta import (
          TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFXLMRobertaForCausalLM,
          TFXLMRobertaForMaskedLM,
          TFXLMRobertaForMultipleChoice,
          TFXLMRobertaForQuestionAnswering,
          TFXLMRobertaForSequenceClassification,
          TFXLMRobertaForTokenClassification,
          TFXLMRobertaModel,
          TFXLMRobertaPreTrainedModel,
      )

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_xlm_roberta import (
          FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
          FlaxXLMRobertaForCausalLM,
          FlaxXLMRobertaForMaskedLM,
          FlaxXLMRobertaForMultipleChoice,
          FlaxXLMRobertaForQuestionAnswering,
          FlaxXLMRobertaForSequenceClassification,
          FlaxXLMRobertaForTokenClassification,
          FlaxXLMRobertaModel,
          FlaxXLMRobertaPreTrainedModel,
      )

else:
   import sys

   _A			=		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)









# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


_A			=						[
    'EAGER',
    'AOT_EAGER',
    'INDUCTOR',
    'NVFUSER',
    'AOT_NVFUSER',
    'AOT_CUDAGRAPHS',
    'OFI',
    'FX2TRT',
    'ONNXRT',
    'IPEX',
]

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Optional[int]      ,					SCREAMING_SNAKE_CASE__      : Optional[Any]=None      ,					SCREAMING_SNAKE_CASE__      : Optional[Any]=None      ,					SCREAMING_SNAKE_CASE__      : str=None    ):
     __UpperCamelCase   							=True
     while ask_again:
          __UpperCamelCase   							=input(SCREAMING_SNAKE_CASE__    )
          try:
               if default is not None and len(SCREAMING_SNAKE_CASE__    ) == 0:
                    return default
               return convert_value(SCREAMING_SNAKE_CASE__    ) if convert_value is not None else result
          except Exception:
               if error_message is not None:
                    print(SCREAMING_SNAKE_CASE__    )

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : List[Any]      ,					SCREAMING_SNAKE_CASE__      : List[str]=[]      ,					SCREAMING_SNAKE_CASE__      : Union[str, Any]=None      ,					SCREAMING_SNAKE_CASE__      : str=0    ):
     __UpperCamelCase   							=BulletMenu(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     __UpperCamelCase   							=menu.run(default_choice=SCREAMING_SNAKE_CASE__    )
     return convert_value(SCREAMING_SNAKE_CASE__    ) if convert_value is not None else result

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Union[str, Any]    ):
     __UpperCamelCase   							=int(SCREAMING_SNAKE_CASE__    )
     return ComputeEnvironment(['LOCAL_MACHINE', 'AMAZON_SAGEMAKER'][value]    )

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : List[str]    ):
     __UpperCamelCase   							=int(SCREAMING_SNAKE_CASE__    )
     return DistributedType(['NO', 'MULTI_CPU', 'MULTI_XPU', 'MULTI_GPU', 'MULTI_NPU', 'TPU'][value]    )

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Optional[int]    ):
     __UpperCamelCase   							=int(SCREAMING_SNAKE_CASE__    )
     return DynamoBackend(DYNAMO_BACKENDS[value]    ).value

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Dict    ):
     __UpperCamelCase   							=int(SCREAMING_SNAKE_CASE__    )
     return PrecisionType(['no', 'fp16', 'bf16', 'fp8'][value]    )

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Optional[Any]    ):
     __UpperCamelCase   							=int(SCREAMING_SNAKE_CASE__    )
     return SageMakerDistributedType(['NO', 'DATA_PARALLEL', 'MODEL_PARALLEL'][value]    )

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Any    ):
     return {"yes": True, "no": False}[value.lower()]






class    UpperCAmelCase__	( argparse.RawDescriptionHelpFormatter		):



    """simple docstring"""






    def _a (      self ,       A_ ,       A_ ,       A_ ,       A_   )  ->	Optional[int]:
         __UpperCamelCase   							=super()._format_usage(A_ ,       A_ ,       A_ ,       A_   )
         __UpperCamelCase   							=usage.replace('<command> [<args>] ' ,       ''   )
         return usage





