





import gc
import unittest

import torch
from parameterized import parameterized

from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import enable_full_determinism

from .test_modeling_common import ModelTesterMixin, UNetTesterMixin


enable_full_determinism()

class      A       (	_A		,      _A		,      unittest.TestCase						):
      _snake_case							     =AutoencoderKL
      _snake_case							     ='''sample'''
      _snake_case							     =1E-2



      @property
      def 	lowerCAmelCase__    (	self:						List[str]       )						->    int:
         '''simple docstring'''

         UpperCAmelCase_											=4
         UpperCAmelCase_											=3
         UpperCAmelCase_											=(32, 32)

         UpperCAmelCase_											=floats_tensor((batch_size, num_channels) + sizes       ).to(_lowerCAmelCase       )

         return {"sample": image}



      @property
      def 	lowerCAmelCase__    (	self:						Any       )						->    str:
         '''simple docstring'''

         return (3, 32, 32)



      @property
      def 	lowerCAmelCase__    (	self:						List[Any]       )						->    Union[str, Any]:
         '''simple docstring'''

         return (3, 32, 32)



      def 	lowerCAmelCase__    (	self:						Union[str, Any]       )						->    List[Any]:
         '''simple docstring'''

         UpperCAmelCase_											={
             "block_out_channels": [32, 64],
             "in_channels": 3,
             "out_channels": 3,
             "down_block_types": ["DownEncoderBlock2D", "DownEncoderBlock2D"],
             "up_block_types": ["UpDecoderBlock2D", "UpDecoderBlock2D"],
             "latent_channels": 4,
         }
         UpperCAmelCase_											=self.dummy_input
         return init_dict, inputs_dict



      def 	lowerCAmelCase__    (	self:						Optional[Any]       )						->    Union[str, Any]:
         '''simple docstring'''

         pass



      def 	lowerCAmelCase__    (	self:						List[Any]       )						->    List[str]:
         '''simple docstring'''

         pass



      @unittest.skipIf(torch_device == "mps"		,  "Gradient checkpointing skipped on MPS"       )
      def 	lowerCAmelCase__    (	self:						Tuple       )						->    List[str]:
         '''simple docstring'''

         UpperCAmelCase_											=self.prepare_init_args_and_inputs_for_common()
         UpperCAmelCase_											=self.model_class(**_lowerCAmelCase       )
         model.to(_lowerCAmelCase       )

         assert not model.is_gradient_checkpointing and model.training

         UpperCAmelCase_											=model(**_lowerCAmelCase       ).sample
         # run the backwards pass on the model. For backwards pass, for simplicity purpose,
         # we won't calculate the loss and rather backprop on out.sum()
         model.zero_grad()

         UpperCAmelCase_											=torch.randn_like(_lowerCAmelCase       )
         UpperCAmelCase_											=(out - labels).mean()
         loss.backward()

         # re-instantiate the model now enabling gradient checkpointing
         UpperCAmelCase_											=self.model_class(**_lowerCAmelCase       )
         # clone model
         model_a.load_state_dict(model.state_dict()       )
         model_a.to(_lowerCAmelCase       )
         model_a.enable_gradient_checkpointing()

         assert model_a.is_gradient_checkpointing and model_a.training

         UpperCAmelCase_											=model_a(**_lowerCAmelCase       ).sample
         # run the backwards pass on the model. For backwards pass, for simplicity purpose,
         # we won't calculate the loss and rather backprop on out.sum()
         model_a.zero_grad()
         UpperCAmelCase_											=(out_a - labels).mean()
         loss_a.backward()

         # compare the output and parameters gradients
         self.assertTrue((loss - loss_a).abs() < 1e-5       )
         UpperCAmelCase_											=dict(model.named_parameters()       )
         UpperCAmelCase_											=dict(model_a.named_parameters()       )
         for name, param in named_params.items():
            self.assertTrue(torch_all_close(param.grad.data		,  named_params_a[name].grad.data		,  atol=5e-5       )       )



      def 	lowerCAmelCase__    (	self:						int       )						->    Optional[int]:
         '''simple docstring'''

         UpperCAmelCase_											=AutoencoderKL.from_pretrained("fusing/autoencoder-kl-dummy"		,  output_loading_info=_lowerCAmelCase       )
         self.assertIsNotNone(_lowerCAmelCase       )
         self.assertEqual(len(loading_info["missing_keys"]       )		,  0       )

         model.to(_lowerCAmelCase       )
         UpperCAmelCase_											=model(**self.dummy_input       )

         assert image is not None, "Make sure output is not None"






      def 	lowerCAmelCase__    (	self:						List[str]       )						->    Union[str, Any]:
         '''simple docstring'''

         UpperCAmelCase_											=AutoencoderKL.from_pretrained("fusing/autoencoder-kl-dummy"       )
         UpperCAmelCase_											=model.to(_lowerCAmelCase       )
         model.eval()

         if torch_device == "mps":
            UpperCAmelCase_											=torch.manual_seed(0       )
         else:
            UpperCAmelCase_											=torch.Generator(device=_lowerCAmelCase       ).manual_seed(0       )

         UpperCAmelCase_											=torch.randn(
             1		,  model.config.in_channels		,  model.config.sample_size		,  model.config.sample_size		,  generator=torch.manual_seed(0       )		,  )
         UpperCAmelCase_											=image.to(_lowerCAmelCase       )
         with torch.no_grad():
            UpperCAmelCase_											=model(_lowerCAmelCase		,  sample_posterior=_lowerCAmelCase		,  generator=_lowerCAmelCase       ).sample

         UpperCAmelCase_											=output[0, -1, -3:, -3:].flatten().cpu()

         # Since the VAE Gaussian prior's generator is seeded on the appropriate device,
         # the expected output slices are not the same for CPU and GPU.
         if torch_device == "mps":
            UpperCAmelCase_											=torch.tensor(
                [
                    -4.0_078e-01,
                    -3.8_323e-04,
                    -1.2_681e-01,
                    -1.1_462e-01,
                    2.0_095e-01,
                    1.0_893e-01,
                    -8.8_247e-02,
                    -3.0_361e-01,
                    -9.8_644e-03,
                ]       )
         elif torch_device == "cpu":
            UpperCAmelCase_											=torch.tensor(
                [-0.13_52, 0.08_78, 0.04_19, -0.08_18, -0.10_69, 0.06_88, -0.14_58, -0.44_46, -0.00_26]       )
         else:
            UpperCAmelCase_											=torch.tensor(
                [-0.24_21, 0.46_42, 0.25_07, -0.04_38, 0.06_82, 0.31_60, -0.20_18, -0.07_27, 0.24_85]       )

         self.assertTrue(torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  rtol=1e-2       )       )

