





"""simple docstring"""





import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple

import numpy as np

from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy


if is_flax_available():
							import jax.numpy as jnp
class 		SCREAMING_SNAKE_CASE_				(     snake_case__ ):
				"""simple docstring"""




				def __get__(  self	:Any    ,     __lowercase	:str    ,     __lowercase	:Tuple=None      ):
											# See docs.python.org/3/howto/descriptor.html#properties
											if obj is None:
																		return self
											if self.fget is None:
																		raise AttributeError('''unreadable attribute'''      )
											__lowerCamelCase   :   Optional[Any]       ='''__cached_''' + self.fget.__name__
											__lowerCamelCase   :   Any       =getattr(__lowercase    ,     __lowercase    ,     __lowercase      )
											if cached is None:
																		__lowerCamelCase   :   List[Any]       =self.fget(__lowercase      )
																		setattr(__lowercase    ,     __lowercase    ,     __lowercase      )
											return cached



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Union[str, Any] ):


							'''simple docstring'''







							__lowerCamelCase   :   str       =val.lower()
							if val in {"y", "yes", "t", "true", "on", "1"}:
														return 1
							if val in {"n", "no", "f", "false", "off", "0"}:
														return 0
							raise ValueError(F'invalid truth value {val!r}' )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				List[str] ):


							'''simple docstring'''







							if is_torch_fx_proxy(SCREAMING_SNAKE_CASE ):
														return True
							if is_torch_available():
														import torch

														if isinstance(SCREAMING_SNAKE_CASE     ,    torch.Tensor ):
																					return True
							if is_tf_available():
														import tensorflow as tf

														if isinstance(SCREAMING_SNAKE_CASE     ,    tf.Tensor ):
																					return True

							if is_flax_available():
														import jax.numpy as jnp
														from jax.core import Tracer

														if isinstance(SCREAMING_SNAKE_CASE     ,    (jnp.ndarray, Tracer) ):
																					return True

							return isinstance(SCREAMING_SNAKE_CASE     ,    np.ndarray )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				List[str] ):


							'''simple docstring'''







							return isinstance(SCREAMING_SNAKE_CASE     ,    np.ndarray )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				int ):


							'''simple docstring'''







							return _is_numpy(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				int ):


							'''simple docstring'''







							import torch

							return isinstance(SCREAMING_SNAKE_CASE     ,    torch.Tensor )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Optional[Any] ):


							'''simple docstring'''







							return False if not is_torch_available() else _is_torch(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Dict ):


							'''simple docstring'''







							import torch

							return isinstance(SCREAMING_SNAKE_CASE     ,    torch.device )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Optional[int] ):


							'''simple docstring'''







							return False if not is_torch_available() else _is_torch_device(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Any ):


							'''simple docstring'''







							import torch

							if isinstance(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE ):
														if hasattr(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE ):
																					__lowerCamelCase   :   Dict       =getattr(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE )
														else:
																					return False
							return isinstance(SCREAMING_SNAKE_CASE     ,    torch.dtype )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Any ):


							'''simple docstring'''







							return False if not is_torch_available() else _is_torch_dtype(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Tuple ):


							'''simple docstring'''







							import tensorflow as tf

							return isinstance(SCREAMING_SNAKE_CASE     ,    tf.Tensor )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Dict ):


							'''simple docstring'''







							return False if not is_tf_available() else _is_tensorflow(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Dict ):


							'''simple docstring'''







							import tensorflow as tf

							# the `is_symbolic_tensor` predicate is only available starting with TF 2.14
							if hasattr(SCREAMING_SNAKE_CASE     ,    '''is_symbolic_tensor''' ):
														return tf.is_symbolic_tensor(SCREAMING_SNAKE_CASE )
							return type(SCREAMING_SNAKE_CASE ) == tf.Tensor



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				List[Any] ):


							'''simple docstring'''







							return False if not is_tf_available() else _is_tf_symbolic_tensor(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				List[Any] ):


							'''simple docstring'''







							import jax.numpy as jnp  # noqa: F811

							return isinstance(SCREAMING_SNAKE_CASE     ,    jnp.ndarray )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Optional[Any] ):


							'''simple docstring'''







							return False if not is_flax_available() else _is_jax(SCREAMING_SNAKE_CASE )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Dict ):


							'''simple docstring'''







							if isinstance(SCREAMING_SNAKE_CASE     ,    (dict, UserDict) ):
														return {k: to_py_obj(SCREAMING_SNAKE_CASE ) for k, v in obj.items()}
							elif isinstance(SCREAMING_SNAKE_CASE     ,    (list, tuple) ):
														return [to_py_obj(SCREAMING_SNAKE_CASE ) for o in obj]
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														return obj.numpy().tolist()
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return obj.detach().cpu().tolist()
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return np.asarray(SCREAMING_SNAKE_CASE ).tolist()
							elif isinstance(SCREAMING_SNAKE_CASE     ,    (np.ndarray, np.number) ):  # tolist also works on 0d np arrays
														return obj.tolist()
							else:
														return obj



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Dict ):


							'''simple docstring'''







							if isinstance(SCREAMING_SNAKE_CASE     ,    (dict, UserDict) ):
														return {k: to_numpy(SCREAMING_SNAKE_CASE ) for k, v in obj.items()}
							elif isinstance(SCREAMING_SNAKE_CASE     ,    (list, tuple) ):
														return np.array(SCREAMING_SNAKE_CASE )
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														return obj.numpy()
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return obj.detach().cpu().numpy()
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return np.asarray(SCREAMING_SNAKE_CASE )
							else:
														return obj
