





import inspect
import unittest

import torch
import torch.nn as nn

from accelerate.hooks import (
    AlignDevicesHook,
    ModelHook,
    SequentialHook,
    add_hook_to_module,
    attach_align_device_hook,
    remove_hook_from_module,
    remove_hook_from_submodules,
)
from accelerate.test_utils import require_multi_gpu






class    __A       (       nn.Module					):

			'''simple docstring'''







			def __init__(       self				):



				'''simple docstring'''







				super().__init__()
				lowerCamelCase__														=						nn.Linear(3			,    4				)
				lowerCamelCase__														=						nn.BatchNormad(4				)
				lowerCamelCase__														=						nn.Linear(4			,    5				)





			def 						__lowerCamelCase							(       self			,    __lowerCAmelCase				):



				'''simple docstring'''







				return self.lineara(self.batchnorm(self.lineara(lowerCAmelCase__				)				)				)






class    __A       (       __SCREAMING_SNAKE_CASE					):

			'''simple docstring'''







			def 						__lowerCamelCase							(       self			,    __lowerCAmelCase			,    *__lowerCAmelCase			,    **__lowerCAmelCase				):



				'''simple docstring'''







				return (args[0] + 1,) + args[1:], kwargs






class    __A       (       __SCREAMING_SNAKE_CASE					):

			'''simple docstring'''







			def 						__lowerCamelCase							(       self			,    __lowerCAmelCase			,    __lowerCAmelCase				):



				'''simple docstring'''







				return output + 1






