

import copy
import fnmatch
import json
import os
import pickle as pkl
import shutil
import sys
import tarfile
import tempfile
from collections import OrderedDict
from contextlib import contextmanager
from functools import partial
from hashlib import shaaaa
from io import BytesIO
from pathlib import Path
from urllib.parse import urlparse
from zipfile import ZipFile, is_zipfile

import cva
import numpy as np
import requests
import wget
from filelock import FileLock
from PIL import Image
from tqdm.auto import tqdm
from yaml import Loader, dump, load


try:
		import torch

		lowerCamelCase      				=     True
except ImportError:
		lowerCamelCase      				=     False


try:
		from torch.hub import _get_torch_home

		lowerCamelCase      				=     _get_torch_home()
except ImportError:
		lowerCamelCase      				=     os.path.expanduser(
		    os.getenv('''TORCH_HOME''', os.path.join(os.getenv('''XDG_CACHE_HOME''', '''~/.cache'''), '''torch'''))
		)

lowerCamelCase      				=     os.path.join(torch_cache_home, '''transformers''')

lowerCamelCase      				=     '''https://cdn.huggingface.co'''
lowerCamelCase      				=     '''https://s3.amazonaws.com/models.huggingface.co/bert'''
lowerCamelCase      				=     '''/'''.join(str(Path(__file__).resolve()).split('''/''')[:-1])
lowerCamelCase      				=     os.path.join(PATH, '''config.yaml''')
lowerCamelCase      				=     os.path.join(PATH, '''attributes.txt''')
lowerCamelCase      				=     os.path.join(PATH, '''objects.txt''')
lowerCamelCase      				=     os.getenv('''PYTORCH_PRETRAINED_BERT_CACHE''', default_cache_path)
lowerCamelCase      				=     os.getenv('''PYTORCH_TRANSFORMERS_CACHE''', PYTORCH_PRETRAINED_BERT_CACHE)
lowerCamelCase      				=     os.getenv('''TRANSFORMERS_CACHE''', PYTORCH_TRANSFORMERS_CACHE)
lowerCamelCase      				=     '''pytorch_model.bin'''
lowerCamelCase      				=     '''config.yaml'''


def        __lowercase    (  UpperCAmelCase__=OBJECTS		,					UpperCAmelCase__=ATTRIBUTES      ):

					"""simple docstring"""






					__lowerCAmelCase					=							[]
					with open(_lowerCamelCase      ) as f:
										for object in f.readlines():
															vg_classes.append(object.split(','      )[0].lower().strip()      )

					__lowerCAmelCase					=							[]
					with open(_lowerCamelCase      ) as f:
										for object in f.readlines():
															vg_attrs.append(object.split(','      )[0].lower().strip()      )
					return vg_classes, vg_attrs


def        __lowercase    (  UpperCAmelCase__      ):

					"""simple docstring"""






					__lowerCAmelCase					=							OrderedDict()
					with open(_lowerCamelCase		,					'rb'      ) as f:
										__lowerCAmelCase					=							pkl.load(_lowerCamelCase      )["""model"""]
					for k in copy.deepcopy(list(ckp.keys()      )      ):
										__lowerCAmelCase					=							ckp.pop(_lowerCamelCase      )
										if isinstance(_lowerCamelCase		,					np.ndarray      ):
															__lowerCAmelCase					=							torch.tensor(_lowerCamelCase      )
										else:
															assert isinstance(_lowerCamelCase		,					torch.tensor      ), type(_lowerCamelCase      )
										__lowerCAmelCase					=							v
					return r





