





import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible



class     _UpperCAmelCase   (   unittest.TestCase   ):

  """simple docstring"""


  def     lowercase		(    self			:		str					)							->						Dict:
     __lowerCAmelCase							     =     [
         '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     lowercase		(    self			:		Tuple					)							->						Union[str, Any]:
     __lowerCAmelCase							     =     [
         'unet/diffusion_pytorch_model.bin',
         'unet/diffusion_pytorch_model.safetensors',
     ]
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_					)					)






  def     lowercase		(    self			:		Tuple					)							->						str:
     __lowerCAmelCase							     =     [
         '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     lowercase		(    self			:		Optional[Any]					)							->						List[Any]:
     __lowerCAmelCase							     =     [
         'text_encoder/pytorch_model.bin',
         'text_encoder/model.safetensors',
     ]
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_					)					)






  def     lowercase		(    self			:		Union[str, Any]					)							->						Dict:
     __lowerCAmelCase							     =     [
         '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     lowercase		(    self			:		Dict					)							->						str:
     __lowerCAmelCase							     =     [
         '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							     =     'fp16'
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)






  def     lowercase		(    self			:		int					)							->						Any:
     __lowerCAmelCase							     =     [
         'unet/diffusion_pytorch_model.fp16.bin',
         'unet/diffusion_pytorch_model.fp16.safetensors',
     ]
     __lowerCAmelCase							     =     'fp16'
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)






  def     lowercase		(    self			:		Optional[int]					)							->						List[str]:
     # pass variant but use the non-variant filenames
     __lowerCAmelCase							     =     [
         'unet/diffusion_pytorch_model.bin',
         'unet/diffusion_pytorch_model.safetensors',
     ]
     __lowerCAmelCase							     =     'fp16'
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)






  def     lowercase		(    self			:		List[str]					)							->						List[Any]:
     __lowerCAmelCase							     =     [
         '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							     =     'fp16'
     self.assertFalse(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)






  def     lowercase		(    self			:		Union[str, Any]					)							->						int:
     __lowerCAmelCase							     =     [
         'text_encoder/pytorch_model.fp16.bin',
         'text_encoder/model.fp16.safetensors',
     ]
     __lowerCAmelCase							     =     'fp16'
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)






  def     lowercase		(    self			:		str					)							->						List[str]:
     # pass variant but use the non-variant filenames
     __lowerCAmelCase							     =     [
         'text_encoder/pytorch_model.bin',
         'text_encoder/model.safetensors',
     ]
     __lowerCAmelCase							     =     'fp16'
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)






  def     lowercase		(    self			:		Optional[int]					)							->						Optional[int]:
     __lowerCAmelCase							     =     [
         '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							     =     'fp16'
     self.assertFalse(is_safetensors_compatible(lowerCAmelCase_ ,  variant=lowerCAmelCase_					)					)








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
)


_snake_case  :   Optional[Any]						   =  {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetConfig']}

try:
     if not is_sentencepiece_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _snake_case  :   int						   =  ['FNetTokenizer']

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _snake_case  :   Tuple						   =  ['FNetTokenizerFast']

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _snake_case  :   List[str]						   =  [
         'FNET_PRETRAINED_MODEL_ARCHIVE_LIST',
         'FNetForMaskedLM',
         'FNetForMultipleChoice',
         'FNetForNextSentencePrediction',
         'FNetForPreTraining',
         'FNetForQuestionAnswering',
         'FNetForSequenceClassification',
         'FNetForTokenClassification',
         'FNetLayer',
         'FNetModel',
         'FNetPreTrainedModel',
     ]


if TYPE_CHECKING:
     from .configuration_fnet import FNET_PRETRAINED_CONFIG_ARCHIVE_MAP, FNetConfig

     try:
          if not is_sentencepiece_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_fnet import FNetTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_fnet_fast import FNetTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_fnet import (
              FNET_PRETRAINED_MODEL_ARCHIVE_LIST,
              FNetForMaskedLM,
              FNetForMultipleChoice,
              FNetForNextSentencePrediction,
              FNetForPreTraining,
              FNetForQuestionAnswering,
              FNetForSequenceClassification,
              FNetForTokenClassification,
              FNetLayer,
              FNetModel,
              FNetPreTrainedModel,
          )


else:
     import sys

     _snake_case  :   str						   =  _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