class    __A       (       unittest.TestCase					):

			'''simple docstring'''







			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()
				lowerCamelCase__														=						ModelHook()

				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				self.assertEqual(test_model._hf_hook			,    lowerCAmelCase__				)
				self.assertTrue(hasattr(lowerCAmelCase__			,    '''_old_forward'''				)				)

				# Check adding the hook did not change the name or the signature
				self.assertEqual(test_model.forward.__name__			,    '''forward'''				)
				self.assertListEqual(list(inspect.signature(test_model.forward				).parameters				)			,    ['''x''']				)

				remove_hook_from_module(lowerCAmelCase__				)
				self.assertFalse(hasattr(lowerCAmelCase__			,    '''_hf_hook'''				)				)
				self.assertFalse(hasattr(lowerCAmelCase__			,    '''_old_forward'''				)				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()
				lowerCamelCase__														=						ModelHook()

				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__			,    append=lowerCAmelCase__				)

				self.assertEqual(isinstance(test_model._hf_hook			,    lowerCAmelCase__				)			,    lowerCAmelCase__				)
				self.assertEqual(len(test_model._hf_hook.hooks				)			,    2				)
				self.assertTrue(hasattr(lowerCAmelCase__			,    '''_old_forward'''				)				)

				# Check adding the hook did not change the name or the signature
				self.assertEqual(test_model.forward.__name__			,    '''forward'''				)
				self.assertListEqual(list(inspect.signature(test_model.forward				).parameters				)			,    ['''x''']				)

				remove_hook_from_module(lowerCAmelCase__				)
				self.assertFalse(hasattr(lowerCAmelCase__			,    '''_hf_hook'''				)				)
				self.assertFalse(hasattr(lowerCAmelCase__			,    '''_old_forward'''				)				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()
				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						test_model(x + 1				)
				lowerCamelCase__														=						test_model(x + 2				)

				lowerCamelCase__														=						PreForwardHook()
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				self.assertTrue(torch.allclose(lowerCAmelCase__			,    lowerCAmelCase__			,    atol=1E-5				)				)

				# Attaching a hook to a model when it already has one replaces, does not chain
				lowerCamelCase__														=						PreForwardHook()
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				self.assertTrue(torch.allclose(lowerCAmelCase__			,    lowerCAmelCase__			,    atol=1E-5				)				)

				# You need to use the sequential hook to chain two or more hooks
				lowerCamelCase__														=						SequentialHook(PreForwardHook()			,    PreForwardHook()				)
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)

				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				assert torch.allclose(lowerCAmelCase__			,    lowerCAmelCase__			,    atol=1E-5				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()
				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)

				lowerCamelCase__														=						PostForwardHook()
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				self.assertTrue(torch.allclose(lowerCAmelCase__			,    output + 1			,    atol=1E-5				)				)

				# Attaching a hook to a model when it already has one replaces, does not chain
				lowerCamelCase__														=						PostForwardHook()
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				self.assertTrue(torch.allclose(lowerCAmelCase__			,    output + 1			,    atol=1E-5				)				)

				# You need to use the sequential hook to chain two or more hooks
				lowerCamelCase__														=						SequentialHook(PostForwardHook()			,    PostForwardHook()				)
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)

				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				assert torch.allclose(lowerCAmelCase__			,    output + 2			,    atol=1E-5				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()
				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)

				lowerCamelCase__														=						PostForwardHook()
				add_hook_to_module(lowerCAmelCase__			,    lowerCAmelCase__				)
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				self.assertTrue(torch.allclose(lowerCAmelCase__			,    output + 1				)				)
				self.assertTrue(outputa.requires_grad				)

				lowerCamelCase__														=						True
				lowerCamelCase__														=						test_model(lowerCAmelCase__				)
				self.assertFalse(outputa.requires_grad				)





			@require_multi_gpu
			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()
				# Everything is on CPU
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# This will move each submodule on different devices
				add_hook_to_module(model.lineara			,    AlignDevicesHook(execution_device=0				)				)
				add_hook_to_module(model.batchnorm			,    AlignDevicesHook(execution_device=0				)				)
				add_hook_to_module(model.lineara			,    AlignDevicesHook(execution_device=1				)				)

				self.assertEqual(model.lineara.weight.device			,    torch.device(0				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device(0				)				)
				self.assertEqual(model.batchnorm.running_mean.device			,    torch.device(0				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device(1				)				)

				# We can still make a forward pass. The input does not need to be on any particular device
				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    torch.device(1				)				)

				# We can add a general hook to put back output on same device as input.
				add_hook_to_module(lowerCAmelCase__			,    AlignDevicesHook(io_same_device=lowerCAmelCase__				)				)
				lowerCamelCase__														=						torch.randn(2			,    3				).to(0				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    torch.device(0				)				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()

				# Everything is on CPU
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# This will move each submodule on different devices
				lowerCamelCase__														=						{'execution_device': 0 if torch.cuda.is_available() else 'cpu', 'offload': True}

				add_hook_to_module(model.lineara			,    AlignDevicesHook(**lowerCAmelCase__				)				)
				add_hook_to_module(model.batchnorm			,    AlignDevicesHook(**lowerCAmelCase__				)				)
				add_hook_to_module(model.lineara			,    AlignDevicesHook(**lowerCAmelCase__				)				)

				# Parameters have been offloaded, so on the meta device
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				# Buffers are not included in the offload by default, so are on the execution device
				lowerCamelCase__														=						torch.device(hook_kwargs['''execution_device''']				)
				self.assertEqual(model.batchnorm.running_mean.device			,    lowerCAmelCase__				)

				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    lowerCAmelCase__				)

				# Removing hooks loads back the weights in the model.
				remove_hook_from_module(model.lineara				)
				remove_hook_from_module(model.batchnorm				)
				remove_hook_from_module(model.lineara				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# Now test with buffers included in the offload
				lowerCamelCase__														=						{
				    'execution_device': 0 if torch.cuda.is_available() else 'cpu',
				    'offload': True,
				    'offload_buffers': True,
				}

				add_hook_to_module(model.lineara			,    AlignDevicesHook(**lowerCAmelCase__				)				)
				add_hook_to_module(model.batchnorm			,    AlignDevicesHook(**lowerCAmelCase__				)				)
				add_hook_to_module(model.lineara			,    AlignDevicesHook(**lowerCAmelCase__				)				)

				# Parameters have been offloaded, so on the meta device, buffers included
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.running_mean.device			,    torch.device('''meta'''				)				)

				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    lowerCAmelCase__				)

				# Removing hooks loads back the weights in the model.
				remove_hook_from_module(model.lineara				)
				remove_hook_from_module(model.batchnorm				)
				remove_hook_from_module(model.lineara				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()

				# Everything is on CPU
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# This will move each submodule on different devices
				lowerCamelCase__														=						0 if torch.cuda.is_available() else 'cpu'
				attach_align_device_hook(lowerCAmelCase__			,    execution_device=lowerCAmelCase__			,    offload=lowerCAmelCase__				)

				# Parameters have been offloaded, so on the meta device
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				# Buffers are not included in the offload by default, so are on the execution device
				lowerCamelCase__														=						torch.device(lowerCAmelCase__				)
				self.assertEqual(model.batchnorm.running_mean.device			,    lowerCAmelCase__				)

				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    lowerCAmelCase__				)

				# Removing hooks loads back the weights in the model.
				remove_hook_from_submodules(lowerCAmelCase__				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# Now test with buffers included in the offload
				attach_align_device_hook(lowerCAmelCase__			,    execution_device=lowerCAmelCase__			,    offload=lowerCAmelCase__			,    offload_buffers=lowerCAmelCase__				)

				# Parameters have been offloaded, so on the meta device, buffers included
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.running_mean.device			,    torch.device('''meta'''				)				)

				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    lowerCAmelCase__				)

				# Removing hooks loads back the weights in the model.
				remove_hook_from_submodules(lowerCAmelCase__				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)





			def 						__lowerCamelCase							(       self				):



				'''simple docstring'''







				lowerCamelCase__														=						ModelForTest()

				# Everything is on CPU
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# This will move each submodule on different devices
				lowerCamelCase__														=						0 if torch.cuda.is_available() else 'cpu'
				attach_align_device_hook(
				    lowerCAmelCase__			,    execution_device=lowerCAmelCase__			,    offload=lowerCAmelCase__			,    weights_map=model.state_dict()				)

				# Parameters have been offloaded, so on the meta device
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				# Buffers are not included in the offload by default, so are on the execution device
				lowerCamelCase__														=						torch.device(lowerCAmelCase__				)
				self.assertEqual(model.batchnorm.running_mean.device			,    lowerCAmelCase__				)

				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    lowerCAmelCase__				)

				# Removing hooks loads back the weights in the model.
				remove_hook_from_submodules(lowerCAmelCase__				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)

				# Now test with buffers included in the offload
				attach_align_device_hook(
				    lowerCAmelCase__			,    execution_device=lowerCAmelCase__			,    offload=lowerCAmelCase__			,    weights_map=model.state_dict()			,    offload_buffers=lowerCAmelCase__			,    )

				# Parameters have been offloaded, so on the meta device, buffers included
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''meta'''				)				)
				self.assertEqual(model.batchnorm.running_mean.device			,    torch.device('''meta'''				)				)

				lowerCamelCase__														=						torch.randn(2			,    3				)
				lowerCamelCase__														=						model(lowerCAmelCase__				)
				self.assertEqual(output.device			,    lowerCAmelCase__				)

				# Removing hooks loads back the weights in the model.
				remove_hook_from_submodules(lowerCAmelCase__				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.batchnorm.weight.device			,    torch.device('''cpu'''				)				)
				self.assertEqual(model.lineara.weight.device			,    torch.device('''cpu'''				)				)







import copy
import os
from typing import Union

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


lowerCAmelCase__			:      Tuple								=logging.get_logger(__name__)

lowerCAmelCase__			:      Optional[int]								={
    'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json',
}







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""git_vision_model"""






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





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__       )

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






							@classmethod
							def 					UpperCamelCase__     (      cls			,						lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




										cls._set_token_in_kwargs(lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     List[str]					=					cls.get_config_dict(lowerCAmelCase__			,						**lowerCAmelCase__       )

										# get the vision config dict if we are loading from GITConfig
										if config_dict.get('model_type'       ) == "git":
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					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(lowerCAmelCase__			,						**lowerCAmelCase__       )







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""git"""






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





										"""simple docstring"""




										super().__init__(bos_token_id=lowerCAmelCase__			,						eos_token_id=lowerCAmelCase__			,						pad_token_id=lowerCAmelCase__			,						**lowerCAmelCase__       )

										if vision_config is None:
													SCREAMING_SNAKE_CASE_		:     Dict					=					{}
													logger.info('vision_config is None. initializing the GitVisionConfig with default values.'       )

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

										SCREAMING_SNAKE_CASE_		:     List[str]					=					bos_token_id
										SCREAMING_SNAKE_CASE_		:     str					=					eos_token_id






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					copy.deepcopy(self.__dict__       )
										SCREAMING_SNAKE_CASE_		:     str					=					self.vision_config.to_dict()
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.__class__.model_type
										return output