class     snake_case_			:


							"""simple docstring"""





							__UpperCAmelCase       ={}




							def __init__( self					,						_A					,						_A = "root"					,						_A=0							):
												__lowerCAmelCase					=							name
												__lowerCAmelCase					=							level
												__lowerCAmelCase					=							{}
												for k, v in dictionary.items():
																	if v is None:
																						raise ValueError()
																	__lowerCAmelCase					=							copy.deepcopy(_lowercase							)
																	__lowerCAmelCase					=							copy.deepcopy(_lowercase							)
																	if isinstance(_lowercase					,						_lowercase							):
																						__lowerCAmelCase					=							Config(_lowercase					,						name=_lowercase					,						level=level + 1							)
																	__lowerCAmelCase					=							v
																	setattr(self					,						_lowercase					,						_lowercase							)

												__lowerCAmelCase					=							d




							def __repr__( self							):
												return str(list((self._pointer.keys())							)							)




							def __setattr__( self					,						_A					,						_A							):
												__lowerCAmelCase					=							val
												__lowerCAmelCase					=							val
												__lowerCAmelCase					=							key.split('.'							)
												__lowerCAmelCase					=							len(_lowercase							) - 1
												__lowerCAmelCase					=							self._pointer
												if len(_lowercase							) > 1:
																	for i, l in enumerate(_lowercase							):
																						if hasattr(self					,						_lowercase							) and isinstance(getattr(self					,						_lowercase							)					,						_lowercase							):
																											setattr(getattr(self					,						_lowercase							)					,						'.'.join(levels[i:]							)					,						_lowercase							)
																						if l == last_level:
																											__lowerCAmelCase					=							val
																						else:
																											__lowerCAmelCase					=							pointer[l]




							def        A__  ( self							):
												return self._pointer




							def        A__  ( self					,						_A					,						_A							):

												with open(F"""{file_name}"""					,						'w'							) as stream:
																	dump(_lowercase					,						_lowercase							)




							def        A__  ( self					,						_A					,						_A							):

												with open(F"""{file_name}"""					,						'w'							) as stream:
																	json.dump(_lowercase					,						_lowercase							)




							@staticmethod
							def        A__  ( _A							):

												with open(_lowercase							) as stream:
																	__lowerCAmelCase					=							load(_lowercase					,						Loader=_lowercase							)
												return data




							def __str__( self							):
												__lowerCAmelCase					=							"""    """
												if self._name != "root":
																	__lowerCAmelCase					=							F"""{t * (self._level-1)}{self._name}:\n"""
												else:
																	__lowerCAmelCase					=							""""""
												__lowerCAmelCase					=							self._level
												for i, (k, v) in enumerate(self._pointer.items()							):
																	if isinstance(_lowercase					,						_lowercase							):
																						r += F"""{t * (self._level)}{v}\n"""
																						self._level += 1
																	else:
																						r += F"""{t * (self._level)}{k}: {v} ({type(_lowercase							).__name__})\n"""
																	__lowerCAmelCase					=							level
												return r[:-1]




							@classmethod
							def        A__  ( cls					,						_A					,						**_A							):
												__lowerCAmelCase					=							cls.get_config_dict(_lowercase					,						**_lowercase							)
												return cls(_lowercase							)




							@classmethod
							def        A__  ( cls					,						_A					,						**_A							):
												__lowerCAmelCase					=							kwargs.pop('cache_dir'					,						_lowercase							)
												__lowerCAmelCase					=							kwargs.pop('force_download'					,						_lowercase							)
												__lowerCAmelCase					=							kwargs.pop('resume_download'					,						_lowercase							)
												__lowerCAmelCase					=							kwargs.pop('proxies'					,						_lowercase							)
												__lowerCAmelCase					=							kwargs.pop('local_files_only'					,						_lowercase							)

												if os.path.isdir(_lowercase							):
																	__lowerCAmelCase					=							os.path.join(_lowercase					,						_lowercase							)
												elif os.path.isfile(_lowercase							) or is_remote_url(_lowercase							):
																	__lowerCAmelCase					=							pretrained_model_name_or_path
												else:
																	__lowerCAmelCase					=							hf_bucket_url(_lowercase					,						filename=_lowercase					,						use_cdn=_lowercase							)

												try:
																	# Load from URL or cache if already cached
																	__lowerCAmelCase					=							cached_path(
																	    _lowercase					,						cache_dir=_lowercase					,						force_download=_lowercase					,						proxies=_lowercase					,						resume_download=_lowercase					,						local_files_only=_lowercase					,						)
																	# Load config dict
																	if resolved_config_file is None:
																						raise EnvironmentError

																	__lowerCAmelCase					=							Config.load_yaml(_lowercase							)

												except EnvironmentError:
																	__lowerCAmelCase					=							"""Can't load config for"""
																	raise EnvironmentError(_lowercase							)

												if resolved_config_file == config_file:
																	print('loading configuration file from path'							)
												else:
																	print('loading configuration file cache'							)

												return Config.load_yaml(_lowercase							), kwargs



