





'''simple docstring'''







# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase_					:    Optional[Any]      	=			{'configuration_timm_backbone': ['TimmBackboneConfig']}


try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase_					:    Optional[int]      	=			['TimmBackbone']


if TYPE_CHECKING:
					from .configuration_timm_backbone import TimmBackboneConfig

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_timm_backbone import TimmBackbone

else:
					import sys

					lowerCAmelCase_					:    Dict      	=			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)







'''simple docstring'''







import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible
class 				__SCREAMING_SNAKE_CASE  (unittest.TestCase      ):






				"""simple docstring"""







				def   UpperCamelCase__   (  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",
								    "unet/diffusion_pytorch_model.safetensors",
								]
								self.assertTrue(is_safetensors_compatible(__a					)					)




				def   UpperCamelCase__   (  self     :					List[str]					):
								_a								= [
								    "unet/diffusion_pytorch_model.bin",
								    "unet/diffusion_pytorch_model.safetensors",
								]
								self.assertTrue(is_safetensors_compatible(__a					)					)




				def   UpperCamelCase__   (  self     :					List[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(__a					)					)




				def   UpperCamelCase__   (  self     :					List[str]					):
								_a								= [
								    "text_encoder/pytorch_model.bin",
								    "text_encoder/model.safetensors",
								]
								self.assertTrue(is_safetensors_compatible(__a					)					)




				def   UpperCamelCase__   (  self     :					Optional[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",
								    # Removed: 'text_encoder/model.safetensors',
								    "unet/diffusion_pytorch_model.bin",
								    "unet/diffusion_pytorch_model.safetensors",
								]
								self.assertFalse(is_safetensors_compatible(__a					)					)




				def   UpperCamelCase__   (  self     :					str					):
								_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(__a					,				variant=__a					)					)




				def   UpperCamelCase__   (  self     :					Any					):
								_a								= [
								    "unet/diffusion_pytorch_model.fp16.bin",
								    "unet/diffusion_pytorch_model.fp16.safetensors",
								]
								_a								= "fp16"
								self.assertTrue(is_safetensors_compatible(__a					,				variant=__a					)					)




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




				def   UpperCamelCase__   (  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",
								    # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
								]
								_a								= "fp16"
								self.assertFalse(is_safetensors_compatible(__a					,				variant=__a					)					)




				def   UpperCamelCase__   (  self     :					Dict					):
								_a								= [
								    "text_encoder/pytorch_model.fp16.bin",
								    "text_encoder/model.fp16.safetensors",
								]
								_a								= "fp16"
								self.assertTrue(is_safetensors_compatible(__a					,				variant=__a					)					)




				def   UpperCamelCase__   (  self     :					List[str]					):
								# 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(__a					,				variant=__a					)					)




				def   UpperCamelCase__   (  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",
								    "unet/diffusion_pytorch_model.fp16.safetensors",
								]
								_a								= "fp16"
								self.assertFalse(is_safetensors_compatible(__a					,				variant=__a					)					)
