


import unittest
from dataclasses import dataclass
from typing import List, Union

import numpy as np
import PIL.Image

from diffusers.utils.outputs import BaseOutput





@dataclass
class 					snake_case__  ( __A       ):
	UpperCAmelCase   :							Union[List[PIL.Image.Image], np.ndarray]





class 					snake_case__  ( unittest.TestCase       ):





	def     A				(  self							)		->			Union[str, Any]:
								"""simple docstring"""






								a_       :   List[str]			=	CustomOutput(images=np.random.rand(1				,    3				,    4				,    4							)							)

								# check every way of getting the attribute
								assert isinstance(outputs.images				,    np.ndarray							)
								assert outputs.images.shape == (1, 3, 4, 4)
								assert isinstance(outputs["""images"""]				,    np.ndarray							)
								assert outputs["images"].shape == (1, 3, 4, 4)
								assert isinstance(outputs[0]				,    np.ndarray							)
								assert outputs[0].shape == (1, 3, 4, 4)

								# test with a non-tensor attribute
								a_       :   Tuple			=	CustomOutput(images=[PIL.Image.new("""RGB"""				,    (4, 4)							)]							)

								# check every way of getting the attribute
								assert isinstance(outputs.images				,    UpperCamelCase_							)
								assert isinstance(outputs.images[0]				,    PIL.Image.Image							)
								assert isinstance(outputs["""images"""]				,    UpperCamelCase_							)
								assert isinstance(outputs["""images"""][0]				,    PIL.Image.Image							)
								assert isinstance(outputs[0]				,    UpperCamelCase_							)
								assert isinstance(outputs[0][0]				,    PIL.Image.Image							)





	def     A				(  self							)		->			Any:
								"""simple docstring"""






								a_       :   Dict			=	CustomOutput({"""images""": np.random.rand(1				,    3				,    4				,    4							)}							)

								# check every way of getting the attribute
								assert isinstance(outputs.images				,    np.ndarray							)
								assert outputs.images.shape == (1, 3, 4, 4)
								assert isinstance(outputs["""images"""]				,    np.ndarray							)
								assert outputs["images"].shape == (1, 3, 4, 4)
								assert isinstance(outputs[0]				,    np.ndarray							)
								assert outputs[0].shape == (1, 3, 4, 4)

								# test with a non-tensor attribute
								a_       :   Dict			=	CustomOutput({"""images""": [PIL.Image.new("""RGB"""				,    (4, 4)							)]}							)

								# check every way of getting the attribute
								assert isinstance(outputs.images				,    UpperCamelCase_							)
								assert isinstance(outputs.images[0]				,    PIL.Image.Image							)
								assert isinstance(outputs["""images"""]				,    UpperCamelCase_							)
								assert isinstance(outputs["""images"""][0]				,    PIL.Image.Image							)
								assert isinstance(outputs[0]				,    UpperCamelCase_							)
								assert isinstance(outputs[0][0]				,    PIL.Image.Image							)






from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE : Optional[Any]          =    {
    "configuration_camembert": ["CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "CamembertConfig", "CamembertOnnxConfig"],
}

try:
	if not is_sentencepiece_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	SCREAMING_SNAKE_CASE : Optional[int]          =    ["CamembertTokenizer"]

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	SCREAMING_SNAKE_CASE : Any          =    ["CamembertTokenizerFast"]

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	SCREAMING_SNAKE_CASE : Union[str, Any]          =    [
	    "CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
	    "CamembertForCausalLM",
	    "CamembertForMaskedLM",
	    "CamembertForMultipleChoice",
	    "CamembertForQuestionAnswering",
	    "CamembertForSequenceClassification",
	    "CamembertForTokenClassification",
	    "CamembertModel",
	    "CamembertPreTrainedModel",
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	SCREAMING_SNAKE_CASE : List[Any]          =    [
	    "TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
	    "TFCamembertForCausalLM",
	    "TFCamembertForMaskedLM",
	    "TFCamembertForMultipleChoice",
	    "TFCamembertForQuestionAnswering",
	    "TFCamembertForSequenceClassification",
	    "TFCamembertForTokenClassification",
	    "TFCamembertModel",
	    "TFCamembertPreTrainedModel",
	]


if TYPE_CHECKING:
	from .configuration_camembert import CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CamembertConfig, CamembertOnnxConfig

	try:
		if not is_sentencepiece_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_camembert import CamembertTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_camembert_fast import CamembertTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_camembert import (
		    CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    CamembertForCausalLM,
		    CamembertForMaskedLM,
		    CamembertForMultipleChoice,
		    CamembertForQuestionAnswering,
		    CamembertForSequenceClassification,
		    CamembertForTokenClassification,
		    CamembertModel,
		    CamembertPreTrainedModel,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_camembert import (
		    TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFCamembertForCausalLM,
		    TFCamembertForMaskedLM,
		    TFCamembertForMultipleChoice,
		    TFCamembertForQuestionAnswering,
		    TFCamembertForSequenceClassification,
		    TFCamembertForTokenClassification,
		    TFCamembertModel,
		    TFCamembertPreTrainedModel,
		)

else:
	import sys

	SCREAMING_SNAKE_CASE : Any          =    _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