class 		SCREAMING_SNAKE_CASE_				(     snake_case__ ):
				"""simple docstring"""




				def        __lowercase	(  self	:Union[str, Any]      ):
											__lowerCamelCase   :   List[Any]       =fields(self      )

											# Safety and consistency checks
											if not len(__lowercase      ):
																		raise ValueError(f'{self.__class__.__name__} has no fields.'      )
											if not all(field.default is None for field in class_fields[1:]      ):
																		raise ValueError(f'{self.__class__.__name__} should not have more than one required field.'      )

											__lowerCamelCase   :   str       =getattr(self    ,     class_fields[0].name      )
											__lowerCamelCase   :   Tuple       =all(getattr(self    ,     field.name      ) is None for field in class_fields[1:]      )

											if other_fields_are_none and not is_tensor(__lowercase      ):
																		if isinstance(__lowercase    ,     __lowercase      ):
																									__lowerCamelCase   :   str       =first_field.items()
																									__lowerCamelCase   :   Dict       =True
																		else:
																									try:
																																__lowerCamelCase   :   Dict       =iter(__lowercase      )
																																__lowerCamelCase   :   Union[str, Any]       =True
																									except TypeError:
																																__lowerCamelCase   :   List[str]       =False

            # if we provided an iterator as first field and the iterator is a (key, value) iterator
            # set the associated fields
																		if first_field_iterator:
																									for idx, element in enumerate(__lowercase      ):
																																if (
																																    not isinstance(__lowercase    ,     (list, tuple)      )
																																    or not len(__lowercase      ) == 2
																																    or not isinstance(element[0]    ,     __lowercase      )
																																):
																																							if idx == 0:
																																														# If we do not have an iterator of key/values, set it as attribute
																																														__lowerCamelCase   :   Tuple       =first_field
																																							else:
																																														# If we have a mixed iterator, raise an error
																																														raise ValueError(
																																														    f'Cannot set key/value for {element}. It needs to be a tuple (key, value).'      )
																																							break
																																setattr(self    ,     element[0]    ,     element[1]      )
																																if element[1] is not None:
																																							__lowerCamelCase   :   Dict       =element[1]
																		elif first_field is not None:
																									__lowerCamelCase   :   int       =first_field
											else:
																		for field in class_fields:
																									__lowerCamelCase   :   Any       =getattr(self    ,     field.name      )
																									if v is not None:
																																__lowerCamelCase   :   Tuple       =v




				def __delitem__(  self	:int    ,     *__lowercase	:Tuple    ,     **__lowercase	:List[str]      ):
											raise Exception(f'You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.'      )




				def        __lowercase	(  self	:List[str]    ,     *__lowercase	:Dict    ,     **__lowercase	:str      ):
											raise Exception(f'You cannot use ``setdefault`` on a {self.__class__.__name__} instance.'      )




				def        __lowercase	(  self	:Dict    ,     *__lowercase	:Tuple    ,     **__lowercase	:Any      ):
											raise Exception(f'You cannot use ``pop`` on a {self.__class__.__name__} instance.'      )




				def        __lowercase	(  self	:Optional[Any]    ,     *__lowercase	:Optional[int]    ,     **__lowercase	:List[Any]      ):
											raise Exception(f'You cannot use ``update`` on a {self.__class__.__name__} instance.'      )




				def __getitem__(  self	:Optional[Any]    ,     __lowercase	:int      ):
											if isinstance(__lowercase    ,     __lowercase      ):
																		__lowerCamelCase   :   List[str]       =dict(self.items()      )
																		return inner_dict[k]
											else:
																		return self.to_tuple()[k]




				def __setattr__(  self	:Union[str, Any]    ,     __lowercase	:Any    ,     __lowercase	:Union[str, Any]      ):
											if name in self.keys() and value is not None:
																		# Don't call self.__setitem__ to avoid recursion errors
																		super().__setitem__(__lowercase    ,     __lowercase      )
											super().__setattr__(__lowercase    ,     __lowercase      )




				def __setitem__(  self	:int    ,     __lowercase	:Optional[int]    ,     __lowercase	:Optional[Any]      ):
											# Will raise a KeyException if needed
											super().__setitem__(__lowercase    ,     __lowercase      )
											# Don't call self.__setattr__ to avoid recursion errors
											super().__setattr__(__lowercase    ,     __lowercase      )




				def        __lowercase	(  self	:List[str]      ):
											return tuple(self[k] for k in self.keys()      )