def        __lowercase    (  UpperCAmelCase__      ):

					"""simple docstring"""






					__lowerCAmelCase					=							torch.load('dump.pt'		,					map_location=in_tensor.device      )
					__lowerCAmelCase					=							in_tensor.numpy()
					__lowerCAmelCase					=							out_tensor.numpy()[0]
					print(na.shape		,					na[0, 0, :5]      )
					print(na.shape		,					na[0, 0, :5]      )
					assert np.allclose(_lowerCamelCase		,					_lowerCamelCase		,					rtol=0.01		,					atol=0.1      ), (
					    F"""{sum([1 for x in np.isclose(_lowerCamelCase		,					_lowerCamelCase		,					rtol=0.01		,					atol=0.1      ).flatten() if x is False]      )/len(na.flatten()      )*100:.4f} %"""
					    " element-wise mismatch"
					)
					raise Exception('tensors are all good'      )

					# Hugging face functions below


def        __lowercase    (  UpperCAmelCase__      ):

					"""simple docstring"""






					__lowerCAmelCase					=							urlparse(_lowerCamelCase      )
					return parsed.scheme in ("http", "https")


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__		,					UpperCAmelCase__=True      ):

					"""simple docstring"""






					__lowerCAmelCase					=							CLOUDFRONT_DISTRIB_PREFIX if use_cdn else S3_BUCKET_PREFIX
					__lowerCAmelCase					=							"""/""" not in model_id
					if legacy_format:
										return F"""{endpoint}/{model_id}-{filename}"""
					else:
										return F"""{endpoint}/{model_id}/{filename}"""


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__		,					UpperCAmelCase__=None		,					UpperCAmelCase__=0		,					UpperCAmelCase__=None		,					):

					"""simple docstring"""






					__lowerCAmelCase					=							"""python/{}""".format(sys.version.split()[0]      )
					if _torch_available:
										ua += "; torch/{}".format(torch.__version__      )
					if isinstance(_lowerCamelCase		,					_lowerCamelCase      ):
										ua += "; " + "; ".join('{}/{}'.format(_lowerCamelCase		,					_lowerCamelCase      ) for k, v in user_agent.items()      )
					elif isinstance(_lowerCamelCase		,					_lowerCamelCase      ):
										ua += "; " + user_agent
					__lowerCAmelCase					=							{"""user-agent""": ua}
					if resume_size > 0:
										__lowerCAmelCase					=							"""bytes=%d-""" % (resume_size,)
					__lowerCAmelCase					=							requests.get(_lowerCamelCase		,					stream=_lowerCamelCase		,					proxies=_lowerCamelCase		,					headers=_lowerCamelCase      )
					if response.status_code == 416:  # Range not satisfiable
										return
					__lowerCAmelCase					=							response.headers.get('Content-Length'      )
					__lowerCAmelCase					=							resume_size + int(_lowerCamelCase      ) if content_length is not None else None
					__lowerCAmelCase					=							tqdm(
					    unit='B'		,					unit_scale=_lowerCamelCase		,					total=_lowerCamelCase		,					initial=_lowerCamelCase		,					desc='Downloading'		,					)
					for chunk in response.iter_content(chunk_size=1_024      ):
										if chunk:  # filter out keep-alive new chunks
															progress.update(len(_lowerCamelCase      )      )
															temp_file.write(_lowerCamelCase      )
					progress.close()


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__=None		,					UpperCAmelCase__=False		,					UpperCAmelCase__=None		,					UpperCAmelCase__=10		,					UpperCAmelCase__=False		,					UpperCAmelCase__=None		,					UpperCAmelCase__=False		,					):

					"""simple docstring"""






					if cache_dir is None:
										__lowerCAmelCase					=							TRANSFORMERS_CACHE
					if isinstance(_lowerCamelCase		,					_lowerCamelCase      ):
										__lowerCAmelCase					=							str(_lowerCamelCase      )

					os.makedirs(_lowerCamelCase		,					exist_ok=_lowerCamelCase      )

					__lowerCAmelCase					=							None
					if not local_files_only:
										try:
															__lowerCAmelCase					=							requests.head(_lowerCamelCase		,					allow_redirects=_lowerCamelCase		,					proxies=_lowerCamelCase		,					timeout=_lowerCamelCase      )
															if response.status_code == 200:
																				__lowerCAmelCase					=							response.headers.get('ETag'      )
										except (EnvironmentError, requests.exceptions.Timeout):
															# etag is already None
															pass

					__lowerCAmelCase					=							url_to_filename(_lowerCamelCase		,					_lowerCamelCase      )

					# get cache path to put the file
					__lowerCAmelCase					=							os.path.join(_lowerCamelCase		,					_lowerCamelCase      )

					# etag is None = we don't have a connection, or url doesn't exist, or is otherwise inaccessible.
					# try to get the last downloaded one
					if etag is None:
										if os.path.exists(_lowerCamelCase      ):
															return cache_path
										else:
															__lowerCAmelCase					=							[
															    file
															    for file in fnmatch.filter(os.listdir(_lowerCamelCase      )		,					filename + '.*'      )
															    if not file.endswith('.json'      ) and not file.endswith('.lock'      )
															]
															if len(_lowerCamelCase      ) > 0:
																				return os.path.join(_lowerCamelCase		,					matching_files[-1]      )
															else:
																				# If files cannot be found and local_files_only=True,
																				# the models might've been found if local_files_only=False
																				# Notify the user about that
																				if local_files_only:
																									raise ValueError(
																									    'Cannot find the requested files in the cached path and outgoing traffic has been'
																									    ' disabled. To enable model look-ups and downloads online, set \'local_files_only\''
																									    ' to False.'      )
																				return None

    # From now on, etag is not None.
					if os.path.exists(_lowerCamelCase      ) and not force_download:
										return cache_path

					# Prevent parallel downloads of the same file with a lock.
					__lowerCAmelCase					=							cache_path + """.lock"""
					with FileLock(_lowerCamelCase      ):
										# If the download just completed while the lock was activated.
										if os.path.exists(_lowerCamelCase      ) and not force_download:
															# Even if returning early like here, the lock will be released.
															return cache_path

										if resume_download:
															__lowerCAmelCase					=							cache_path + """.incomplete"""

															@contextmanager
															def _resumable_file_manager():
																				with open(_lowerCamelCase		,					'a+b'      ) as f:
																									yield f

															__lowerCAmelCase					=							_resumable_file_manager
															if os.path.exists(_lowerCamelCase      ):
																				__lowerCAmelCase					=							os.stat(_lowerCamelCase      ).st_size
															else:
																				__lowerCAmelCase					=							0
										else:
															__lowerCAmelCase					=							partial(tempfile.NamedTemporaryFile		,					dir=_lowerCamelCase		,					delete=_lowerCamelCase      )
															__lowerCAmelCase					=							0

										# Download to temporary file, then copy to cache dir once finished.
										# Otherwise you get corrupt cache entries if the download gets interrupted.
										with temp_file_manager() as temp_file:
															print(
															    '%s not found in cache or force_download set to True, downloading to %s'		,					_lowerCamelCase		,					temp_file.name		,					)

															http_get(
															    _lowerCamelCase		,					_lowerCamelCase		,					proxies=_lowerCamelCase		,					resume_size=_lowerCamelCase		,					user_agent=_lowerCamelCase		,					)

										os.replace(temp_file.name		,					_lowerCamelCase      )

										__lowerCAmelCase					=							{"""url""": url, """etag""": etag}
										__lowerCAmelCase					=							cache_path + """.json"""
										with open(_lowerCamelCase		,					'w'      ) as meta_file:
															json.dump(_lowerCamelCase		,					_lowerCamelCase      )

					return cache_path


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__=None      ):

					"""simple docstring"""






					__lowerCAmelCase					=							url.encode('utf-8'      )
					__lowerCAmelCase					=							shaaaa(_lowerCamelCase      )
					__lowerCAmelCase					=							url_hash.hexdigest()

					if etag:
										__lowerCAmelCase					=							etag.encode('utf-8'      )
										__lowerCAmelCase					=							shaaaa(_lowerCamelCase      )
										filename += "." + etag_hash.hexdigest()

					if url.endswith('.h5'      ):
										filename += ".h5"

					return filename


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__=None		,					UpperCAmelCase__=False		,					UpperCAmelCase__=None		,					UpperCAmelCase__=False		,					UpperCAmelCase__=None		,					UpperCAmelCase__=False		,					UpperCAmelCase__=False		,					UpperCAmelCase__=False		,					):

					"""simple docstring"""






					if cache_dir is None:
										__lowerCAmelCase					=							TRANSFORMERS_CACHE
					if isinstance(_lowerCamelCase		,					_lowerCamelCase      ):
										__lowerCAmelCase					=							str(_lowerCamelCase      )
					if isinstance(_lowerCamelCase		,					_lowerCamelCase      ):
										__lowerCAmelCase					=							str(_lowerCamelCase      )

					if is_remote_url(_lowerCamelCase      ):
										# URL, so get it from the cache (downloading if necessary)
										__lowerCAmelCase					=							get_from_cache(
										    _lowerCamelCase		,					cache_dir=_lowerCamelCase		,					force_download=_lowerCamelCase		,					proxies=_lowerCamelCase		,					resume_download=_lowerCamelCase		,					user_agent=_lowerCamelCase		,					local_files_only=_lowerCamelCase		,					)
					elif os.path.exists(_lowerCamelCase      ):
										# File, and it exists.
										__lowerCAmelCase					=							url_or_filename
					elif urlparse(_lowerCamelCase      ).scheme == "":
										# File, but it doesn't exist.
										raise EnvironmentError('file {} not found'.format(_lowerCamelCase      )      )
					else:
										# Something unknown
										raise ValueError('unable to parse {} as a URL or as a local path'.format(_lowerCamelCase      )      )

					if extract_compressed_file:
										if not is_zipfile(_lowerCamelCase      ) and not tarfile.is_tarfile(_lowerCamelCase      ):
															return output_path

										# Path where we extract compressed archives
										# We avoid '.' in dir name and add "-extracted" at the end: "./model.zip" => "./model-zip-extracted/"
										__lowerCAmelCase					=							os.path.split(_lowerCamelCase      )
										__lowerCAmelCase					=							output_file.replace('.'		,					'-'      ) + """-extracted"""
										__lowerCAmelCase					=							os.path.join(_lowerCamelCase		,					_lowerCamelCase      )

										if os.path.isdir(_lowerCamelCase      ) and os.listdir(_lowerCamelCase      ) and not force_extract:
															return output_path_extracted

										# Prevent parallel extractions
										__lowerCAmelCase					=							output_path + """.lock"""
										with FileLock(_lowerCamelCase      ):
															shutil.rmtree(_lowerCamelCase		,					ignore_errors=_lowerCamelCase      )
															os.makedirs(_lowerCamelCase      )
															if is_zipfile(_lowerCamelCase      ):
																				with ZipFile(_lowerCamelCase		,					'r'      ) as zip_file:
																									zip_file.extractall(_lowerCamelCase      )
																									zip_file.close()
															elif tarfile.is_tarfile(_lowerCamelCase      ):
																				__lowerCAmelCase					=							tarfile.open(_lowerCamelCase      )
																				tar_file.extractall(_lowerCamelCase      )
																				tar_file.close()
															else:
																				raise EnvironmentError('Archive format of {} could not be identified'.format(_lowerCamelCase      )      )

										return output_path_extracted

					return output_path


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__=","      ):

					"""simple docstring"""






					assert isinstance(_lowerCamelCase		,					_lowerCamelCase      )
					if os.path.isfile(_lowerCamelCase      ):
										with open(_lowerCamelCase      ) as f:
															__lowerCAmelCase					=							eval(f.read()      )
					else:
										__lowerCAmelCase					=							requests.get(_lowerCamelCase      )
										try:
															__lowerCAmelCase					=							requests.json()
										except Exception:
															__lowerCAmelCase					=							req.content.decode()
															assert data is not None, "could not connect"
															try:
																				__lowerCAmelCase					=							eval(_lowerCamelCase      )
															except Exception:
																				__lowerCAmelCase					=							data.split('\n'      )
										req.close()
					return data


