





'''simple docstring'''






import inspect
import unittest

from datasets import load_dataset
from packaging import version

from transformers import BeitConfig
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
      import torch
      from torch import nn

      from transformers import (
          MODEL_MAPPING,
          BeitForImageClassification,
          BeitForMaskedImageModeling,
          BeitForSemanticSegmentation,
          BeitModel,
      )
      from transformers.models.beit.modeling_beit import BEIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
      import PIL
      from PIL import Image

      from transformers import BeitImageProcessor




class 					UpperCAmelCase	:




      def __init__(     self     :					Union[str, Any]     ,     __snake_case     :					Dict     ,     __snake_case     :					Tuple=1_00     ,     __snake_case     :					Optional[Any]=13     ,     __snake_case     :					Tuple=30     ,     __snake_case     :					Union[str, Any]=2     ,     __snake_case     :					Union[str, Any]=3     ,     __snake_case     :					Union[str, Any]=True     ,     __snake_case     :					Union[str, Any]=True     ,     __snake_case     :					List[Any]=32     ,     __snake_case     :					Tuple=4     ,     __snake_case     :					Union[str, Any]=4     ,     __snake_case     :					int=37     ,     __snake_case     :					List[Any]="gelu"     ,     __snake_case     :					List[str]=0.1     ,     __snake_case     :					List[str]=0.1     ,     __snake_case     :					List[Any]=10     ,     __snake_case     :					List[Any]=0.02     ,     __snake_case     :					Any=3     ,     __snake_case     :					Optional[Any]=None     ,     __snake_case     :					Tuple=[0, 1, 2, 3]     ,     )							-> Optional[Any]:
            _lowerCAmelCase					=				parent
            _lowerCAmelCase					=				1_00
            _lowerCAmelCase					=				batch_size
            _lowerCAmelCase					=				image_size
            _lowerCAmelCase					=				patch_size
            _lowerCAmelCase					=				num_channels
            _lowerCAmelCase					=				is_training
            _lowerCAmelCase					=				use_labels
            _lowerCAmelCase					=				hidden_size
            _lowerCAmelCase					=				num_hidden_layers
            _lowerCAmelCase					=				num_attention_heads
            _lowerCAmelCase					=				intermediate_size
            _lowerCAmelCase					=				hidden_act
            _lowerCAmelCase					=				hidden_dropout_prob
            _lowerCAmelCase					=				attention_probs_dropout_prob
            _lowerCAmelCase					=				type_sequence_label_size
            _lowerCAmelCase					=				initializer_range
            _lowerCAmelCase					=				scope
            _lowerCAmelCase					=				out_indices
            _lowerCAmelCase					=				num_labels

            # in BeiT, the seq length equals the number of patches + 1 (we add 1 for the [CLS] token)
            _lowerCAmelCase					=				(image_size // patch_size) ** 2
            _lowerCAmelCase					=				num_patches + 1




      def 							lowercase__       (     self     :					Optional[Any]    )							-> int:
            _lowerCAmelCase					=				floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]    )

            _lowerCAmelCase					=				None
            _lowerCAmelCase					=				None
            if self.use_labels:
                  _lowerCAmelCase					=				ids_tensor([self.batch_size]     ,     self.type_sequence_label_size    )
                  _lowerCAmelCase					=				ids_tensor([self.batch_size, self.image_size, self.image_size]     ,     self.num_labels    )

            _lowerCAmelCase					=				self.get_config()

            return config, pixel_values, labels, pixel_labels




      def 							lowercase__       (     self     :					Dict    )							-> Dict:
            return BeitConfig(
                vocab_size=self.vocab_size     ,     image_size=self.image_size     ,     patch_size=self.patch_size     ,     num_channels=self.num_channels     ,     hidden_size=self.hidden_size     ,     num_hidden_layers=self.num_hidden_layers     ,     num_attention_heads=self.num_attention_heads     ,     intermediate_size=self.intermediate_size     ,     hidden_act=self.hidden_act     ,     hidden_dropout_prob=self.hidden_dropout_prob     ,     attention_probs_dropout_prob=self.attention_probs_dropout_prob     ,     is_decoder=__snake_case     ,     initializer_range=self.initializer_range     ,     out_indices=self.out_indices     ,     )




      def 							lowercase__       (     self     :					Union[str, Any]     ,     __snake_case     :					Optional[Any]     ,     __snake_case     :					Optional[Any]     ,     __snake_case     :					str     ,     __snake_case     :					List[str]    )							-> str:
            _lowerCAmelCase					=				BeitModel(config=__snake_case    )
            model.to(__snake_case    )
            model.eval()
            _lowerCAmelCase					=				model(__snake_case    )
            self.parent.assertEqual(result.last_hidden_state.shape     ,     (self.batch_size, self.seq_length, self.hidden_size)    )




      def 							lowercase__       (     self     :					str     ,     __snake_case     :					int     ,     __snake_case     :					Union[str, Any]     ,     __snake_case     :					Dict     ,     __snake_case     :					Any    )							-> List[str]:
            _lowerCAmelCase					=				BeitForMaskedImageModeling(config=__snake_case    )
            model.to(__snake_case    )
            model.eval()
            _lowerCAmelCase					=				model(__snake_case    )
            self.parent.assertEqual(result.logits.shape     ,     (self.batch_size, self.seq_length - 1, self.vocab_size)    )




      def 							lowercase__       (     self     :					int     ,     __snake_case     :					Optional[int]     ,     __snake_case     :					Any     ,     __snake_case     :					Optional[int]     ,     __snake_case     :					Dict    )							-> Union[str, Any]:
            _lowerCAmelCase					=				self.type_sequence_label_size
            _lowerCAmelCase					=				BeitForImageClassification(__snake_case    )
            model.to(__snake_case    )
            model.eval()
            _lowerCAmelCase					=				model(__snake_case     ,     labels=__snake_case    )
            self.parent.assertEqual(result.logits.shape     ,     (self.batch_size, self.type_sequence_label_size)    )

            # test greyscale images
            _lowerCAmelCase					=				1
            _lowerCAmelCase					=				BeitForImageClassification(__snake_case    )
            model.to(__snake_case    )
            model.eval()

            _lowerCAmelCase					=				floats_tensor([self.batch_size, 1, self.image_size, self.image_size]    )
            _lowerCAmelCase					=				model(__snake_case     ,     labels=__snake_case    )
            self.parent.assertEqual(result.logits.shape     ,     (self.batch_size, self.type_sequence_label_size)    )




      def 							lowercase__       (     self     :					Union[str, Any]     ,     __snake_case     :					Any     ,     __snake_case     :					str     ,     __snake_case     :					List[Any]     ,     __snake_case     :					Any    )							-> Tuple:
            _lowerCAmelCase					=				self.num_labels
            _lowerCAmelCase					=				BeitForSemanticSegmentation(__snake_case    )
            model.to(__snake_case    )
            model.eval()
            _lowerCAmelCase					=				model(__snake_case    )
            self.parent.assertEqual(
                result.logits.shape     ,     (self.batch_size, self.num_labels, self.image_size * 2, self.image_size * 2)    )
            _lowerCAmelCase					=				model(__snake_case     ,     labels=__snake_case    )
            self.parent.assertEqual(
                result.logits.shape     ,     (self.batch_size, self.num_labels, self.image_size * 2, self.image_size * 2)    )




      def 							lowercase__       (     self     :					Optional[int]    )							-> Optional[Any]:
            _lowerCAmelCase					=				self.prepare_config_and_inputs()
            _lowerCAmelCase	,				_lowerCAmelCase	,				_lowerCAmelCase	,				_lowerCAmelCase					=				config_and_inputs
            _lowerCAmelCase					=				{"""pixel_values""": pixel_values}
            return config, inputs_dict