class 		SCREAMING_SNAKE_CASE_				(     snake_case__							,	snake_case__ ):
				"""simple docstring"""




				@classmethod
				def        __lowercase	(  cls	:List[Any]    ,     __lowercase	:Dict      ):
											raise ValueError(
											    f'{value} is not a valid {cls.__name__}, please select one of {list(cls._valueamember_map_.keys()      )}'      )

class 		SCREAMING_SNAKE_CASE_				(     snake_case__ ):
				"""simple docstring"""
				__snake_case :							str									=		"""longest"""
				__snake_case :							Any									=		"""max_length"""
				__snake_case :							Tuple									=		"""do_not_pad"""

class 		SCREAMING_SNAKE_CASE_				(     snake_case__ ):
				"""simple docstring"""
				__snake_case :							str									=		"""pt"""
				__snake_case :							Optional[Any]									=		"""tf"""
				__snake_case :							Union[str, Any]									=		"""np"""
				__snake_case :							Tuple									=		"""jax"""

class 		SCREAMING_SNAKE_CASE_				:
				"""simple docstring"""




				def __init__(  self	:Union[str, Any]    ,     __lowercase	:List[ContextManager]      ):
											__lowerCamelCase   :   int       =context_managers
											__lowerCamelCase   :   Optional[int]       =ExitStack()




				def __enter__(  self	:Tuple      ):
											for context_manager in self.context_managers:
																		self.stack.enter_context(__lowercase      )




				def __exit__(  self	:Tuple    ,     *__lowercase	:Union[str, Any]    ,     **__lowercase	:Optional[int]      ):
											self.stack.__exit__(*__lowercase    ,     **__lowercase      )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Optional[Any] ):


							'''simple docstring'''







							__lowerCamelCase   :   int       =infer_framework(SCREAMING_SNAKE_CASE )
							if framework == "tf":
														__lowerCamelCase   :   Union[str, Any]       =inspect.signature(model_class.call )  # TensorFlow models
							elif framework == "pt":
														__lowerCamelCase   :   int       =inspect.signature(model_class.forward )  # PyTorch models
							else:
														__lowerCamelCase   :   int       =inspect.signature(model_class.__call__ )  # Flax models

							for p in signature.parameters:
														if p == "return_loss" and signature.parameters[p].default is True:
																					return True

							return False



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				int ):


							'''simple docstring'''







							__lowerCamelCase   :   str       =model_class.__name__
							__lowerCamelCase   :   List[str]       =infer_framework(SCREAMING_SNAKE_CASE )
							if framework == "tf":
														__lowerCamelCase   :   List[Any]       =inspect.signature(model_class.call )  # TensorFlow models
							elif framework == "pt":
														__lowerCamelCase   :   List[str]       =inspect.signature(model_class.forward )  # PyTorch models
							else:
														__lowerCamelCase   :   Tuple       =inspect.signature(model_class.__call__ )  # Flax models

							if "QuestionAnswering" in model_name:
														return [p for p in signature.parameters if "label" in p or p in ("start_positions", "end_positions")]
							else:
														return [p for p in signature.parameters if "label" in p]



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				MutableMapping     ,    SCREAMING_SNAKE_CASE							:				str = ""     ,    SCREAMING_SNAKE_CASE							:				str = "." ):


							'''simple docstring'''







							def _flatten_dict(SCREAMING_SNAKE_CASE							:				Union[str, Any]     ,    SCREAMING_SNAKE_CASE							:				str=""     ,    SCREAMING_SNAKE_CASE							:				Optional[int]="." ):
														for k, v in d.items():
																					__lowerCamelCase   :   Tuple       =str(SCREAMING_SNAKE_CASE ) + delimiter + str(SCREAMING_SNAKE_CASE ) if parent_key else k
																					if v and isinstance(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE ):
																												yield from flatten_dict(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE     ,    delimiter=SCREAMING_SNAKE_CASE ).items()
																					else:
																												yield key, v

							return dict(_flatten_dict(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE ) )



