


'''simple docstring'''






import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowercase				=logging.get_logger(__name__)

lowercase				={
    'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json',
}






class    __magic_name__				(						lowerCAmelCase							):
       UpperCAmelCase		 ="git_vision_model"






       def __init__(     self    ,				snake_case=7_6_8    ,				snake_case=3_0_7_2    ,				snake_case=1_2    ,				snake_case=1_2    ,				snake_case=3    ,				snake_case=2_2_4    ,				snake_case=1_6    ,				snake_case="quick_gelu"    ,				snake_case=1E-5    ,				snake_case=0.0    ,				snake_case=0.02    ,				**snake_case    ,				)		->    str:




          '''simple docstring'''
          super().__init__(**snake_case)

          _UpperCAmelCase  :  Any				       =hidden_size
          _UpperCAmelCase  :  Optional[int]				       =intermediate_size
          _UpperCAmelCase  :  Dict				       =num_hidden_layers
          _UpperCAmelCase  :  Optional[Any]				       =num_attention_heads
          _UpperCAmelCase  :  Dict				       =num_channels
          _UpperCAmelCase  :  Optional[Any]				       =patch_size
          _UpperCAmelCase  :  Tuple				       =image_size
          _UpperCAmelCase  :  int				       =initializer_range
          _UpperCAmelCase  :  Any				       =attention_dropout
          _UpperCAmelCase  :  str				       =layer_norm_eps
          _UpperCAmelCase  :  Union[str, Any]				       =hidden_act






       @classmethod
       def      lowerCAmelCase						(     cls    ,				snake_case    ,				**snake_case)		->    "PretrainedConfig":




          '''simple docstring'''
          cls._set_token_in_kwargs(snake_case)

          _UpperCAmelCase       ,			_UpperCAmelCase  :  Tuple				       =cls.get_config_dict(snake_case    ,				**snake_case)

          # get the vision config dict if we are loading from GITConfig
          if config_dict.get('model_type') == "git":
             _UpperCAmelCase  :  List[str]				       =config_dict['vision_config']

          if "model_type" in config_dict and hasattr(cls    ,				'model_type') and config_dict["model_type"] != cls.model_type:
             logger.warning(
                 f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
                 f"{cls.model_type}. This is not supported for all configurations of models and can yield errors.")

          return cls.from_dict(snake_case    ,				**snake_case)






class    __magic_name__				(						lowerCAmelCase							):
       UpperCAmelCase		 ="git"






       def __init__(     self    ,				snake_case=None    ,				snake_case=3_0_5_2_2    ,				snake_case=7_6_8    ,				snake_case=6    ,				snake_case=1_2    ,				snake_case=3_0_7_2    ,				snake_case="gelu"    ,				snake_case=0.1    ,				snake_case=0.1    ,				snake_case=1_0_2_4    ,				snake_case=0.02    ,				snake_case=1E-1_2    ,				snake_case=0    ,				snake_case="absolute"    ,				snake_case=True    ,				snake_case=False    ,				snake_case=1_0_1    ,				snake_case=1_0_2    ,				snake_case=None    ,				**snake_case    ,				)		->    Tuple:




          '''simple docstring'''
          super().__init__(bos_token_id=snake_case    ,				eos_token_id=snake_case    ,				pad_token_id=snake_case    ,				**snake_case)

          if vision_config is None:
             _UpperCAmelCase  :  Union[str, Any]				       ={}
             logger.info('vision_config is None. initializing the GitVisionConfig with default values.')

          _UpperCAmelCase  :  Tuple				       =GitVisionConfig(**snake_case)
          _UpperCAmelCase  :  Optional[int]				       =vocab_size
          _UpperCAmelCase  :  str				       =hidden_size
          _UpperCAmelCase  :  List[Any]				       =num_hidden_layers
          _UpperCAmelCase  :  Optional[Any]				       =num_attention_heads
          _UpperCAmelCase  :  int				       =hidden_act
          _UpperCAmelCase  :  List[Any]				       =intermediate_size
          _UpperCAmelCase  :  str				       =hidden_dropout_prob
          _UpperCAmelCase  :  Union[str, Any]				       =attention_probs_dropout_prob
          _UpperCAmelCase  :  Dict				       =max_position_embeddings
          _UpperCAmelCase  :  str				       =initializer_range
          _UpperCAmelCase  :  Optional[Any]				       =layer_norm_eps
          _UpperCAmelCase  :  str				       =position_embedding_type
          _UpperCAmelCase  :  Optional[Any]				       =use_cache
          _UpperCAmelCase  :  Any				       =tie_word_embeddings
          _UpperCAmelCase  :  Union[str, Any]				       =num_image_with_embedding

          _UpperCAmelCase  :  int				       =bos_token_id
          _UpperCAmelCase  :  List[str]				       =eos_token_id






       def      lowerCAmelCase						(     self)		->    List[str]:




          '''simple docstring'''
          _UpperCAmelCase  :  str				       =copy.deepcopy(self.__dict__)
          _UpperCAmelCase  :  Any				       =self.vision_config.to_dict()
          _UpperCAmelCase  :  str				       =self.__class__.model_type
          return output





