




"""simple docstring"""






from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset






class lowerCAmelCase__      (	lowercase		):






			'''simple docstring'''



			def    A_       (    self    ):
							return [
							    {"col_1": 3, "col_2": "a"},
							    {"col_1": 2, "col_2": "b"},
							    {"col_1": 1, "col_2": "c"},
							    {"col_1": 0, "col_2": "d"},
							]
			def    A_       (    self    ):
							_lowerCamelCase	:     Optional[Any]       =       {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
							return Dataset.from_dict(lowercase    )
			def    A_       (    self    ):
							_lowerCamelCase	:     Dict       =       self._create_example_records()
							_lowerCamelCase	:     Union[str, Any]       =       Dataset.from_list(lowercase    )
							self.assertListEqual(dset.column_names    , ['col_1', 'col_2']    )
							for i, r in enumerate(lowercase    ):
											self.assertDictEqual(lowercase    , example_records[i]    )
			def    A_       (    self    ):
							_lowerCamelCase	:     List[str]       =       self._create_example_records()
							_lowerCamelCase	:     int       =       Dataset.from_list(lowercase    )
							_lowerCamelCase	:     Any       =       Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}    )
							self.assertEqual(dset.info    , dset_from_dict.info    )
			def    A_       (    self    ):  # checks what happens with missing columns
							_lowerCamelCase	:     str       =       [{'col_1': 1}, {'col_2': 'x'}]
							_lowerCamelCase	:     List[Any]       =       Dataset.from_list(lowercase    )
							self.assertDictEqual(dset[0]    , {'col_1': 1}    )
							self.assertDictEqual(dset[1]    , {'col_1': None}    )  # NB: first record is used for columns
			def    A_       (    self    ):  # checks if the type can be inferred from the second record
							_lowerCamelCase	:     str       =       [{'col_1': []}, {'col_1': [1, 2]}]
							_lowerCamelCase	:     Union[str, Any]       =       Dataset.from_list(lowercase    )
							self.assertEqual(dset.info.features['col_1']    , Sequence(Value('int64'    )    )    )






			def    A_       (    self    ):
							_lowerCamelCase	:     List[str]       =       Dataset.from_list([]    )
							self.assertEqual(len(lowercase    )    , 0    )
							self.assertListEqual(dset.column_names    , []    )





"""simple docstring"""






from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
			if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")):
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			from ...utils.dummy_torch_and_transformers_objects import (
			    VersatileDiffusionDualGuidedPipeline,
			    VersatileDiffusionImageVariationPipeline,
			    VersatileDiffusionPipeline,
			    VersatileDiffusionTextToImagePipeline,
			)
else:
			from .modeling_text_unet import UNetFlatConditionModel
			from .pipeline_versatile_diffusion import VersatileDiffusionPipeline
			from .pipeline_versatile_diffusion_dual_guided import VersatileDiffusionDualGuidedPipeline
			from .pipeline_versatile_diffusion_image_variation import VersatileDiffusionImageVariationPipeline
			from .pipeline_versatile_diffusion_text_to_image import VersatileDiffusionTextToImagePipeline