




'''simple docstring'''







import random
import unittest

from torch.utils.data import BatchSampler, DataLoader, IterableDataset

from accelerate import Accelerator
from accelerate.data_loader import (
    BatchSamplerShard,
    DataLoaderDispatcher,
    DataLoaderShard,
    IterableDatasetShard,
    SkipBatchSampler,
    SkipDataLoader,
    skip_first_batches,
)

class 	_snake_case(			UpperCAmelCase      ):






 def __init__(self       :  Union[str, Any]    ,		a       :  List[str]=0.01    ,		a       :  Dict=10_00    )       ->   List[Any]:






    """simple docstring"""


    A__       =     p_stop
    A__       =     max_length






 def __iter__(self       :  int    )       ->   List[Any]:






    """simple docstring"""


    A__       =     0
    A__       =     False
    while not stop and count < self.max_length:
       yield count
       count += 1
       A__       =     random.random() < self.p_stop




class 	_snake_case(			unittest.TestCase      ):






 def 						_UpperCamelCase (self       :  List[Any]    ,		a       :  str    ,		a       :  Dict    ,		a       :  Optional[Any]=False    ,		a       :  int=True    )       ->   Optional[Any]:






    """simple docstring"""


    A__       =     [
        BatchSamplerShard(a    ,		2    ,		a    ,		split_batches=a    ,		even_batches=a    )
        for i in range(2    )
    ]
    A__       =     [list(a    ) for batch_sampler_shard in batch_sampler_shards]
    if not split_batches:
       self.assertListEqual([len(a    ) for shard in batch_sampler_shards]    ,		[len(a    ) for e in expected]    )
    self.assertListEqual(a    ,		a    )






 def 						_UpperCamelCase (self       :  Union[str, Any]    )       ->   Dict:






    """simple docstring"""


    A__       =     BatchSampler(range(24    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17], [21, 22, 23]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    A__       =     BatchSampler(range(24    )    ,		batch_size=3    ,		drop_last=a    )
    # Expected shouldn't change
    self.check_batch_sampler_shards(a    ,		a    )

    # Check the shards when the dataset is a round multiple of batch size but not total batch size.
    A__       =     BatchSampler(range(21    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17], [0, 1, 2]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    A__       =     BatchSampler(range(21    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    # Check the shards when the dataset is not a round multiple of batch size but has a multiple of
    # num_processes batch.
    A__       =     BatchSampler(range(22    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17], [21, 0, 1]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    A__       =     BatchSampler(range(22    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    # Check the shards when the dataset is not a round multiple of batch size but and has not a multiple of
    # num_processes batch.
    A__       =     BatchSampler(range(20    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 0]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17], [1, 2, 3]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    A__       =     BatchSampler(range(20    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    )

    # Check the shards when the dataset is very small.
    A__       =     BatchSampler(range(2    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [[[0, 1, 0]], [[1, 0, 1]]]
    self.check_batch_sampler_shards(a    ,		a    )

    A__       =     BatchSampler(range(2    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [[], []]
    self.check_batch_sampler_shards(a    ,		a    )






 def 						_UpperCamelCase (self       :  List[Any]    )       ->   Any:






    """simple docstring"""


    A__       =     BatchSampler(range(24    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17], [20, 21]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19], [22, 23]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    A__       =     BatchSampler(range(24    )    ,		batch_size=4    ,		drop_last=a    )
    # Expected shouldn't change
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    # Check the shards when the dataset is not a round multiple of batch size.
    A__       =     BatchSampler(range(22    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17], [20, 21]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19], [0, 1]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    A__       =     BatchSampler(range(22    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    # Check the shards when the dataset is not a round multiple of batch size or num_processes.
    A__       =     BatchSampler(range(21    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17], [20, 0]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19], [1, 2]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    A__       =     BatchSampler(range(21    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    # Check the shards when the dataset is very small.
    A__       =     BatchSampler(range(2    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [[[0, 1]], [[0, 1]]]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )

    A__       =     BatchSampler(range(2    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [[], []]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    )






 def 						_UpperCamelCase (self       :  Optional[Any]    )       ->   str:






    """simple docstring"""


    A__       =     BatchSampler(range(24    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17], [21, 22, 23]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    A__       =     BatchSampler(range(24    )    ,		batch_size=3    ,		drop_last=a    )
    # Expected shouldn't change
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    # Check the shards when the dataset is a round multiple of batch size but not total batch size.
    A__       =     BatchSampler(range(21    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    A__       =     BatchSampler(range(21    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    # Check the shards when the dataset is not a round multiple of batch size but has a multiple of
    # num_processes batch.
    A__       =     BatchSampler(range(22    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17], [21]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    A__       =     BatchSampler(range(22    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    # Check the shards when the dataset is not a round multiple of batch size but and has not a multiple of
    # num_processes batch.
    A__       =     BatchSampler(range(20    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    A__       =     BatchSampler(range(20    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [
        [[0, 1, 2], [6, 7, 8], [12, 13, 14]],
        [[3, 4, 5], [9, 10, 11], [15, 16, 17]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    # Check the shards when the dataset is very small.
    A__       =     BatchSampler(range(2    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [[[0, 1]], []]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )

    A__       =     BatchSampler(range(2    )    ,		batch_size=3    ,		drop_last=a    )
    A__       =     [[], []]
    self.check_batch_sampler_shards(a    ,		a    ,		even_batches=a    )






 def 						_UpperCamelCase (self       :  str    )       ->   Union[str, Any]:






    """simple docstring"""


    A__       =     BatchSampler(range(24    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17], [20, 21]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19], [22, 23]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    A__       =     BatchSampler(range(24    )    ,		batch_size=4    ,		drop_last=a    )
    # Expected shouldn't change
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    # Check the shards when the dataset is not a round multiple of batch size.
    A__       =     BatchSampler(range(22    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17], [20, 21]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    A__       =     BatchSampler(range(22    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    # Check the shards when the dataset is not a round multiple of batch size or num_processes.
    A__       =     BatchSampler(range(21    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17], [20]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    A__       =     BatchSampler(range(21    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [
        [[0, 1], [4, 5], [8, 9], [12, 13], [16, 17]],
        [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]],
    ]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    # Check the shards when the dataset is very small.
    A__       =     BatchSampler(range(2    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [[[0, 1]], []]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )

    A__       =     BatchSampler(range(2    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     [[], []]
    self.check_batch_sampler_shards(a    ,		a    ,		split_batches=a    ,		even_batches=a    )






 def 						_UpperCamelCase (self       :  Dict    )       ->   Optional[Any]:






    """simple docstring"""


    A__       =     [[0, 1, 2], [3, 4], [5, 6, 7, 8], [9, 10, 11], [12, 13]]
    A__       =     [BatchSamplerShard(a    ,		2    ,		a    ,		even_batches=a    ) for i in range(2    )]

    self.assertEqual(len(batch_sampler_shards[0]    )    ,		3    )
    self.assertEqual(len(batch_sampler_shards[1]    )    ,		2    )

    self.assertListEqual(list(batch_sampler_shards[0]    )    ,		[[0, 1, 2], [5, 6, 7, 8], [12, 13]]    )
    self.assertListEqual(list(batch_sampler_shards[1]    )    ,		[[3, 4], [9, 10, 11]]    )






 def 						_UpperCamelCase (self       :  Optional[Any]    ,		a       :  List[Any]    ,		a       :  List[str]    ,		a       :  List[Any]    ,		a       :  List[Any]=False    ,		a       :  Tuple=2    ,		a       :  Optional[Any]=False    )       ->   int:






    """simple docstring"""


    random.seed(a    )
    A__       =     list(a    )

    A__       =     [
        IterableDatasetShard(
            a    ,		batch_size=a    ,		drop_last=a    ,		num_processes=a    ,		process_index=a    ,		split_batches=a    ,		)
        for i in range(a    )
    ]
    A__       =     []
    for iterable_dataset_shard in iterable_dataset_shards:
       # Since our random iterable dataset will be... random... we need to use a seed to get reproducible results.
       random.seed(a    )
       iterable_dataset_lists.append(list(a    )    )

    A__       =     batch_size // num_processes if split_batches else batch_size
    # All iterable dataset shard should have the same length, a round multiple of shard_batch_size
    A__       =     iterable_dataset_lists[0]
    for l in iterable_dataset_lists[1:]:
       self.assertEqual(len(a    )    ,		len(a    )    )
       self.assertTrue(len(a    ) % shard_batch_size == 0    )

    A__       =     []
    for idx in range(0    ,		len(a    )    ,		a    ):
       for l in iterable_dataset_lists:
          observed += l[idx : idx + shard_batch_size]

    if not drop_last:
       while len(a    ) < len(a    ):
          reference += reference
    self.assertListEqual(a    ,		reference[: len(a    )]    )






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






    """simple docstring"""


    A__       =     42
    A__       =     RandomIterableDataset()

    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )
    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )
    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )
    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )

    # Edge case with a very small dataset
    A__       =     RandomIterableDataset(max_length=2    )

    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )
    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )
    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )
    self.check_iterable_dataset_shards(a    ,		a    ,		batch_size=4    ,		drop_last=a    ,		split_batches=a    )






 def 						_UpperCamelCase (self       :  Any    )       ->   Dict:






    """simple docstring"""


    A__       =     BatchSampler(range(16    )    ,		batch_size=4    ,		drop_last=a    )
    A__       =     SkipBatchSampler(a    ,		2    )
    self.assertListEqual(list(a    )    ,		[[8, 9, 10, 11], [12, 13, 14, 15]]    )






 def 						_UpperCamelCase (self       :  Dict    )       ->   Dict:






    """simple docstring"""


    A__       =     SkipDataLoader(list(range(16    )    )    ,		batch_size=4    ,		skip_batches=2    )
    self.assertListEqual([t.tolist() for t in dataloader]    ,		[[8, 9, 10, 11], [12, 13, 14, 15]]    )






 def 						_UpperCamelCase (self       :  List[str]    )       ->   Optional[int]:






    """simple docstring"""


    A__       =     DataLoader(list(range(16    )    )    ,		batch_size=4    )
    A__       =     skip_first_batches(a    ,		num_batches=2    )
    self.assertListEqual([t.tolist() for t in new_dataloader]    ,		[[8, 9, 10, 11], [12, 13, 14, 15]]    )






 def 						_UpperCamelCase (self       :  str    )       ->   Tuple:






    """simple docstring"""


    A__       =     DataLoaderShard(list(range(16    )    )    ,		batch_size=4    )
    for idx, _ in enumerate(a    ):
       self.assertEqual(dataloader.end_of_dataloader    ,		idx == 3    )

    # Test it also works on the second iteration
    for idx, _ in enumerate(a    ):
       self.assertEqual(dataloader.end_of_dataloader    ,		idx == 3    )






 def 						_UpperCamelCase (self       :  Tuple    )       ->   Any:






    """simple docstring"""


    Accelerator()
    A__       =     DataLoaderDispatcher(range(16    )    ,		batch_size=4    )
    for idx, _ in enumerate(a    ):
       self.assertEqual(dataloader.end_of_dataloader    ,		idx == 3    )

    # Test it also works on the second iteration
    for idx, _ in enumerate(a    ):
       self.assertEqual(dataloader.end_of_dataloader    ,		idx == 3    )








'''simple docstring'''







from __future__ import annotations

import unittest

import numpy as np

from transformers import BlipTextConfig
from transformers.testing_utils import require_tf, slow
from transformers.utils import is_tf_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask


if is_tf_available():
    import tensorflow as tf

    from transformers import TFBlipTextModel
    from transformers.models.blip.modeling_tf_blip import TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST

class 	_snake_case:






 def __init__(self       :  Any    ,		a       :  str    ,		a       :  Union[str, Any]=12    ,		a       :  List[str]=7    ,		a       :  Dict=True    ,		a       :  Tuple=True    ,		a       :  Any=True    ,		a       :  Optional[Any]=99    ,		a       :  Optional[Any]=32    ,		a       :  Tuple=32    ,		a       :  List[Any]=2    ,		a       :  str=4    ,		a       :  Dict=37    ,		a       :  Optional[Any]=0.1    ,		a       :  List[Any]=0.1    ,		a       :  Dict=5_12    ,		a       :  List[Any]=0.02    ,		a       :  Any=0    ,		a       :  Optional[int]=None    ,		)       ->   List[Any]:






    """simple docstring"""


    A__       =     parent
    A__       =     batch_size
    A__       =     seq_length
    A__       =     is_training
    A__       =     use_input_mask
    A__       =     use_labels
    A__       =     vocab_size
    A__       =     hidden_size
    A__       =     projection_dim
    A__       =     num_hidden_layers
    A__       =     num_attention_heads
    A__       =     intermediate_size
    A__       =     dropout
    A__       =     attention_dropout
    A__       =     max_position_embeddings
    A__       =     initializer_range
    A__       =     scope
    A__       =     bos_token_id






 def 						_UpperCamelCase (self       :  Union[str, Any]    )       ->   List[Any]:






    """simple docstring"""


    A__       =     ids_tensor([self.batch_size, self.seq_length]    ,		self.vocab_size    )

    A__       =     None
    if self.use_input_mask:
       A__       =     random_attention_mask([self.batch_size, self.seq_length]    )

    if input_mask is not None:
       A__       =     input_mask.numpy()
       A__  ,			A__       =     input_mask.shape
       A__       =     np.random.randint(1    ,		seq_length - 1    ,		size=(batch_size,)    )
       for batch_idx, start_index in enumerate(a    ):
          A__       =     1
          A__       =     0

    A__       =     self.get_config()

    return config, input_ids, tf.convert_to_tensor(a    )






 def 						_UpperCamelCase (self       :  Tuple    )       ->   Union[str, Any]:






    """simple docstring"""


    return BlipTextConfig(
        vocab_size=self.vocab_size    ,		hidden_size=self.hidden_size    ,		projection_dim=self.projection_dim    ,		num_hidden_layers=self.num_hidden_layers    ,		num_attention_heads=self.num_attention_heads    ,		intermediate_size=self.intermediate_size    ,		dropout=self.dropout    ,		attention_dropout=self.attention_dropout    ,		max_position_embeddings=self.max_position_embeddings    ,		initializer_range=self.initializer_range    ,		bos_token_id=self.bos_token_id    ,		)






 def 						_UpperCamelCase (self       :  Optional[int]    ,		a       :  Any    ,		a       :  List[Any]    ,		a       :  Union[str, Any]    )       ->   Any:






    """simple docstring"""


    A__       =     TFBlipTextModel(config=a    )
    A__       =     model(a    ,		attention_mask=a    ,		training=a    )
    A__       =     model(a    ,		training=a    )
    self.parent.assertEqual(result.last_hidden_state.shape    ,		(self.batch_size, self.seq_length, self.hidden_size)    )
    self.parent.assertEqual(result.pooler_output.shape    ,		(self.batch_size, self.hidden_size)    )






 def 						_UpperCamelCase (self       :  str    )       ->   List[Any]:






    """simple docstring"""


    A__       =     self.prepare_config_and_inputs()
    A__  ,			A__  ,			A__       =     config_and_inputs
    A__       =     {'input_ids': input_ids, 'attention_mask': input_mask}
    return config, inputs_dict




@require_tf
class 	_snake_case(			UpperCAmelCase       , unittest.TestCase      ):
 __snake_case:							Optional[int]						=					(TFBlipTextModel,) if is_tf_available() else ()
 __snake_case:							Union[str, Any]						=					False
 __snake_case:							Any						=					False
 __snake_case:							Union[str, Any]						=					False






 def 						_UpperCamelCase (self       :  Optional[Any]    )       ->   List[Any]:






    """simple docstring"""


    A__       =     BlipTextModelTester(self    )
    A__       =     ConfigTester(self    ,		config_class=a    ,		hidden_size=37    )






 def 						_UpperCamelCase (self       :  Tuple    )       ->   str:






    """simple docstring"""


    self.config_tester.run_common_tests()






 def 						_UpperCamelCase (self       :  Any    )       ->   Dict:






    """simple docstring"""


    A__       =     self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_model(*a    )






 def 						_UpperCamelCase (self       :  Dict    )       ->   Dict:






    """simple docstring"""


    pass






 def 						_UpperCamelCase (self       :  str    )       ->   int:






    """simple docstring"""


    pass






 @unittest.skip(reason='Blip does not use inputs_embeds'    )
 def 						_UpperCamelCase (self       :  Union[str, Any]    )       ->   str:






    """simple docstring"""


    pass






 @unittest.skip(reason='BlipTextModel has no base class and is not available in MODEL_MAPPING'    )
 def 						_UpperCamelCase (self       :  int    )       ->   List[Any]:






    """simple docstring"""


    pass






 @unittest.skip(reason='BlipTextModel has no base class and is not available in MODEL_MAPPING'    )
 def 						_UpperCamelCase (self       :  int    )       ->   Optional[Any]:






    """simple docstring"""


    pass






 @slow
 def 						_UpperCamelCase (self       :  int    )       ->   Optional[Any]:






    """simple docstring"""


    for model_name in TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       A__       =     TFBlipTextModel.from_pretrained(a    )
       self.assertIsNotNone(a    )






 def 						_UpperCamelCase (self       :  str    ,		a       :  Optional[int]=True    )       ->   List[Any]:






    """simple docstring"""


    super().test_pt_tf_model_equivalence(allow_missing_keys=a    )


