





"""simple docstring"""
import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible






class 					_UpperCAmelCase   (	unittest.TestCase ):


					def 	lowerCamelCase       (					self			:List[Any]		):
												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(__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:List[Any]		):
												A		=  [
												    "unet/diffusion_pytorch_model.bin",
												    "unet/diffusion_pytorch_model.safetensors",
												]
												self.assertTrue(is_safetensors_compatible(__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:str		):
												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(__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:Dict		):
												A		=  [
												    "text_encoder/pytorch_model.bin",
												    "text_encoder/model.safetensors",
												]
												self.assertTrue(is_safetensors_compatible(__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:Tuple		):
												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(__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:Optional[Any]		):
												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(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:List[str]		):
												A		=  [
												    "unet/diffusion_pytorch_model.fp16.bin",
												    "unet/diffusion_pytorch_model.fp16.safetensors",
												]
												A		=  "fp16"
												self.assertTrue(is_safetensors_compatible(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:str		):
												# 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(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:Optional[int]		):
												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(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:Optional[int]		):
												A		=  [
												    "text_encoder/pytorch_model.fp16.bin",
												    "text_encoder/model.fp16.safetensors",
												]
												A		=  "fp16"
												self.assertTrue(is_safetensors_compatible(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:Any		):
												# 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(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)


					def 	lowerCamelCase       (					self			:List[Any]		):
												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(__UpperCamelCase     ,       variant=__UpperCamelCase		)		)









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

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


_snake_case     :		Union[str, Any]       						= {
    'configuration_encodec': [
        'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'EncodecConfig',
    ],
    'feature_extraction_encodec': ['EncodecFeatureExtractor'],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_snake_case     :		int       						= [
		    'ENCODEC_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'EncodecModel',
		    'EncodecPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_encodec import (
		    ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    EncodecConfig,
		)
		from .feature_extraction_encodec import EncodecFeatureExtractor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_encodec import (
				    ENCODEC_PRETRAINED_MODEL_ARCHIVE_LIST,
				    EncodecModel,
				    EncodecPreTrainedModel,
				)

else:
		import sys

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


