





'''simple docstring'''
import json
import os
import unittest

from transformers.models.roc_bert.tokenization_roc_bert import (
    VOCAB_FILES_NAMES,
    RoCBertBasicTokenizer,
    RoCBertTokenizer,
    RoCBertWordpieceTokenizer,
    _is_control,
    _is_punctuation,
    _is_whitespace,
)
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin, filter_non_english

@require_tokenizers
class      snake_case     (    __lowerCamelCase			,       unittest.TestCase       ):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_	:					Dict					=RoCBertTokenizer
 SCREAMING_SNAKE_CASE_	:					int					=None
 SCREAMING_SNAKE_CASE_	:					Any					=False
 SCREAMING_SNAKE_CASE_	:					int					=True
 SCREAMING_SNAKE_CASE_	:					Optional[Any]					=filter_non_english






 def        _lowerCamelCase					(       self       :							int	):
        super().setUp()

        __UpperCamelCase       =  ['[UNK]', '[CLS]', '[SEP]', '[PAD]', '[MASK]', '你', '好', '是', '谁', 'a', 'b', 'c', 'd']
        __UpperCamelCase       =  {}
        __UpperCamelCase       =  {}
        for i, value in enumerate(__A	):
               __UpperCamelCase       =  i
               __UpperCamelCase       =  i
        __UpperCamelCase       =  os.path.join(self.tmpdirname							,	VOCAB_FILES_NAMES['vocab_file']	)
        __UpperCamelCase       =  os.path.join(self.tmpdirname							,	VOCAB_FILES_NAMES['word_shape_file']	)
        __UpperCamelCase       =  os.path.join(self.tmpdirname							,	VOCAB_FILES_NAMES['word_pronunciation_file']	)
        with open(self.vocab_file							,	'w'							,	encoding='utf-8'	) as vocab_writer:
               vocab_writer.write(''.join([x + '\n' for x in vocab_tokens]	)	)
        with open(self.word_shape_file							,	'w'							,	encoding='utf-8'	) as word_shape_writer:
               json.dump(__A							,	__A							,	ensure_ascii=__A	)
        with open(self.word_pronunciation_file							,	'w'							,	encoding='utf-8'	) as word_pronunciation_writer:
               json.dump(__A							,	__A							,	ensure_ascii=__A	)






 def        _lowerCamelCase					(       self       :							Tuple	):
        __UpperCamelCase       =  self.tokenizer_class(self.vocab_file							,	self.word_shape_file							,	self.word_pronunciation_file	)

        __UpperCamelCase       =  tokenizer.tokenize('你好[SEP]你是谁'	)
        self.assertListEqual(__A							,	['你', '好', '[SEP]', '你', '是', '谁']	)
        self.assertListEqual(tokenizer.convert_tokens_to_ids(__A	)							,	[5, 6, 2, 5, 7, 8]	)
        self.assertListEqual(tokenizer.convert_tokens_to_shape_ids(__A	)							,	[5, 6, 2, 5, 7, 8]	)
        self.assertListEqual(tokenizer.convert_tokens_to_pronunciation_ids(__A	)							,	[5, 6, 2, 5, 7, 8]	)






 def        _lowerCamelCase					(       self       :							List[Any]	):
        __UpperCamelCase       =  RoCBertBasicTokenizer()

        self.assertListEqual(tokenizer.tokenize('ah\u535A\u63A8zz'	)							,	['ah', '\u535A', '\u63A8', 'zz']	)






 def        _lowerCamelCase					(       self       :							Tuple	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHeLLo!how  \n Are yoU?  '	)							,	['hello', '!', 'how', 'are', 'you', '?']	)
        self.assertListEqual(tokenizer.tokenize('H\u00E9llo'	)							,	['hello']	)






 def        _lowerCamelCase					(       self       :							int	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A							,	strip_accents=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '	)							,	['hällo', '!', 'how', 'are', 'you', '?']	)
        self.assertListEqual(tokenizer.tokenize('H\u00E9llo'	)							,	['h\u00E9llo']	)






 def        _lowerCamelCase					(       self       :							int	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A							,	strip_accents=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '	)							,	['hallo', '!', 'how', 'are', 'you', '?']	)
        self.assertListEqual(tokenizer.tokenize('H\u00E9llo'	)							,	['hello']	)






 def        _lowerCamelCase					(       self       :							Any	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '	)							,	['hallo', '!', 'how', 'are', 'you', '?']	)
        self.assertListEqual(tokenizer.tokenize('H\u00E9llo'	)							,	['hello']	)






 def        _lowerCamelCase					(       self       :							Optional[int]	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHeLLo!how  \n Are yoU?  '	)							,	['HeLLo', '!', 'how', 'Are', 'yoU', '?']	)






 def        _lowerCamelCase					(       self       :							Any	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A							,	strip_accents=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '	)							,	['HäLLo', '!', 'how', 'Are', 'yoU', '?']	)






 def        _lowerCamelCase					(       self       :							Optional[Any]	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A							,	strip_accents=__A	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '	)							,	['HaLLo', '!', 'how', 'Are', 'yoU', '?']	)






 def        _lowerCamelCase					(       self       :							Any	):
        __UpperCamelCase       =  RoCBertBasicTokenizer(do_lower_case=__A							,	never_split=['[UNK]']	)

        self.assertListEqual(
            tokenizer.tokenize(' \tHeLLo!how  \n Are yoU? [UNK]'	)							,	['HeLLo', '!', 'how', 'Are', 'yoU', '?', '[UNK]']	)






 def        _lowerCamelCase					(       self       :							Dict	):
        __UpperCamelCase       =  ['[UNK]', '[CLS]', '[SEP]', 'want', '##want', '##ed', 'wa', 'un', 'runn', '##ing']

        __UpperCamelCase       =  {}
        for i, token in enumerate(__A	):
               __UpperCamelCase       =  i
        __UpperCamelCase       =  RoCBertWordpieceTokenizer(vocab=__A							,	unk_token='[UNK]'	)

        self.assertListEqual(tokenizer.tokenize(''	)							,	[]	)

        self.assertListEqual(tokenizer.tokenize('unwanted running'	)							,	['un', '##want', '##ed', 'runn', '##ing']	)

        self.assertListEqual(tokenizer.tokenize('unwantedX running'	)							,	['[UNK]', 'runn', '##ing']	)






 def        _lowerCamelCase					(       self       :							Dict	):
        self.assertTrue(_is_whitespace(' '	)	)
        self.assertTrue(_is_whitespace('\t'	)	)
        self.assertTrue(_is_whitespace('\r'	)	)
        self.assertTrue(_is_whitespace('\n'	)	)
        self.assertTrue(_is_whitespace('\u00A0'	)	)

        self.assertFalse(_is_whitespace('A'	)	)
        self.assertFalse(_is_whitespace('-'	)	)






 def        _lowerCamelCase					(       self       :							Dict	):
        self.assertTrue(_is_control('\u0005'	)	)

        self.assertFalse(_is_control('A'	)	)
        self.assertFalse(_is_control(' '	)	)
        self.assertFalse(_is_control('\t'	)	)
        self.assertFalse(_is_control('\r'	)	)






 def        _lowerCamelCase					(       self       :							int	):
        self.assertTrue(_is_punctuation('-'	)	)
        self.assertTrue(_is_punctuation('$'	)	)
        self.assertTrue(_is_punctuation('`'	)	)
        self.assertTrue(_is_punctuation('.'	)	)

        self.assertFalse(_is_punctuation('A'	)	)
        self.assertFalse(_is_punctuation(' '	)	)






 def        _lowerCamelCase					(       self       :							Tuple	):
        __UpperCamelCase       =  self.get_tokenizer()

        # Example taken from the issue https://github.com/huggingface/tokenizers/issues/340
        self.assertListEqual([tokenizer.tokenize(__A	) for t in ['Test', '\xad', 'test']]							,	[['[UNK]'], [], ['[UNK]']]	)

        if self.test_rust_tokenizer:
               __UpperCamelCase       =  self.get_rust_tokenizer()
               self.assertListEqual(
                   [rust_tokenizer.tokenize(__A	) for t in ['Test', '\xad', 'test']]							,	[['[UNK]'], [], ['[UNK]']]	)






 def        _lowerCamelCase					(       self       :							Dict	):
        for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
               with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''	):
                      __UpperCamelCase       =  self.rust_tokenizer_class.from_pretrained(__A							,	**__A	)

                      __UpperCamelCase       =  f'''A, naïve {tokenizer_r.mask_token} AllenNLP sentence.'''
                      __UpperCamelCase       =  tokenizer_r.encode_plus(
                          __A							,	return_attention_mask=__A							,	return_token_type_ids=__A							,	return_offsets_mapping=__A							,	add_special_tokens=__A							,	)

                      __UpperCamelCase       =  tokenizer_r.do_lower_case if hasattr(__A							,	'do_lower_case'	) else False
                      __UpperCamelCase       =  (
                          [
                              ((0, 0), tokenizer_r.cls_token),
                              ((0, 1), 'A'),
                              ((1, 2), ','),
                              ((3, 5), 'na'),
                              ((5, 6), '##ï'),
                              ((6, 8), '##ve'),
                              ((9, 1_5), tokenizer_r.mask_token),
                              ((1_6, 2_1), 'Allen'),
                              ((2_1, 2_3), '##NL'),
                              ((2_3, 2_4), '##P'),
                              ((2_5, 3_3), 'sentence'),
                              ((3_3, 3_4), '.'),
                              ((0, 0), tokenizer_r.sep_token),
                          ]
                          if not do_lower_case
                          else [
                              ((0, 0), tokenizer_r.cls_token),
                              ((0, 1), 'a'),
                              ((1, 2), ','),
                              ((3, 8), 'naive'),
                              ((9, 1_5), tokenizer_r.mask_token),
                              ((1_6, 2_1), 'allen'),
                              ((2_1, 2_3), '##nl'),
                              ((2_3, 2_4), '##p'),
                              ((2_5, 3_3), 'sentence'),
                              ((3_3, 3_4), '.'),
                              ((0, 0), tokenizer_r.sep_token),
                          ]
                      )

                      self.assertEqual(
                          [e[1] for e in expected_results]							,	tokenizer_r.convert_ids_to_tokens(tokens['input_ids']	)	)
                      self.assertEqual([e[0] for e in expected_results]							,	tokens['offset_mapping']	)






 def        _lowerCamelCase					(       self       :							str	):
        __UpperCamelCase       =  ['的', '人', '有']
        __UpperCamelCase       =  ''.join(__A	)
        for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
               with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''	):
                      __UpperCamelCase       =  True
                      __UpperCamelCase       =  self.tokenizer_class.from_pretrained(__A							,	**__A	)
                      __UpperCamelCase       =  self.rust_tokenizer_class.from_pretrained(__A							,	**__A	)

                      __UpperCamelCase       =  tokenizer_p.encode(__A							,	add_special_tokens=__A	)
                      __UpperCamelCase       =  tokenizer_r.encode(__A							,	add_special_tokens=__A	)

                      __UpperCamelCase       =  tokenizer_r.convert_ids_to_tokens(__A	)
                      __UpperCamelCase       =  tokenizer_p.convert_ids_to_tokens(__A	)

                      # it is expected that each Chinese character is not preceded by "##"
                      self.assertListEqual(__A							,	__A	)
                      self.assertListEqual(__A							,	__A	)

                      __UpperCamelCase       =  False
                      __UpperCamelCase       =  self.rust_tokenizer_class.from_pretrained(__A							,	**__A	)
                      __UpperCamelCase       =  self.tokenizer_class.from_pretrained(__A							,	**__A	)

                      __UpperCamelCase       =  tokenizer_r.encode(__A							,	add_special_tokens=__A	)
                      __UpperCamelCase       =  tokenizer_p.encode(__A							,	add_special_tokens=__A	)

                      __UpperCamelCase       =  tokenizer_r.convert_ids_to_tokens(__A	)
                      __UpperCamelCase       =  tokenizer_p.convert_ids_to_tokens(__A	)

                      # it is expected that only the first Chinese character is not preceded by "##".
                      __UpperCamelCase       =  [
                          f'''##{token}''' if idx != 0 else token for idx, token in enumerate(__A	)
                      ]
                      self.assertListEqual(__A							,	__A	)
                      self.assertListEqual(__A							,	__A	)






 @slow
 def        _lowerCamelCase					(       self       :							Optional[int]	):
        __UpperCamelCase       =  self.tokenizer_class(self.vocab_file							,	self.word_shape_file							,	self.word_pronunciation_file	)

        __UpperCamelCase       =  tokenizer.encode('你好'							,	add_special_tokens=__A	)
        __UpperCamelCase       =  tokenizer.encode('你是谁'							,	add_special_tokens=__A	)

        __UpperCamelCase       =  tokenizer.build_inputs_with_special_tokens(__A	)
        __UpperCamelCase       =  tokenizer.build_inputs_with_special_tokens(__A							,	__A	)

        assert encoded_sentence == [1] + text + [2]
        assert encoded_pair == [1] + text + [2] + text_a + [2]






 def        _lowerCamelCase					(       self       :							List[str]	):
        __UpperCamelCase       =  self.get_tokenizers(do_lower_case=__A	)
        for tokenizer in tokenizers:
               with self.subTest(f'''{tokenizer.__class__.__name__}'''	):
                      __UpperCamelCase       =  '你好，你是谁'
                      __UpperCamelCase       =  tokenizer.tokenize(__A	)
                      __UpperCamelCase       =  tokenizer.convert_tokens_to_ids(__A	)
                      __UpperCamelCase       =  tokenizer.convert_tokens_to_shape_ids(__A	)
                      __UpperCamelCase       =  tokenizer.convert_tokens_to_pronunciation_ids(__A	)
                      __UpperCamelCase       =  tokenizer.prepare_for_model(
                          __A							,	__A							,	__A							,	add_special_tokens=__A	)

                      __UpperCamelCase       =  tokenizer.encode_plus(__A							,	add_special_tokens=__A	)

                      self.assertEqual(__A							,	__A	)







'''simple docstring'''
import copy
import os
from typing import Union

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


a__							:							List[Any] =logging.get_logger(__name__)

a__							:							List[Any] ={
    '''BAAI/AltCLIP''': '''https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json''',
    # See all AltCLIP models at https://huggingface.co/models?filter=altclip
}

class      snake_case     (    __lowerCamelCase       ):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_	:					Tuple					="altclip_text_model"






 def __init__(       self       :							str							,	__A       :							List[Any]=2_5_0_0_0_2							,	__A       :							Any=1_0_2_4							,	__A       :							int=2_4							,	__A       :							Dict=1_6							,	__A       :							Optional[Any]=4_0_9_6							,	__A       :							Union[str, Any]="gelu"							,	__A       :							Dict=0.1							,	__A       :							Dict=0.1							,	__A       :							List[str]=5_1_4							,	__A       :							Optional[int]=1							,	__A       :							int=0.02							,	__A       :							Optional[Any]=0.02							,	__A       :							Optional[Any]=1e-05							,	__A       :							Dict=1							,	__A       :							List[Any]=0							,	__A       :							int=2							,	__A       :							Tuple="absolute"							,	__A       :							Optional[Any]=True							,	__A       :							Optional[int]=7_6_8							,	**__A       :							List[str]							,	):
        super().__init__(pad_token_id=__A							,	bos_token_id=__A							,	eos_token_id=__A							,	**__A	)

        __UpperCamelCase       =  vocab_size
        __UpperCamelCase       =  hidden_size
        __UpperCamelCase       =  num_hidden_layers
        __UpperCamelCase       =  num_attention_heads
        __UpperCamelCase       =  hidden_act
        __UpperCamelCase       =  intermediate_size
        __UpperCamelCase       =  hidden_dropout_prob
        __UpperCamelCase       =  attention_probs_dropout_prob
        __UpperCamelCase       =  max_position_embeddings
        __UpperCamelCase       =  type_vocab_size
        __UpperCamelCase       =  initializer_range
        __UpperCamelCase       =  initializer_factor
        __UpperCamelCase       =  layer_norm_eps
        __UpperCamelCase       =  position_embedding_type
        __UpperCamelCase       =  use_cache
        __UpperCamelCase       =  project_dim






class      snake_case     (    __lowerCamelCase       ):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_	:					Tuple					="altclip_vision_model"






 def __init__(       self       :							List[Any]							,	__A       :							Union[str, Any]=7_6_8							,	__A       :							Optional[int]=3_0_7_2							,	__A       :							Optional[Any]=5_1_2							,	__A       :							Tuple=1_2							,	__A       :							Union[str, Any]=1_2							,	__A       :							Optional[int]=3							,	__A       :							Dict=2_2_4							,	__A       :							Tuple=3_2							,	__A       :							str="quick_gelu"							,	__A       :							Dict=1e-5							,	__A       :							Optional[int]=0.0							,	__A       :							List[Any]=0.02							,	__A       :							int=1.0							,	**__A       :							Optional[int]							,	):
        super().__init__(**__A	)

        __UpperCamelCase       =  hidden_size
        __UpperCamelCase       =  intermediate_size
        __UpperCamelCase       =  projection_dim
        __UpperCamelCase       =  num_hidden_layers
        __UpperCamelCase       =  num_attention_heads
        __UpperCamelCase       =  num_channels
        __UpperCamelCase       =  patch_size
        __UpperCamelCase       =  image_size
        __UpperCamelCase       =  initializer_range
        __UpperCamelCase       =  initializer_factor
        __UpperCamelCase       =  attention_dropout
        __UpperCamelCase       =  layer_norm_eps
        __UpperCamelCase       =  hidden_act






 @classmethod
 def        _lowerCamelCase					(       cls       :							Optional[Any]							,	__A       :							Union[str, os.PathLike]							,	**__A       :							Optional[Any]	):
        cls._set_token_in_kwargs(__A	)

        __UpperCamelCase       ,						__UpperCamelCase       =  cls.get_config_dict(__A							,	**__A	)

        # get the vision config dict if we are loading from AltCLIPConfig
        if config_dict.get('model_type'	) == "altclip":
               __UpperCamelCase       =  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(__A							,	**__A	)






class      snake_case     (    __lowerCamelCase       ):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_	:					List[str]					="altclip"
 SCREAMING_SNAKE_CASE_	:					Optional[int]					=True






 def __init__(       self       :							Any							,	__A       :							List[str]=None							,	__A       :							List[Any]=None							,	__A       :							List[str]=7_6_8							,	__A       :							List[str]=2.6592							,	**__A       :							Dict	):
        # If `_config_dict` exist, we use them for the backward compatibility.
        # We pop out these 2 attributes before calling `super().__init__` to avoid them being saved (which causes a lot
        # of confusion!).
        __UpperCamelCase       =  kwargs.pop('text_config_dict'							,	__A	)
        __UpperCamelCase       =  kwargs.pop('vision_config_dict'							,	__A	)

        super().__init__(**__A	)

        # Instead of simply assigning `[text|vision]_config_dict` to `[text|vision]_config`, we use the values in
        # `[text|vision]_config_dict` to update the values in `[text|vision]_config`. The values should be same in most
        # cases, but we don't want to break anything regarding `_config_dict` that existed before commit `8827e1b2`.
        if text_config_dict is not None:
               if text_config is None:
                      __UpperCamelCase       =  {}

               # This is the complete result when using `text_config_dict`.
               __UpperCamelCase       =  AltCLIPTextConfig(**__A	).to_dict()

               # Give a warning if the values exist in both `_text_config_dict` and `text_config` but being different.
               for key, value in _text_config_dict.items():
                      if key in text_config and value != text_config[key] and key not in ["transformers_version"]:
                             # If specified in `text_config_dict`
                             if key in text_config_dict:
                                    __UpperCamelCase       =  (
                                        f'''`{key}` is found in both `text_config_dict` and `text_config` but with different values. '''
                                        f'''The value `text_config_dict["{key}"]` will be used instead.'''
                                    )
                             # If inferred from default argument values (just to be super careful)
                             else:
                                    __UpperCamelCase       =  (
                                        f'''`text_config_dict` is provided which will be used to initialize `AltCLIPTextConfig`. The '''
                                        f'''value `text_config["{key}"]` will be overriden.'''
                                    )
                             logger.warning(__A	)

            # Update all values in `text_config` with the ones in `_text_config_dict`.
               text_config.update(_text_config_dict	)

        if vision_config_dict is not None:
               if vision_config is None:
                      __UpperCamelCase       =  {}

               # This is the complete result when using `vision_config_dict`.
               __UpperCamelCase       =  AltCLIPVisionConfig(**__A	).to_dict()
               # convert keys to string instead of integer
               if "id2label" in _vision_config_dict:
                      __UpperCamelCase       =  {
                          str(__A	): value for key, value in _vision_config_dict['id2label'].items()
                      }

               # Give a warning if the values exist in both `_vision_config_dict` and `vision_config` but being different.
               for key, value in _vision_config_dict.items():
                      if key in vision_config and value != vision_config[key] and key not in ["transformers_version"]:
                             # If specified in `vision_config_dict`
                             if key in vision_config_dict:
                                    __UpperCamelCase       =  (
                                        f'''`{key}` is found in both `vision_config_dict` and `vision_config` but with different '''
                                        f'''values. The value `vision_config_dict["{key}"]` will be used instead.'''
                                    )
                             # If inferred from default argument values (just to be super careful)
                             else:
                                    __UpperCamelCase       =  (
                                        f'''`vision_config_dict` is provided which will be used to initialize `AltCLIPVisionConfig`. '''
                                        f'''The value `vision_config["{key}"]` will be overriden.'''
                                    )
                             logger.warning(__A	)

            # Update all values in `vision_config` with the ones in `_vision_config_dict`.
               vision_config.update(_vision_config_dict	)

        if text_config is None:
               __UpperCamelCase       =  {}
               logger.info('`text_config` is `None`. Initializing the `AltCLIPTextConfig` with default values.'	)

        if vision_config is None:
               __UpperCamelCase       =  {}
               logger.info('`vision_config` is `None`. initializing the `AltCLIPVisionConfig` with default values.'	)

        __UpperCamelCase       =  AltCLIPTextConfig(**__A	)
        __UpperCamelCase       =  AltCLIPVisionConfig(**__A	)

        __UpperCamelCase       =  projection_dim
        __UpperCamelCase       =  logit_scale_init_value
        __UpperCamelCase       =  1.0






 @classmethod
 def        _lowerCamelCase					(       cls       :							Union[str, Any]							,	__A       :							AltCLIPTextConfig							,	__A       :							AltCLIPVisionConfig							,	**__A       :							Optional[Any]	):
        return cls(text_config=text_config.to_dict()							,	vision_config=vision_config.to_dict()							,	**__A	)






 def        _lowerCamelCase					(       self       :							List[Any]	):
        __UpperCamelCase       =  copy.deepcopy(self.__dict__	)
        __UpperCamelCase       =  self.text_config.to_dict()
        __UpperCamelCase       =  self.vision_config.to_dict()
        __UpperCamelCase       =  self.__class__.model_type
        return output