'''simple docstring'''






import inspect
import re
from hashlib import shaaaa
from typing import Dict, List

from .arrow import arrow
from .audiofolder import audiofolder
from .csv import csv
from .imagefolder import imagefolder
from .json import json
from .pandas import pandas
from .parquet import parquet
from .sql import sql  # noqa F401
from .text import text





def lowerCamelCase__     (		__lowerCamelCase			:				List[str]				):







   '''simple docstring'''




   _UpperCAmelCase  :  int				       =[]
   for line in lines:
      _UpperCAmelCase  :  Dict				       =re.sub(R'#.*'			,       ''			,       __lowerCamelCase				)  # remove comments
      if line:
         filtered_lines.append(__lowerCamelCase				)
   _UpperCAmelCase  :  str				       ='\n'.join(__lowerCamelCase				)

   # Make a hash from all this code
   _UpperCAmelCase  :  str				       =full_str.encode('utf-8'				)
   return shaaaa(__lowerCamelCase				).hexdigest()


# get importable module names and hash for caching
lowercase				={
    'csv': (csv.__name__, _hash_python_lines(inspect.getsource(csv).splitlines())),
    'json': (json.__name__, _hash_python_lines(inspect.getsource(json).splitlines())),
    'pandas': (pandas.__name__, _hash_python_lines(inspect.getsource(pandas).splitlines())),
    'parquet': (parquet.__name__, _hash_python_lines(inspect.getsource(parquet).splitlines())),
    'arrow': (arrow.__name__, _hash_python_lines(inspect.getsource(arrow).splitlines())),
    'text': (text.__name__, _hash_python_lines(inspect.getsource(text).splitlines())),
    'imagefolder': (imagefolder.__name__, _hash_python_lines(inspect.getsource(imagefolder).splitlines())),
    'audiofolder': (audiofolder.__name__, _hash_python_lines(inspect.getsource(audiofolder).splitlines())),
}

# Used to infer the module to use based on the data files extensions
lowercase				={
    '.csv': ('csv', {}),
    '.tsv': ('csv', {'sep': '\t'}),
    '.json': ('json', {}),
    '.jsonl': ('json', {}),
    '.parquet': ('parquet', {}),
    '.arrow': ('arrow', {}),
    '.txt': ('text', {}),
}
_EXTENSION_TO_MODULE.update({ext: ('imagefolder', {}) for ext in imagefolder.ImageFolder.EXTENSIONS})
_EXTENSION_TO_MODULE.update({ext.upper(): ('imagefolder', {}) for ext in imagefolder.ImageFolder.EXTENSIONS})
_EXTENSION_TO_MODULE.update({ext: ('audiofolder', {}) for ext in audiofolder.AudioFolder.EXTENSIONS})
_EXTENSION_TO_MODULE.update({ext.upper(): ('audiofolder', {}) for ext in audiofolder.AudioFolder.EXTENSIONS})
lowercase				={'imagefolder', 'audiofolder'}

# Used to filter data files based on extensions given a module name
lowercase				={}
for _ext, (_module, _) in _EXTENSION_TO_MODULE.items():
 _MODULE_TO_EXTENSIONS.setdefault(_module, []).append(_ext)

_MODULE_TO_EXTENSIONS["imagefolder"].append('.zip')




_MODULE_TO_EXTENSIONS["audiofolder"].append('.zip')