@require_torch
class 					UpperCAmelCase	(     snake_case_				,						snake_case_				,						unittest.TestCase  ):
      _lowercase:     List[str]			=  (
          (BeitModel, BeitForImageClassification, BeitForMaskedImageModeling, BeitForSemanticSegmentation)
          if is_torch_available()
          else ()
      )
      _lowercase:     str			=  (
          {
              '''feature-extraction''': BeitModel,
              '''image-classification''': BeitForImageClassification,
              '''image-segmentation''': BeitForSemanticSegmentation,
          }
          if is_torch_available()
          else {}
      )

      _lowercase:     Optional[int]			=  False
      _lowercase:     List[str]			=  False
      _lowercase:     Dict			=  False




      def 							lowercase__       (     self     :					List[Any]    )							-> Optional[int]:
            _lowerCAmelCase					=				BeitModelTester(self    )
            _lowerCAmelCase					=				ConfigTester(self     ,     config_class=__snake_case     ,     has_text_modality=__snake_case     ,     hidden_size=37    )




      def 							lowercase__       (     self     :					Any    )							-> Any:
            self.config_tester.run_common_tests()




      @unittest.skip(reason="""BEiT does not use inputs_embeds"""    )
      def 							lowercase__       (     self     :					Optional[int]    )							-> int:
            pass




      @require_torch_multi_gpu
      @unittest.skip(reason="""BEiT has some layers using `add_module` which doesn't work well with `nn.DataParallel`"""    )
      def 							lowercase__       (     self     :					Optional[Any]    )							-> Any:
            pass




      def 							lowercase__       (     self     :					List[str]    )							-> Any:
            _lowerCAmelCase	,				_lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs_for_common()

            for model_class in self.all_model_classes:
                  _lowerCAmelCase					=				model_class(__snake_case    )
                  self.assertIsInstance(model.get_input_embeddings()     ,     (nn.Module)    )
                  _lowerCAmelCase					=				model.get_output_embeddings()
                  self.assertTrue(x is None or isinstance(__snake_case     ,     nn.Linear    )    )




      def 							lowercase__       (     self     :					Union[str, Any]    )							-> int:
            _lowerCAmelCase	,				_lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs_for_common()

            for model_class in self.all_model_classes:
                  _lowerCAmelCase					=				model_class(__snake_case    )
                  _lowerCAmelCase					=				inspect.signature(model.forward    )
                  # signature.parameters is an OrderedDict => so arg_names order is deterministic
                  _lowerCAmelCase					=				[*signature.parameters.keys()]

                  _lowerCAmelCase					=				["""pixel_values"""]
                  self.assertListEqual(arg_names[:1]     ,     __snake_case    )




      def 							lowercase__       (     self     :					Optional[int]    )							-> str:
            _lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs()
            self.model_tester.create_and_check_model(*__snake_case    )




      def 							lowercase__       (     self     :					List[Any]    )							-> Any:
            _lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs()
            self.model_tester.create_and_check_for_masked_lm(*__snake_case    )




      def 							lowercase__       (     self     :					List[Any]    )							-> Optional[int]:
            _lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs()
            self.model_tester.create_and_check_for_image_classification(*__snake_case    )




      def 							lowercase__       (     self     :					int    )							-> int:
            _lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs()
            self.model_tester.create_and_check_for_semantic_segmentation(*__snake_case    )




      def 							lowercase__       (     self     :					Optional[Any]    )							-> Optional[int]:
            if not self.model_tester.is_training:
                  return

            _lowerCAmelCase	,				_lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs_for_common()
            _lowerCAmelCase					=				True

            for model_class in self.all_model_classes:
                  # we don't test BeitForMaskedImageModeling
                  if model_class in [*get_values(__snake_case    ), BeitForMaskedImageModeling]:
                        continue

                  _lowerCAmelCase					=				model_class(__snake_case    )
                  model.to(__snake_case    )
                  model.train()
                  _lowerCAmelCase					=				self._prepare_for_class(__snake_case     ,     __snake_case     ,     return_labels=__snake_case    )
                  _lowerCAmelCase					=				model(**__snake_case    ).loss
                  loss.backward()




      def 							lowercase__       (     self     :					List[Any]    )							-> List[Any]:
            _lowerCAmelCase	,				_lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs_for_common()
            if not self.model_tester.is_training:
                  return

            _lowerCAmelCase					=				False
            _lowerCAmelCase					=				True

            for model_class in self.all_model_classes:
                  # we don't test BeitForMaskedImageModeling
                  if (
                      model_class in [*get_values(__snake_case    ), BeitForMaskedImageModeling]
                      or not model_class.supports_gradient_checkpointing
                  ):
                        continue

                  _lowerCAmelCase					=				model_class(__snake_case    )
                  model.gradient_checkpointing_enable()
                  model.to(__snake_case    )
                  model.train()
                  _lowerCAmelCase					=				self._prepare_for_class(__snake_case     ,     __snake_case     ,     return_labels=__snake_case    )
                  _lowerCAmelCase					=				model(**__snake_case    ).loss
                  loss.backward()




      def 							lowercase__       (     self     :					Optional[int]    )							-> Optional[Any]:
            _lowerCAmelCase	,				_lowerCAmelCase					=				self.model_tester.prepare_config_and_inputs_for_common()

            _lowerCAmelCase					=				_config_zero_init(__snake_case    )
            for model_class in self.all_model_classes:
                  _lowerCAmelCase					=				model_class(config=__snake_case    )
                  for name, param in model.named_parameters():
                        # we skip lambda parameters as these require special initial values
                        # determined by config.layer_scale_init_value
                        if "lambda" in name:
                              continue
                        if param.requires_grad:
                              self.assertIn(
                                  ((param.data.mean() * 1E9).round() / 1E9).item()     ,     [0.0, 1.0]     ,     msg=f"Parameter {name} of model {model_class} seems not properly initialized"     ,     )




      @slow
      def 							lowercase__       (     self     :					int    )							-> List[Any]:
            for model_name in BEIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                  _lowerCAmelCase					=				BeitModel.from_pretrained(__snake_case    )
                  self.assertIsNotNone(__snake_case    )




