


import importlib
import os
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Union

import torch

from ..utils import BaseOutput


__UpperCamelCase    :						Dict     =							'scheduler_config.json'



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Optional[int]    = 1
   a_				:							str    = 2
   a_				:							List[Any]    = 3
   a_				:							List[str]    = 4
   a_				:							List[str]    = 5
   a_				:							List[str]    = 6
   a_				:							Tuple    = 7
   a_				:							Any    = 8
   a_				:							Union[str, Any]    = 9
   a_				:							str    = 10
   a_				:							Optional[Any]    = 11
   a_				:							List[Any]    = 12
   a_				:							Optional[Any]    = 13
   a_				:							Union[str, Any]    = 14



@dataclass
class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							torch.FloatTensor



class 							_UpperCamelCase :

   '''simple docstring'''







   a_				:							Any    = SCHEDULER_CONFIG_NAME
   a_				:							Optional[Any]    = []
   a_				:							List[Any]    = True

   @classmethod
   def   _snake_case    (  cls  : List[str]       ,  _lowerCamelCase  : Dict[str, Any] = None       ,  _lowerCamelCase  : Optional[str] = None       ,  _lowerCamelCase  : Union[str, Any]=False       ,  **_lowerCamelCase  : int       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      Union[str, Any]       						=						cls.load_config(
             pretrained_model_name_or_path=_lowerCamelCase       ,  subfolder=_lowerCamelCase       ,  return_unused_kwargs=_lowerCamelCase       ,  return_commit_hash=_lowerCamelCase       ,  **_lowerCamelCase       ,  )
         return cls.from_config(_lowerCamelCase       ,  return_unused_kwargs=_lowerCamelCase       ,  **_lowerCamelCase							)

   def   _snake_case    (  self  : Tuple       ,  _lowerCamelCase  : Union[str, os.PathLike]       ,  _lowerCamelCase  : bool = False       ,  **_lowerCamelCase  : int							):






         '''simple docstring'''



         self.save_config(save_directory=_lowerCamelCase       ,  push_to_hub=_lowerCamelCase       ,  **_lowerCamelCase							)

   @property
   def   _snake_case    (  self  : Dict							):






         '''simple docstring'''



         return self._get_compatibles()


   @classmethod
   def   _snake_case    (  cls  : List[Any]							):






         '''simple docstring'''



         __lowerCamelCase     :      List[Any]       						=						list(set([cls.__name__] + cls._compatibles							)							)
         __lowerCamelCase     :      List[str]       						=						importlib.import_module(__name__.split("""."""							)[0]							)
         __lowerCamelCase     :      Tuple       						=						[
             getattr(_lowerCamelCase       ,  _lowerCamelCase							) for c in compatible_classes_str if hasattr(_lowerCamelCase       ,  _lowerCamelCase							)
         ]
         return compatible_classes







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


__UpperCamelCase    :						Union[str, Any]     =							{
    'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LayoutLMv2Config'],
    'processing_layoutlmv2': ['LayoutLMv2Processor'],
    'tokenization_layoutlmv2': ['LayoutLMv2Tokenizer'],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __UpperCamelCase    :						List[str]     =							['LayoutLMv2TokenizerFast']

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __UpperCamelCase    :						List[str]     =							['LayoutLMv2FeatureExtractor']
    __UpperCamelCase    :						Union[str, Any]     =							['LayoutLMv2ImageProcessor']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __UpperCamelCase    :						Dict     =							[
        'LAYOUTLMV2_PRETRAINED_MODEL_ARCHIVE_LIST',
        'LayoutLMv2ForQuestionAnswering',
        'LayoutLMv2ForSequenceClassification',
        'LayoutLMv2ForTokenClassification',
        'LayoutLMv2Layer',
        'LayoutLMv2Model',
        'LayoutLMv2PreTrainedModel',
    ]

if TYPE_CHECKING:
    from .configuration_layoutlmva import LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMvaConfig
    from .processing_layoutlmva import LayoutLMvaProcessor
    from .tokenization_layoutlmva import LayoutLMvaTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_layoutlmva_fast import LayoutLMvaTokenizerFast

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_layoutlmva import LayoutLMvaFeatureExtractor, LayoutLMvaImageProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_layoutlmva import (
            LAYOUTLMV2_PRETRAINED_MODEL_ARCHIVE_LIST,
            LayoutLMvaForQuestionAnswering,
            LayoutLMvaForSequenceClassification,
            LayoutLMvaForTokenClassification,
            LayoutLMvaLayer,
            LayoutLMvaModel,
            LayoutLMvaPreTrainedModel,
        )
else:
    import sys

    __UpperCamelCase    :						Optional[Any]     =							_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



