

'''simple docstring'''






import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible






class 			lowercase_	(unittest.TestCase      ):




  """simple docstring"""




  def 					SCREAMING_SNAKE_CASE      (      self   :     Union[str, Any]			):
   __lowercase							  = [
       '''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(lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     int			):
   __lowercase							  = [
       '''unet/diffusion_pytorch_model.bin''',
       '''unet/diffusion_pytorch_model.safetensors''',
   ]
   self.assertTrue(is_safetensors_compatible(lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     Any			):
   __lowercase							  = [
       '''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(lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     List[Any]			):
   __lowercase							  = [
       '''text_encoder/pytorch_model.bin''',
       '''text_encoder/model.safetensors''',
   ]
   self.assertTrue(is_safetensors_compatible(lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     List[str]			):
   __lowercase							  = [
       '''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(lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     Any			):
   __lowercase							  = [
       '''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''',
   ]
   __lowercase							  = '''fp16'''
   self.assertTrue(is_safetensors_compatible(lowercase__					,variant=lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     int			):
   __lowercase							  = [
       '''unet/diffusion_pytorch_model.fp16.bin''',
       '''unet/diffusion_pytorch_model.fp16.safetensors''',
   ]
   __lowercase							  = '''fp16'''
   self.assertTrue(is_safetensors_compatible(lowercase__					,variant=lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     Dict			):
   # pass variant but use the non-variant filenames
   __lowercase							  = [
       '''unet/diffusion_pytorch_model.bin''',
       '''unet/diffusion_pytorch_model.safetensors''',
   ]
   __lowercase							  = '''fp16'''
   self.assertTrue(is_safetensors_compatible(lowercase__					,variant=lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     int			):
   __lowercase							  = [
       '''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',
   ]
   __lowercase							  = '''fp16'''
   self.assertFalse(is_safetensors_compatible(lowercase__					,variant=lowercase__			)			)






  def 					SCREAMING_SNAKE_CASE      (      self   :     int			):
   __lowercase							  = [
       '''text_encoder/pytorch_model.fp16.bin''',
       '''text_encoder/model.fp16.safetensors''',
   ]
   __lowercase							  = '''fp16'''
   self.assertTrue(is_safetensors_compatible(lowercase__					,variant=lowercase__			)			)






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






  def 					SCREAMING_SNAKE_CASE      (      self   :     str			):
   __lowercase							  = [
       '''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''',
   ]
   __lowercase							  = '''fp16'''
   self.assertFalse(is_safetensors_compatible(lowercase__					,variant=lowercase__			)			)






"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_lowerCAmelCase    :List[Any]     =					{'configuration_opt': ['OPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'OPTConfig']}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCAmelCase    :Any     =					[
      'OPT_PRETRAINED_MODEL_ARCHIVE_LIST',
      'OPTForCausalLM',
      'OPTModel',
      'OPTPreTrainedModel',
      'OPTForSequenceClassification',
      'OPTForQuestionAnswering',
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCAmelCase    :Optional[int]     =					['TFOPTForCausalLM', 'TFOPTModel', 'TFOPTPreTrainedModel']

try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCAmelCase    :Any     =					[
      'FlaxOPTForCausalLM',
      'FlaxOPTModel',
      'FlaxOPTPreTrainedModel',
  ]


if TYPE_CHECKING:
  from .configuration_opt import OPT_PRETRAINED_CONFIG_ARCHIVE_MAP, OPTConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_opt import (
        OPT_PRETRAINED_MODEL_ARCHIVE_LIST,
        OPTForCausalLM,
        OPTForQuestionAnswering,
        OPTForSequenceClassification,
        OPTModel,
        OPTPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_opt import TFOPTForCausalLM, TFOPTModel, TFOPTPreTrainedModel

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_opt import FlaxOPTForCausalLM, FlaxOPTModel, FlaxOPTPreTrainedModel

else:
  import sys

  _lowerCAmelCase    :int     =					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