def        __lowercase    (  UpperCAmelCase__      ):

					"""simple docstring"""






					__lowerCAmelCase					=							requests.get(_lowerCamelCase      )
					__lowerCAmelCase					=							np.array(Image.open(BytesIO(response.content      )      )      )
					return img


def        __lowercase    (  UpperCAmelCase__      ):

					"""simple docstring"""






					__lowerCAmelCase					=							url.split('/'      )[-1]
					if fn not in os.listdir(os.getcwd()      ):
										wget.download(_lowerCamelCase      )
					with open(_lowerCamelCase		,					'rb'      ) as stream:
										__lowerCAmelCase					=							pkl.load(_lowerCamelCase      )
					__lowerCAmelCase					=							weights.pop('model'      )
					__lowerCAmelCase					=							{}
					for k, v in model.items():
										__lowerCAmelCase					=							torch.from_numpy(_lowerCamelCase      )
										if "running_var" in k:
															__lowerCAmelCase					=							torch.tensor([0]      )
															__lowerCAmelCase					=							k.replace('running_var'		,					'num_batches_tracked'      )
															__lowerCAmelCase					=							zero
					return new


def        __lowercase    (  ):

					"""simple docstring"""






					print(F"""{os.path.abspath(os.path.join(_lowerCamelCase		,					os.pardir      )      )}/demo.ipynb"""      )


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__="RGB"      ):

					"""simple docstring"""






					assert isinstance(_lowerCamelCase		,					_lowerCamelCase      )
					if os.path.isfile(_lowerCamelCase      ):
										__lowerCAmelCase					=							cva.imread(_lowerCamelCase      )
					else:
										__lowerCAmelCase					=							get_image_from_url(_lowerCamelCase      )
										assert img is not None, F"""could not connect to: {im}"""
					__lowerCAmelCase					=							cva.cvtColor(_lowerCamelCase		,					cva.COLOR_BGR2RGB      )
					if input_format == "RGB":
										__lowerCAmelCase					=							img[:, :, ::-1]
					return img


