import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible






class    SCREAMING_SNAKE_CASE			(							unittest.TestCase					):





							def 						UpperCamelCase_					(   self		:		List[str]	):

											'''simple docstring'''
											__a       =		[
											    """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(lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		Union[str, Any]	):

											'''simple docstring'''
											__a       =		[
											    """unet/diffusion_pytorch_model.bin""",
											    """unet/diffusion_pytorch_model.safetensors""",
											]
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		List[str]	):

											'''simple docstring'''
											__a       =		[
											    """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(lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		List[Any]	):

											'''simple docstring'''
											__a       =		[
											    """text_encoder/pytorch_model.bin""",
											    """text_encoder/model.safetensors""",
											]
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		Dict	):

											'''simple docstring'''
											__a       =		[
											    """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(lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		Any	):

											'''simple docstring'''
											__a       =		[
											    """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""",
											]
											__a       =		"""fp16"""
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		Tuple	):

											'''simple docstring'''
											__a       =		[
											    """unet/diffusion_pytorch_model.fp16.bin""",
											    """unet/diffusion_pytorch_model.fp16.safetensors""",
											]
											__a       =		"""fp16"""
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		int	):

											'''simple docstring'''
											# pass variant but use the non-variant filenames
											__a       =		[
											    """unet/diffusion_pytorch_model.bin""",
											    """unet/diffusion_pytorch_model.safetensors""",
											]
											__a       =		"""fp16"""
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		Any	):

											'''simple docstring'''
											__a       =		[
											    """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',
											]
											__a       =		"""fp16"""
											self.assertFalse(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		str	):

											'''simple docstring'''
											__a       =		[
											    """text_encoder/pytorch_model.fp16.bin""",
											    """text_encoder/model.fp16.safetensors""",
											]
											__a       =		"""fp16"""
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)





							def 						UpperCamelCase_					(   self		:		int	):

											'''simple docstring'''
											# pass variant but use the non-variant filenames
											__a       =		[
											    """text_encoder/pytorch_model.bin""",
											    """text_encoder/model.safetensors""",
											]
											__a       =		"""fp16"""
											self.assertTrue(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)







							def 						UpperCamelCase_					(   self		:		List[Any]	):

											'''simple docstring'''
											__a       =		[
											    """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""",
											]
											__a       =		"""fp16"""
											self.assertFalse(is_safetensors_compatible(lowerCAmelCase_      ,				variant=lowerCAmelCase_	)	)





def   lowerCAmelCase__						(							_SCREAMING_SNAKE_CASE       :			Tuple				,     _SCREAMING_SNAKE_CASE       :			Tuple				,     _SCREAMING_SNAKE_CASE       :			Tuple=False    ):
				"""simple docstring"""







				if isinstance(_SCREAMING_SNAKE_CASE				,     _SCREAMING_SNAKE_CASE    ) and isinstance(_SCREAMING_SNAKE_CASE				,     _SCREAMING_SNAKE_CASE    ):
								__a       =		len(set_a.intersection(_SCREAMING_SNAKE_CASE    )    )

								if alternative_union:
												__a       =		len(_SCREAMING_SNAKE_CASE    ) + len(_SCREAMING_SNAKE_CASE    )
								else:
												__a       =		len(set_a.union(_SCREAMING_SNAKE_CASE    )    )

								return intersection / union

				if isinstance(_SCREAMING_SNAKE_CASE				,     (list, tuple)    ) and isinstance(_SCREAMING_SNAKE_CASE				,     (list, tuple)    ):
								__a       =		[element for element in set_a if element in set_b]

								if alternative_union:
												__a       =		len(_SCREAMING_SNAKE_CASE    ) + len(_SCREAMING_SNAKE_CASE    )
												return len(_SCREAMING_SNAKE_CASE    ) / union
								else:
												__a       =		set_a + [element for element in set_b if element not in set_a]
												return len(_SCREAMING_SNAKE_CASE    ) / len(_SCREAMING_SNAKE_CASE    )

								return len(_SCREAMING_SNAKE_CASE    ) / len(_SCREAMING_SNAKE_CASE    )
				return None


if __name__ == "__main__":
						lowerCamelCase__			= {"""a""", """b""", """c""", """d""", """e"""}
						lowerCamelCase__			= {"""c""", """d""", """e""", """f""", """h""", """i"""}
						print(jaccard_similarity(set_a, set_b))