@contextmanager
def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				List[Any]     ,    SCREAMING_SNAKE_CASE							:				bool = False ):


							'''simple docstring'''







							if use_temp_dir:
														with tempfile.TemporaryDirectory() as tmp_dir:
																					yield tmp_dir
							else:
														yield working_dir



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				List[Any]     ,    SCREAMING_SNAKE_CASE							:				Optional[Any]=None ):


							'''simple docstring'''







							if is_numpy_array(SCREAMING_SNAKE_CASE ):
														return np.transpose(SCREAMING_SNAKE_CASE     ,    axes=SCREAMING_SNAKE_CASE )
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return array.T if axes is None else array.permute(*SCREAMING_SNAKE_CASE )
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														import tensorflow as tf

														return tf.transpose(SCREAMING_SNAKE_CASE     ,    perm=SCREAMING_SNAKE_CASE )
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return jnp.transpose(SCREAMING_SNAKE_CASE     ,    axes=SCREAMING_SNAKE_CASE )
							else:
														raise ValueError(F'Type not supported for transpose: {type(SCREAMING_SNAKE_CASE )}.' )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Union[str, Any]     ,    SCREAMING_SNAKE_CASE							:				Union[str, Any] ):


							'''simple docstring'''







							if is_numpy_array(SCREAMING_SNAKE_CASE ):
														return np.reshape(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE )
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return array.reshape(*SCREAMING_SNAKE_CASE )
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														import tensorflow as tf

														return tf.reshape(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE )
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return jnp.reshape(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE )
							else:
														raise ValueError(F'Type not supported for reshape: {type(SCREAMING_SNAKE_CASE )}.' )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Optional[int]     ,    SCREAMING_SNAKE_CASE							:				List[Any]=None ):


							'''simple docstring'''







							if is_numpy_array(SCREAMING_SNAKE_CASE ):
														return np.squeeze(SCREAMING_SNAKE_CASE     ,    axis=SCREAMING_SNAKE_CASE )
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return array.squeeze() if axis is None else array.squeeze(dim=SCREAMING_SNAKE_CASE )
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														import tensorflow as tf

														return tf.squeeze(SCREAMING_SNAKE_CASE     ,    axis=SCREAMING_SNAKE_CASE )
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return jnp.squeeze(SCREAMING_SNAKE_CASE     ,    axis=SCREAMING_SNAKE_CASE )
							else:
														raise ValueError(F'Type not supported for squeeze: {type(SCREAMING_SNAKE_CASE )}.' )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Tuple     ,    SCREAMING_SNAKE_CASE							:				str ):


							'''simple docstring'''







							if is_numpy_array(SCREAMING_SNAKE_CASE ):
														return np.expand_dims(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE )
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return array.unsqueeze(dim=SCREAMING_SNAKE_CASE )
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														import tensorflow as tf

														return tf.expand_dims(SCREAMING_SNAKE_CASE     ,    axis=SCREAMING_SNAKE_CASE )
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return jnp.expand_dims(SCREAMING_SNAKE_CASE     ,    axis=SCREAMING_SNAKE_CASE )
							else:
														raise ValueError(F'Type not supported for expand_dims: {type(SCREAMING_SNAKE_CASE )}.' )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Optional[Any] ):


							'''simple docstring'''







							if is_numpy_array(SCREAMING_SNAKE_CASE ):
														return np.size(SCREAMING_SNAKE_CASE )
							elif is_torch_tensor(SCREAMING_SNAKE_CASE ):
														return array.numel()
							elif is_tf_tensor(SCREAMING_SNAKE_CASE ):
														import tensorflow as tf

														return tf.size(SCREAMING_SNAKE_CASE )
							elif is_jax_tensor(SCREAMING_SNAKE_CASE ):
														return array.size
							else:
														raise ValueError(F'Type not supported for expand_dims: {type(SCREAMING_SNAKE_CASE )}.' )



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				int     ,    SCREAMING_SNAKE_CASE							:				int ):


							'''simple docstring'''







							for key, value in auto_map.items():
														if isinstance(SCREAMING_SNAKE_CASE     ,    (tuple, list) ):
																					__lowerCamelCase   :   Optional[Any]       =[F'{repo_id}--{v}' if (v is not None and '''--''' not in v) else v for v in value]
														elif value is not None and "--" not in value:
																					__lowerCamelCase   :   List[str]       =F'{repo_id}--{value}'

							return auto_map



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				Tuple ):


							'''simple docstring'''







							for base_class in inspect.getmro(SCREAMING_SNAKE_CASE ):
														__lowerCamelCase   :   Union[str, Any]       =base_class.__module__
														__lowerCamelCase   :   Union[str, Any]       =base_class.__name__
														if module.startswith('''tensorflow''' ) or module.startswith('''keras''' ) or name == "TFPreTrainedModel":
																					return "tf"
														elif module.startswith('''torch''' ) or name == "PreTrainedModel":
																					return "pt"
														elif module.startswith('''flax''' ) or module.startswith('''jax''' ) or name == "FlaxPreTrainedModel":
																					return "flax"
							else:
														raise TypeError(F'Could not infer framework from class {model_class}.' )











"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_UpperCamelCase					      =   {
    'configuration_pix2struct': [
        'PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'Pix2StructConfig',
        'Pix2StructTextConfig',
        'Pix2StructVisionConfig',
    ],
    'processing_pix2struct': ['Pix2StructProcessor'],
}

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_UpperCamelCase					      =   ['Pix2StructImageProcessor']


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_UpperCamelCase					      =   [
							    'PIX2STRUCT_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'Pix2StructPreTrainedModel',
							    'Pix2StructForConditionalGeneration',
							    'Pix2StructVisionModel',
							    'Pix2StructTextModel',
							]

if TYPE_CHECKING:
							from .configuration_pixastruct import (
							    PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    PixaStructConfig,
							    PixaStructTextConfig,
							    PixaStructVisionConfig,
							)
							from .processing_pixastruct import PixaStructProcessor

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_pixastruct import PixaStructImageProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_pixastruct import (
														    PIX2STRUCT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    PixaStructForConditionalGeneration,
														    PixaStructPreTrainedModel,
														    PixaStructTextModel,
														    PixaStructVisionModel,
														)

else:
							import sys

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




