
import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible





class 							A__		(	unittest.TestCase):
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	int							=      [
           """safety_checker/pytorch_model.bin""",
           """safety_checker/model.safetensors""",
           """vae/diffusion_pytorch_model.bin""",
           """vae/diffusion_pytorch_model.safetensors""",
           """text_encoder/pytorch_model.bin""",
           """text_encoder/model.safetensors""",
           """unet/diffusion_pytorch_model.bin""",
           """unet/diffusion_pytorch_model.safetensors""",
       ]
       self.assertTrue(is_safetensors_compatible(__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	List[Any]							=      [
           """unet/diffusion_pytorch_model.bin""",
           """unet/diffusion_pytorch_model.safetensors""",
       ]
       self.assertTrue(is_safetensors_compatible(__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Tuple							=      [
           """safety_checker/pytorch_model.bin""",
           """safety_checker/model.safetensors""",
           """vae/diffusion_pytorch_model.bin""",
           """vae/diffusion_pytorch_model.safetensors""",
           """text_encoder/pytorch_model.bin""",
           """text_encoder/model.safetensors""",
           """unet/diffusion_pytorch_model.bin""",
           # Removed: 'unet/diffusion_pytorch_model.safetensors',
       ]
       self.assertFalse(is_safetensors_compatible(__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Dict							=      [
           """text_encoder/pytorch_model.bin""",
           """text_encoder/model.safetensors""",
       ]
       self.assertTrue(is_safetensors_compatible(__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	int							=      [
           """safety_checker/pytorch_model.bin""",
           """safety_checker/model.safetensors""",
           """vae/diffusion_pytorch_model.bin""",
           """vae/diffusion_pytorch_model.safetensors""",
           """text_encoder/pytorch_model.bin""",
           # Removed: 'text_encoder/model.safetensors',
           """unet/diffusion_pytorch_model.bin""",
           """unet/diffusion_pytorch_model.safetensors""",
       ]
       self.assertFalse(is_safetensors_compatible(__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	List[Any]							=      [
           """safety_checker/pytorch_model.fp16.bin""",
           """safety_checker/model.fp16.safetensors""",
           """vae/diffusion_pytorch_model.fp16.bin""",
           """vae/diffusion_pytorch_model.fp16.safetensors""",
           """text_encoder/pytorch_model.fp16.bin""",
           """text_encoder/model.fp16.safetensors""",
           """unet/diffusion_pytorch_model.fp16.bin""",
           """unet/diffusion_pytorch_model.fp16.safetensors""",
       ]
       lowerCamelCase		:	List[str]							=      """fp16"""
       self.assertTrue(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Any							=      [
           """unet/diffusion_pytorch_model.fp16.bin""",
           """unet/diffusion_pytorch_model.fp16.safetensors""",
       ]
       lowerCamelCase		:	str							=      """fp16"""
       self.assertTrue(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       # pass variant but use the non-variant filenames
       lowerCamelCase		:	Tuple							=      [
           """unet/diffusion_pytorch_model.bin""",
           """unet/diffusion_pytorch_model.safetensors""",
       ]
       lowerCamelCase		:	Union[str, Any]							=      """fp16"""
       self.assertTrue(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Tuple							=      [
           """safety_checker/pytorch_model.fp16.bin""",
           """safety_checker/model.fp16.safetensors""",
           """vae/diffusion_pytorch_model.fp16.bin""",
           """vae/diffusion_pytorch_model.fp16.safetensors""",
           """text_encoder/pytorch_model.fp16.bin""",
           """text_encoder/model.fp16.safetensors""",
           """unet/diffusion_pytorch_model.fp16.bin""",
           # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
       ]
       lowerCamelCase		:	Optional[int]							=      """fp16"""
       self.assertFalse(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Optional[int]							=      [
           """text_encoder/pytorch_model.fp16.bin""",
           """text_encoder/model.fp16.safetensors""",
       ]
       lowerCamelCase		:	Optional[Any]							=      """fp16"""
       self.assertTrue(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )
      def 						UpperCamelCase__							(      self      ):
       # pass variant but use the non-variant filenames
       lowerCamelCase		:	Optional[Any]							=      [
           """text_encoder/pytorch_model.bin""",
           """text_encoder/model.safetensors""",
       ]
       lowerCamelCase		:	Optional[int]							=      """fp16"""
       self.assertTrue(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )






      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Dict							=      [
           """safety_checker/pytorch_model.fp16.bin""",
           """safety_checker/model.fp16.safetensors""",
           """vae/diffusion_pytorch_model.fp16.bin""",
           """vae/diffusion_pytorch_model.fp16.safetensors""",
           """text_encoder/pytorch_model.fp16.bin""",
           # 'text_encoder/model.fp16.safetensors',
           """unet/diffusion_pytorch_model.fp16.bin""",
           """unet/diffusion_pytorch_model.fp16.safetensors""",
       ]
       lowerCamelCase		:	Optional[Any]							=      """fp16"""
       self.assertFalse(is_safetensors_compatible(__magic_name__    ,  variant=__magic_name__      )      )






_lowerCamelCase					   ={
    "joule": 1.0,
    "kilojoule": 1_0_0_0,
    "megajoule": 1_0_0_0_0_0_0,
    "gigajoule": 1_0_0_0_0_0_0_0_0_0,
    "wattsecond": 1.0,
    "watthour": 3_6_0_0,
    "kilowatthour": 3_6_0_0_0_0_0,
    "newtonmeter": 1.0,
    "calorie_nutr": 4_1_8_6.8,
    "kilocalorie_nutr": 4_1_8_6_8_0_0.0_0,
    "electronvolt": 1.6_0_2_1_7_6_6_3_4E-1_9,
    "britishthermalunit_it": 1_0_5_5.0_5_5_8_5,
    "footpound": 1.355818,
}





def     _a					(						lowerCamelCase,	lowerCamelCase,	lowerCamelCase							):
 if to_type not in ENERGY_CONVERSION or from_type not in ENERGY_CONVERSION:
  lowerCamelCase		:	Dict							=      (
      F'''Incorrect \'from_type\' or \'to_type\' value: {from_type!r}, {to_type!r}\n'''
      F'''Valid values are: {", ".join(lowerCamelCase							)}'''
  )
  raise ValueError(lowerCamelCase							)
 return value * ENERGY_CONVERSION[from_type] / ENERGY_CONVERSION[to_type]


if __name__ == "__main__":
      import doctest

      doctest.testmod()