def   UpperCamelCase__ (						):





      """simple docstring"""


      _lowerCAmelCase					=				Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""    )
      return image





@require_torch
@require_vision
class 					UpperCAmelCase	(     unittest.TestCase  ):




      @cached_property
      def 							lowercase__       (     self     :					int    )							-> Union[str, Any]:
            return BeitImageProcessor.from_pretrained("""microsoft/beit-base-patch16-224"""    ) if is_vision_available() else None




      @slow
      def 							lowercase__       (     self     :					int    )							-> str:
            _lowerCAmelCase					=				BeitForMaskedImageModeling.from_pretrained("""microsoft/beit-base-patch16-224-pt22k"""    ).to(__snake_case    )

            _lowerCAmelCase					=				self.default_image_processor
            _lowerCAmelCase					=				prepare_img()
            _lowerCAmelCase					=				image_processor(images=__snake_case     ,     return_tensors="""pt"""    ).pixel_values.to(__snake_case    )

            # prepare bool_masked_pos
            _lowerCAmelCase					=				torch.ones((1, 1_96)     ,     dtype=torch.bool    ).to(__snake_case    )

            # forward pass
            with torch.no_grad():
                  _lowerCAmelCase					=				model(pixel_values=__snake_case     ,     bool_masked_pos=__snake_case    )
            _lowerCAmelCase					=				outputs.logits

            # verify the logits
            _lowerCAmelCase					=				torch.Size((1, 1_96, 81_92)    )
            self.assertEqual(logits.shape     ,     __snake_case    )

            _lowerCAmelCase					=				torch.tensor(
                [[-3.24_37, 0.50_72, -13.91_74], [-3.24_56, 0.49_48, -13.94_01], [-3.20_33, 0.51_21, -13.85_50]]    ).to(__snake_case    )

            self.assertTrue(torch.allclose(logits[bool_masked_pos][:3, :3]     ,     __snake_case     ,     atol=1E-2    )    )




      @slow
      def 							lowercase__       (     self     :					Optional[Any]    )							-> Optional[int]:
            _lowerCAmelCase					=				BeitForImageClassification.from_pretrained("""microsoft/beit-base-patch16-224"""    ).to(__snake_case    )

            _lowerCAmelCase					=				self.default_image_processor
            _lowerCAmelCase					=				prepare_img()
            _lowerCAmelCase					=				image_processor(images=__snake_case     ,     return_tensors="""pt"""    ).to(__snake_case    )

            # forward pass
            with torch.no_grad():
                  _lowerCAmelCase					=				model(**__snake_case    )
            _lowerCAmelCase					=				outputs.logits

            # verify the logits
            _lowerCAmelCase					=				torch.Size((1, 10_00)    )
            self.assertEqual(logits.shape     ,     __snake_case    )

            _lowerCAmelCase					=				torch.tensor([-1.23_85, -1.09_87, -1.01_08]    ).to(__snake_case    )

            self.assertTrue(torch.allclose(logits[0, :3]     ,     __snake_case     ,     atol=1E-4    )    )

            _lowerCAmelCase					=				2_81
            self.assertEqual(logits.argmax(-1    ).item()     ,     __snake_case    )




      @slow
      def 							lowercase__       (     self     :					Optional[Any]    )							-> str:
            _lowerCAmelCase					=				BeitForImageClassification.from_pretrained("""microsoft/beit-large-patch16-224-pt22k-ft22k"""    ).to(
                __snake_case    )

            _lowerCAmelCase					=				self.default_image_processor
            _lowerCAmelCase					=				prepare_img()
            _lowerCAmelCase					=				image_processor(images=__snake_case     ,     return_tensors="""pt"""    ).to(__snake_case    )

            # forward pass
            with torch.no_grad():
                  _lowerCAmelCase					=				model(**__snake_case    )
            _lowerCAmelCase					=				outputs.logits

            # verify the logits
            _lowerCAmelCase					=				torch.Size((1, 2_18_41)    )
            self.assertEqual(logits.shape     ,     __snake_case    )

            _lowerCAmelCase					=				torch.tensor([1.68_81, -0.27_87, 0.59_01]    ).to(__snake_case    )

            self.assertTrue(torch.allclose(logits[0, :3]     ,     __snake_case     ,     atol=1E-4    )    )

            _lowerCAmelCase					=				23_96
            self.assertEqual(logits.argmax(-1    ).item()     ,     __snake_case    )




      @slow
      def 							lowercase__       (     self     :					int    )							-> List[Any]:
            _lowerCAmelCase					=				BeitForSemanticSegmentation.from_pretrained("""microsoft/beit-base-finetuned-ade-640-640"""    )
            _lowerCAmelCase					=				model.to(__snake_case    )

            _lowerCAmelCase					=				BeitImageProcessor(do_resize=__snake_case     ,     size=6_40     ,     do_center_crop=__snake_case    )

            _lowerCAmelCase					=				load_dataset("""hf-internal-testing/fixtures_ade20k"""     ,     split="""test"""    )
            _lowerCAmelCase					=				Image.open(ds[0]["""file"""]    )
            _lowerCAmelCase					=				image_processor(images=__snake_case     ,     return_tensors="""pt"""    ).to(__snake_case    )

            # forward pass
            with torch.no_grad():
                  _lowerCAmelCase					=				model(**__snake_case    )
            _lowerCAmelCase					=				outputs.logits

            # verify the logits
            _lowerCAmelCase					=				torch.Size((1, 1_50, 1_60, 1_60)    )
            self.assertEqual(logits.shape     ,     __snake_case    )

            _lowerCAmelCase					=				version.parse(PIL.__version__    ) < version.parse("""9.0.0"""    )

            if is_pillow_less_than_a:
                  _lowerCAmelCase					=				torch.tensor(
                      [
                          [[-4.92_25, -2.39_54, -3.05_22], [-2.88_22, -1.00_46, -1.75_61], [-2.95_49, -1.32_28, -2.13_47]],
                          [[-5.81_68, -3.41_29, -4.07_78], [-3.86_51, -2.22_14, -3.02_77], [-3.83_56, -2.46_43, -3.35_35]],
                          [[-0.00_78, 3.99_52, 4.07_54], [2.98_56, 4.69_44, 5.00_35], [3.24_13, 4.78_13, 4.99_69]],
                      ]     ,     device=__snake_case     ,     )
            else:
                  _lowerCAmelCase					=				torch.tensor(
                      [
                          [[-4.89_60, -2.36_88, -3.03_55], [-2.84_78, -0.98_36, -1.74_18], [-2.94_49, -1.33_32, -2.14_56]],
                          [[-5.80_81, -3.41_24, -4.10_06], [-3.85_61, -2.20_81, -3.03_23], [-3.83_65, -2.46_01, -3.36_69]],
                          [[-0.03_09, 3.98_68, 4.05_40], [2.96_40, 4.68_77, 4.99_76], [3.20_81, 4.76_90, 4.99_42]],
                      ]     ,     device=__snake_case     ,     )

            self.assertTrue(torch.allclose(logits[0, :3, :3, :3]     ,     __snake_case     ,     atol=1E-4    )    )




      @slow
      def 							lowercase__       (     self     :					List[Any]    )							-> int:
            _lowerCAmelCase					=				BeitForSemanticSegmentation.from_pretrained("""microsoft/beit-base-finetuned-ade-640-640"""    )
            _lowerCAmelCase					=				model.to(__snake_case    )

            _lowerCAmelCase					=				BeitImageProcessor(do_resize=__snake_case     ,     size=6_40     ,     do_center_crop=__snake_case    )

            _lowerCAmelCase					=				load_dataset("""hf-internal-testing/fixtures_ade20k"""     ,     split="""test"""    )
            _lowerCAmelCase					=				Image.open(ds[0]["""file"""]    )
            _lowerCAmelCase					=				image_processor(images=__snake_case     ,     return_tensors="""pt"""    ).to(__snake_case    )

            # forward pass
            with torch.no_grad():
                  _lowerCAmelCase					=				model(**__snake_case    )

            _lowerCAmelCase					=				outputs.logits.detach().cpu()

            _lowerCAmelCase					=				image_processor.post_process_semantic_segmentation(outputs=__snake_case     ,     target_sizes=[(5_00, 3_00)]    )
            _lowerCAmelCase					=				torch.Size((5_00, 3_00)    )
            self.assertEqual(segmentation[0].shape     ,     __snake_case    )

            _lowerCAmelCase					=				image_processor.post_process_semantic_segmentation(outputs=__snake_case    )
            _lowerCAmelCase					=				torch.Size((1_60, 1_60)    )
            self.assertEqual(segmentation[0].shape     ,     __snake_case    )













'''simple docstring'''






# Copyright 2023 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.

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A__							:  int    ={
    '''configuration_xmod''': [
        '''XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''XmodConfig''',
        '''XmodOnnxConfig''',
    ],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__							:  List[str]    =[
          '''XMOD_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''XmodForCausalLM''',
          '''XmodForMaskedLM''',
          '''XmodForMultipleChoice''',
          '''XmodForQuestionAnswering''',
          '''XmodForSequenceClassification''',
          '''XmodForTokenClassification''',
          '''XmodModel''',
          '''XmodPreTrainedModel''',
      ]

if TYPE_CHECKING:
      from .configuration_xmod import XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP, XmodConfig, XmodOnnxConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_xmod import (
                XMOD_PRETRAINED_MODEL_ARCHIVE_LIST,
                XmodForCausalLM,
                XmodForMaskedLM,
                XmodForMultipleChoice,
                XmodForQuestionAnswering,
                XmodForSequenceClassification,
                XmodForTokenClassification,
                XmodModel,
                XmodPreTrainedModel,
            )

else:
      import sys

      A__							:  str    =_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