def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__=1      ):

					"""simple docstring"""






					return (images[i : i + batch] for i in range(0		,					len(_lowerCamelCase      )		,					_lowerCamelCase      ))









from typing import TYPE_CHECKING

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


lowerCamelCase      				=     {
    '''configuration_data2vec_audio''': ['''DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Data2VecAudioConfig'''],
    '''configuration_data2vec_text''': [
        '''DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''Data2VecTextConfig''',
        '''Data2VecTextOnnxConfig''',
    ],
    '''configuration_data2vec_vision''': [
        '''DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''Data2VecVisionConfig''',
        '''Data2VecVisionOnnxConfig''',
    ],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowerCamelCase      				=     [
		    '''DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''Data2VecAudioForAudioFrameClassification''',
		    '''Data2VecAudioForCTC''',
		    '''Data2VecAudioForSequenceClassification''',
		    '''Data2VecAudioForXVector''',
		    '''Data2VecAudioModel''',
		    '''Data2VecAudioPreTrainedModel''',
		]
		lowerCamelCase      				=     [
		    '''DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''Data2VecTextForCausalLM''',
		    '''Data2VecTextForMaskedLM''',
		    '''Data2VecTextForMultipleChoice''',
		    '''Data2VecTextForQuestionAnswering''',
		    '''Data2VecTextForSequenceClassification''',
		    '''Data2VecTextForTokenClassification''',
		    '''Data2VecTextModel''',
		    '''Data2VecTextPreTrainedModel''',
		]
		lowerCamelCase      				=     [
		    '''DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''Data2VecVisionForImageClassification''',
		    '''Data2VecVisionForMaskedImageModeling''',
		    '''Data2VecVisionForSemanticSegmentation''',
		    '''Data2VecVisionModel''',
		    '''Data2VecVisionPreTrainedModel''',
		]

if is_tf_available():
		lowerCamelCase      				=     [
		    '''TFData2VecVisionForImageClassification''',
		    '''TFData2VecVisionForSemanticSegmentation''',
		    '''TFData2VecVisionModel''',
		    '''TFData2VecVisionPreTrainedModel''',
		]

if TYPE_CHECKING:
		from .configuration_dataavec_audio import DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP, DataaVecAudioConfig
		from .configuration_dataavec_text import (
		    DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    DataaVecTextConfig,
		    DataaVecTextOnnxConfig,
		)
		from .configuration_dataavec_vision import (
		    DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    DataaVecVisionConfig,
		    DataaVecVisionOnnxConfig,
		)

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_dataavec_audio import (
				    DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST,
				    DataaVecAudioForAudioFrameClassification,
				    DataaVecAudioForCTC,
				    DataaVecAudioForSequenceClassification,
				    DataaVecAudioForXVector,
				    DataaVecAudioModel,
				    DataaVecAudioPreTrainedModel,
				)
				from .modeling_dataavec_text import (
				    DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    DataaVecTextForCausalLM,
				    DataaVecTextForMaskedLM,
				    DataaVecTextForMultipleChoice,
				    DataaVecTextForQuestionAnswering,
				    DataaVecTextForSequenceClassification,
				    DataaVecTextForTokenClassification,
				    DataaVecTextModel,
				    DataaVecTextPreTrainedModel,
				)
				from .modeling_dataavec_vision import (
				    DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST,
				    DataaVecVisionForImageClassification,
				    DataaVecVisionForMaskedImageModeling,
				    DataaVecVisionForSemanticSegmentation,
				    DataaVecVisionModel,
				    DataaVecVisionPreTrainedModel,
				)
		if is_tf_available():
				from .modeling_tf_dataavec_vision import (
				    TFDataaVecVisionForImageClassification,
				    TFDataaVecVisionForSemanticSegmentation,
				    TFDataaVecVisionModel,
				    TFDataaVecVisionPreTrainedModel,
				)

else:
		import sys

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