@slow
class      A       (	unittest.TestCase						):



      def 	lowerCAmelCase__    (	self:						Tuple		,  _lowerCAmelCase:						List[Any]		,  _lowerCAmelCase:						Dict       )						->    str:
         '''simple docstring'''

         return F'gaussian_noise_s={seed}_shape={"_".join([str(_lowerCAmelCase       ) for s in shape]       )}.npy'



      def 	lowerCAmelCase__    (	self:						Tuple       )						->    Optional[Any]:
         '''simple docstring'''

         super().tearDown()
         gc.collect()
         torch.cuda.empty_cache()



      def 	lowerCAmelCase__    (	self:						Tuple		,  _lowerCAmelCase:						Union[str, Any]=0		,  _lowerCAmelCase:						Union[str, Any]=(4, 3, 512, 512)		,  _lowerCAmelCase:						Optional[int]=False       )						->    Optional[int]:
         '''simple docstring'''

         UpperCAmelCase_											=torch.floataa if fpaa else torch.floataa
         UpperCAmelCase_											=torch.from_numpy(load_hf_numpy(self.get_file_format(_lowerCAmelCase		,  _lowerCAmelCase       )       )       ).to(_lowerCAmelCase       ).to(_lowerCAmelCase       )
         return image



      def 	lowerCAmelCase__    (	self:						Optional[int]		,  _lowerCAmelCase:						Optional[Any]="CompVis/stable-diffusion-v1-4"		,  _lowerCAmelCase:						Tuple=False       )						->    Dict:
         '''simple docstring'''

         UpperCAmelCase_											="fp16" if fpaa else None
         UpperCAmelCase_											=torch.floataa if fpaa else torch.floataa

         UpperCAmelCase_											=AutoencoderKL.from_pretrained(
             _lowerCAmelCase		,  subfolder="vae"		,  torch_dtype=_lowerCAmelCase		,  revision=_lowerCAmelCase		,  )
         model.to(_lowerCAmelCase       ).eval()

         return model



      def 	lowerCAmelCase__    (	self:						int		,  _lowerCAmelCase:						Optional[Any]=0       )						->    List[Any]:
         '''simple docstring'''

         if torch_device == "mps":
            return torch.manual_seed(_lowerCAmelCase       )
         return torch.Generator(device=_lowerCAmelCase       ).manual_seed(_lowerCAmelCase       )



      @parameterized.expand(
          [
              # fmt: off
              [33, [-0.16_03, 0.98_78, -0.04_95, -0.07_90, -0.27_09, 0.83_75, -0.20_60, -0.08_24], [-0.23_95, 0.00_98, 0.01_02, -0.07_09, -0.28_40, -0.02_74, -0.07_18, -0.18_24]],
              [47, [-0.23_76, 0.11_68, 0.13_32, -0.48_40, -0.25_08, -0.07_91, -0.04_93, -0.40_89], [0.03_50, 0.08_47, 0.04_67, 0.03_44, -0.08_42, -0.05_47, -0.06_33, -0.11_31]],
              # fmt: on
          ]       )
      def 	lowerCAmelCase__    (	self:						Optional[Any]		,  _lowerCAmelCase:						str		,  _lowerCAmelCase:						int		,  _lowerCAmelCase:						str       )						->    int:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model()
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase       )
         UpperCAmelCase_											=self.get_generator(_lowerCAmelCase       )

         with torch.no_grad():
            UpperCAmelCase_											=model(_lowerCAmelCase		,  generator=_lowerCAmelCase		,  sample_posterior=_lowerCAmelCase       ).sample

         assert sample.shape == image.shape

         UpperCAmelCase_											=sample[-1, -2:, -2:, :2].flatten().float().cpu()
         UpperCAmelCase_											=torch.tensor(expected_slice_mps if torch_device == "mps" else expected_slice       )

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=3e-3       )



      @parameterized.expand(
          [
              # fmt: off
              [33, [-0.05_13, 0.02_89, 1.37_99, 0.21_66, -0.25_73, -0.08_71, 0.51_03, -0.09_99]],
              [47, [-0.41_28, -0.13_20, -0.37_04, 0.19_65, -0.41_16, -0.23_32, -0.33_40, 0.22_47]],
              # fmt: on
          ]       )
      @require_torch_gpu
      def 	lowerCAmelCase__    (	self:						Union[str, Any]		,  _lowerCAmelCase:						Any		,  _lowerCAmelCase:						str       )						->    int:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model(fpaa=_lowerCAmelCase       )
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase		,  fpaa=_lowerCAmelCase       )
         UpperCAmelCase_											=self.get_generator(_lowerCAmelCase       )

         with torch.no_grad():
            UpperCAmelCase_											=model(_lowerCAmelCase		,  generator=_lowerCAmelCase		,  sample_posterior=_lowerCAmelCase       ).sample

         assert sample.shape == image.shape

         UpperCAmelCase_											=sample[-1, -2:, :2, -2:].flatten().float().cpu()
         UpperCAmelCase_											=torch.tensor(_lowerCAmelCase       )

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=1e-2       )



      @parameterized.expand(
          [
              # fmt: off
              [33, [-0.16_09, 0.98_66, -0.04_87, -0.07_77, -0.27_16, 0.83_68, -0.20_55, -0.08_14], [-0.23_95, 0.00_98, 0.01_02, -0.07_09, -0.28_40, -0.02_74, -0.07_18, -0.18_24]],
              [47, [-0.23_77, 0.11_47, 0.13_33, -0.48_41, -0.25_06, -0.08_05, -0.04_91, -0.40_85], [0.03_50, 0.08_47, 0.04_67, 0.03_44, -0.08_42, -0.05_47, -0.06_33, -0.11_31]],
              # fmt: on
          ]       )
      def 	lowerCAmelCase__    (	self:						Optional[int]		,  _lowerCAmelCase:						Optional[Any]		,  _lowerCAmelCase:						Any		,  _lowerCAmelCase:						str       )						->    List[Any]:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model()
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase       )

         with torch.no_grad():
            UpperCAmelCase_											=model(_lowerCAmelCase       ).sample

         assert sample.shape == image.shape

         UpperCAmelCase_											=sample[-1, -2:, -2:, :2].flatten().float().cpu()
         UpperCAmelCase_											=torch.tensor(expected_slice_mps if torch_device == "mps" else expected_slice       )

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=3e-3       )



      @parameterized.expand(
          [
              # fmt: off
              [13, [-0.20_51, -0.18_03, -0.23_11, -0.21_14, -0.32_92, -0.35_74, -0.29_53, -0.33_23]],
              [37, [-0.26_32, -0.26_25, -0.21_99, -0.27_41, -0.45_39, -0.49_90, -0.37_20, -0.49_25]],
              # fmt: on
          ]       )
      @require_torch_gpu
      def 	lowerCAmelCase__    (	self:						Any		,  _lowerCAmelCase:						str		,  _lowerCAmelCase:						str       )						->    str:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model()
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase		,  shape=(3, 4, 64, 64)       )

         with torch.no_grad():
            UpperCAmelCase_											=model.decode(_lowerCAmelCase       ).sample

         assert list(sample.shape       ) == [3, 3, 512, 512]

         UpperCAmelCase_											=sample[-1, -2:, :2, -2:].flatten().cpu()
         UpperCAmelCase_											=torch.tensor(_lowerCAmelCase       )

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=1e-3       )



      @parameterized.expand(
          [
              # fmt: off
              [27, [-0.03_69, 0.02_07, -0.07_76, -0.06_82, -0.17_47, -0.19_30, -0.14_65, -0.20_39]],
              [16, [-0.16_28, -0.21_34, -0.27_47, -0.26_42, -0.37_74, -0.44_04, -0.36_87, -0.42_77]],
              # fmt: on
          ]       )
      @require_torch_gpu
      def 	lowerCAmelCase__    (	self:						List[str]		,  _lowerCAmelCase:						List[str]		,  _lowerCAmelCase:						List[Any]       )						->    Optional[Any]:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model(fpaa=_lowerCAmelCase       )
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase		,  shape=(3, 4, 64, 64)		,  fpaa=_lowerCAmelCase       )

         with torch.no_grad():
            UpperCAmelCase_											=model.decode(_lowerCAmelCase       ).sample

         assert list(sample.shape       ) == [3, 3, 512, 512]

         UpperCAmelCase_											=sample[-1, -2:, :2, -2:].flatten().float().cpu()
         UpperCAmelCase_											=torch.tensor(_lowerCAmelCase       )

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=5e-3       )



      @parameterized.expand([(13,), (16,), (27,)]       )
      @require_torch_gpu
      @unittest.skipIf(not is_xformers_available()		,  reason="xformers is not required when using PyTorch 2.0."       )
      def 	lowerCAmelCase__    (	self:						Optional[Any]		,  _lowerCAmelCase:						Union[str, Any]       )						->    Union[str, Any]:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model(fpaa=_lowerCAmelCase       )
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase		,  shape=(3, 4, 64, 64)		,  fpaa=_lowerCAmelCase       )

         with torch.no_grad():
            UpperCAmelCase_											=model.decode(_lowerCAmelCase       ).sample

         model.enable_xformers_memory_efficient_attention()
         with torch.no_grad():
            UpperCAmelCase_											=model.decode(_lowerCAmelCase       ).sample

         assert list(sample.shape       ) == [3, 3, 512, 512]

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=1e-1       )



      @parameterized.expand([(13,), (16,), (37,)]       )
      @require_torch_gpu
      @unittest.skipIf(not is_xformers_available()		,  reason="xformers is not required when using PyTorch 2.0."       )
      def 	lowerCAmelCase__    (	self:						Dict		,  _lowerCAmelCase:						Optional[Any]       )						->    Optional[Any]:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model()
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase		,  shape=(3, 4, 64, 64)       )

         with torch.no_grad():
            UpperCAmelCase_											=model.decode(_lowerCAmelCase       ).sample

         model.enable_xformers_memory_efficient_attention()
         with torch.no_grad():
            UpperCAmelCase_											=model.decode(_lowerCAmelCase       ).sample

         assert list(sample.shape       ) == [3, 3, 512, 512]

         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=1e-2       )






      @parameterized.expand(
          [
              # fmt: off
              [33, [-0.30_01, 0.09_18, -2.69_84, -3.97_20, -3.20_99, -5.03_53, 1.73_38, -0.20_65, 3.42_67]],
              [47, [-1.50_30, -4.38_71, -6.03_55, -9.11_57, -1.66_61, -2.78_53, 2.16_07, -5.08_23, 2.56_33]],
              # fmt: on
          ]       )
      def 	lowerCAmelCase__    (	self:						Union[str, Any]		,  _lowerCAmelCase:						List[str]		,  _lowerCAmelCase:						List[str]       )						->    List[str]:
         '''simple docstring'''

         UpperCAmelCase_											=self.get_sd_vae_model()
         UpperCAmelCase_											=self.get_sd_image(_lowerCAmelCase       )
         UpperCAmelCase_											=self.get_generator(_lowerCAmelCase       )

         with torch.no_grad():
            UpperCAmelCase_											=model.encode(_lowerCAmelCase       ).latent_dist
            UpperCAmelCase_											=dist.sample(generator=_lowerCAmelCase       )

         assert list(sample.shape       ) == [image.shape[0], 4] + [i // 8 for i in image.shape[2:]]

         UpperCAmelCase_											=sample[0, -1, -3:, -3:].flatten().cpu()
         UpperCAmelCase_											=torch.tensor(_lowerCAmelCase       )

         UpperCAmelCase_											=3e-3 if torch_device != "mps" else 1e-2
         assert torch_all_close(_lowerCAmelCase		,  _lowerCAmelCase		,  atol=_lowerCAmelCase       )











from collections import Counter
from pathlib import Path
from typing import Optional, Tuple

import yaml

class      A       (	yaml.SafeLoader						):



      def 	lowerCAmelCase__    (	self:						Optional[Any]		,  _lowerCAmelCase:						int       )						->    Optional[int]:
         '''simple docstring'''

         UpperCAmelCase_											=[self.constructed_objects[key_node] for key_node, _ in node.value]
         UpperCAmelCase_											=[tuple(_lowerCAmelCase       ) if isinstance(_lowerCAmelCase		,  _lowerCAmelCase       ) else key for key in keys]
         UpperCAmelCase_											=Counter(_lowerCAmelCase       )
         UpperCAmelCase_											=[key for key in counter if counter[key] > 1]
         if duplicate_keys:
            raise TypeError(F'Got duplicate yaml keys: {duplicate_keys}'       )






      def 	lowerCAmelCase__    (	self:						Dict		,  _lowerCAmelCase:						List[str]		,  _lowerCAmelCase:						Optional[Any]=False       )						->    int:
         '''simple docstring'''

         UpperCAmelCase_											=super().construct_mapping(_lowerCAmelCase		,  deep=_lowerCAmelCase       )
         self._check_no_duplicates_on_constructed_node(_lowerCAmelCase       )
         return mapping




def     a__ (					lowercase__  ):






   '''simple docstring'''






   UpperCAmelCase_											=list(readme_content.splitlines()  )
   if full_content and full_content[0] == "---" and "---" in full_content[1:]:
      UpperCAmelCase_											=full_content[1:].index("---"  ) + 1
      UpperCAmelCase_											="\n".join(full_content[1:sep_idx]  )
      return yamlblock, "\n".join(full_content[sep_idx + 1 :]  )

   return None, "\n".join(lowercase__  )

class      A       (	__lowercase						):
      # class attributes
      _snake_case							     ={'''train_eval_index'''}  # train-eval-index in the YAML metadata



      @classmethod
      def 	lowerCAmelCase__    (	cls:						Any		,  _lowerCAmelCase:						Path       )						->    "DatasetMetadata":
         '''simple docstring'''

         with open(_lowerCAmelCase		,  encoding="utf-8"       ) as readme_file:
            UpperCAmelCase_						,       UpperCAmelCase_											=_split_yaml_from_readme(readme_file.read()       )
         if yaml_string is not None:
            return cls.from_yaml_string(_lowerCAmelCase       )
         else:
            return cls()



      def 	lowerCAmelCase__    (	self:						Dict		,  _lowerCAmelCase:						Path       )						->    List[str]:
         '''simple docstring'''

         if path.exists():
            with open(_lowerCAmelCase		,  encoding="utf-8"       ) as readme_file:
               UpperCAmelCase_											=readme_file.read()
         else:
            UpperCAmelCase_											=None
         UpperCAmelCase_											=self._to_readme(_lowerCAmelCase       )
         with open(_lowerCAmelCase		,  "w"		,  encoding="utf-8"       ) as readme_file:
            readme_file.write(_lowerCAmelCase       )



      def 	lowerCAmelCase__    (	self:						str		,  _lowerCAmelCase:						Optional[str] = None       )						->    str:
         '''simple docstring'''

         if readme_content is not None:
            UpperCAmelCase_						,       UpperCAmelCase_											=_split_yaml_from_readme(_lowerCAmelCase       )
            UpperCAmelCase_											="---\n" + self.to_yaml_string() + "---\n" + content
         else:
            UpperCAmelCase_											="---\n" + self.to_yaml_string() + "---\n"
         return full_content



      @classmethod
      def 	lowerCAmelCase__    (	cls:						Optional[Any]		,  _lowerCAmelCase:						str       )						->    "DatasetMetadata":
         '''simple docstring'''

         UpperCAmelCase_											=yaml.load(_lowerCAmelCase		,  Loader=_NoDuplicateSafeLoader       ) or {}

         # Convert the YAML keys to DatasetMetadata fields
         UpperCAmelCase_											={
             (key.replace("-"		,  "_"       ) if key.replace("-"		,  "_"       ) in cls._FIELDS_WITH_DASHES else key): value
             for key, value in metadata_dict.items()
         }
         return cls(**_lowerCAmelCase       )






      def 	lowerCAmelCase__    (	self:						int       )						->    str:
         '''simple docstring'''

         return yaml.safe_dump(
             {
                 (key.replace("_"		,  "-"       ) if key in self._FIELDS_WITH_DASHES else key): value
                 for key, value in self.items()
             }		,  sort_keys=_lowerCAmelCase		,  allow_unicode=_lowerCAmelCase		,  encoding="utf-8"		,  ).decode("utf-8"       )

__lowercase  :   int						      ={
    """image-classification""": [],
    """translation""": [],
    """image-segmentation""": [],
    """fill-mask""": [],
    """automatic-speech-recognition""": [],
    """token-classification""": [],
    """sentence-similarity""": [],
    """audio-classification""": [],
    """question-answering""": [],
    """summarization""": [],
    """zero-shot-classification""": [],
    """table-to-text""": [],
    """feature-extraction""": [],
    """other""": [],
    """multiple-choice""": [],
    """text-classification""": [],
    """text-to-image""": [],
    """text2text-generation""": [],
    """zero-shot-image-classification""": [],
    """tabular-classification""": [],
    """tabular-regression""": [],
    """image-to-image""": [],
    """tabular-to-text""": [],
    """unconditional-image-generation""": [],
    """text-retrieval""": [],
    """text-to-speech""": [],
    """object-detection""": [],
    """audio-to-audio""": [],
    """text-generation""": [],
    """conversational""": [],
    """table-question-answering""": [],
    """visual-question-answering""": [],
    """image-to-text""": [],
    """reinforcement-learning""": [],
    """voice-activity-detection""": [],
    """time-series-forecasting""": [],
    """document-question-answering""": [],
}


if __name__ == "__main__":
     from argparse import ArgumentParser

     __lowercase  :   List[Any]						      =ArgumentParser(usage="""Validate the yaml metadata block of a README.md file.""")
     ap.add_argument("""readme_filepath""")
     __lowercase  :   int						      =ap.parse_args()

     __lowercase  :   Optional[int]						      =Path(args.readme_filepath)
     __lowercase  :   Tuple						      =DatasetMetadata.from_readme(readme_filepath)
     print(dataset_metadata)
     dataset_metadata.to_readme(readme_filepath)




