
'''simple docstring'''







import gc
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    PNDMScheduler,
    StableDiffusionLDMaDPipeline,
    UNetaDConditionModel,
)
from diffusers.utils import nightly, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS


enable_full_determinism()


class 						__UpperCAmelCase      (					unittest.TestCase						):
							__lowercase      		=       StableDiffusionLDMaDPipeline
							__lowercase      		=       TEXT_TO_IMAGE_PARAMS
							__lowercase      		=       TEXT_TO_IMAGE_BATCH_PARAMS
							__lowercase      		=       TEXT_TO_IMAGE_IMAGE_PARAMS


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								torch.manual_seed(0  )
								_snake_case   						=		UNetaDConditionModel(
								    block_out_channels=(32, 64)    ,   layers_per_block=2    ,   sample_size=32    ,   in_channels=4    ,   out_channels=4    ,   down_block_types=('DownBlock2D', 'CrossAttnDownBlock2D')    ,   up_block_types=('CrossAttnUpBlock2D', 'UpBlock2D')    ,   cross_attention_dim=32    ,   )
								_snake_case   						=		DDIMScheduler(
								    beta_start=0.00085    ,   beta_end=0.012    ,   beta_schedule='scaled_linear'    ,   clip_sample=lowerCAmelCase_    ,   set_alpha_to_one=lowerCAmelCase_    ,   )
								torch.manual_seed(0  )
								_snake_case   						=		AutoencoderKL(
								    block_out_channels=[32, 64]    ,   in_channels=6    ,   out_channels=6    ,   down_block_types=['DownEncoderBlock2D', 'DownEncoderBlock2D']    ,   up_block_types=['UpDecoderBlock2D', 'UpDecoderBlock2D']    ,   latent_channels=4    ,   )
								torch.manual_seed(0  )
								_snake_case   						=		CLIPTextConfig(
								    bos_token_id=0    ,   eos_token_id=2    ,   hidden_size=32    ,   intermediate_size=37    ,   layer_norm_eps=1E-05    ,   num_attention_heads=4    ,   num_hidden_layers=5    ,   pad_token_id=1    ,   vocab_size=10_00    ,   )
								_snake_case   						=		CLIPTextModel(lowerCAmelCase_  )
								_snake_case   						=		CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip'  )

								_snake_case   						=		{
								    'unet': unet,
								    'scheduler': scheduler,
								    'vae': vae,
								    'text_encoder': text_encoder,
								    'tokenizer': tokenizer,
								    'safety_checker': None,
								    'feature_extractor': None,
								}
								return components


							def  lowerCamelCase				(       self    ,   lowerCAmelCase_    ,   lowerCAmelCase_=0  ):





								"""simple docstring"""






								if str(lowerCAmelCase_  ).startswith('mps'  ):
									_snake_case   						=		torch.manual_seed(lowerCAmelCase_  )
								else:
									_snake_case   						=		torch.Generator(device=lowerCAmelCase_  ).manual_seed(lowerCAmelCase_  )
								_snake_case   						=		{
								    'prompt': 'A painting of a squirrel eating a burger',
								    'generator': generator,
								    'num_inference_steps': 2,
								    'guidance_scale': 6.0,
								    'output_type': 'numpy',
								}
								return inputs


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		'cpu'  # ensure determinism for the device-dependent torch.Generator

								_snake_case   						=		self.get_dummy_components()
								_snake_case   						=		StableDiffusionLDMaDPipeline(**lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe.to(lowerCAmelCase_  )
								ldmad_pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		self.get_dummy_inputs(lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_  )
								_snake_case						, _snake_case   						=		output.rgb, output.depth

								_snake_case   						=		rgb[0, -3:, -3:, -1]
								_snake_case   						=		depth[0, -3:, -1]

								assert rgb.shape == (1, 64, 64, 3)
								assert depth.shape == (1, 64, 64)

								_snake_case   						=		np.array(
								    [0.37338176, 0.70247, 0.74203193, 0.51643604, 0.58256793, 0.60932136, 0.4181095, 0.48355877, 0.46535262]  )
								_snake_case   						=		np.array([103.46727, 85.812004, 87.849236]  )

								assert np.abs(image_slice_rgb.flatten() - expected_slice_rgb  ).max() < 1E-2
								assert np.abs(image_slice_depth.flatten() - expected_slice_depth  ).max() < 1E-2


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		self.get_dummy_components()
								_snake_case   						=		StableDiffusionLDMaDPipeline(**lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe.to(lowerCAmelCase_  )
								ldmad_pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		self.get_dummy_inputs(lowerCAmelCase_  )
								_snake_case   						=		3 * [inputs['prompt']]

								# forward
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_  )
								_snake_case						, _snake_case   						=		output.rgb, output.depth
								_snake_case   						=		rgb_slice_a[0, -3:, -3:, -1]
								_snake_case   						=		depth_slice_a[0, -3:, -1]

								_snake_case   						=		self.get_dummy_inputs(lowerCAmelCase_  )
								_snake_case   						=		3 * [inputs.pop('prompt'  )]

								_snake_case   						=		ldmad_pipe.tokenizer(
								    lowerCAmelCase_    ,   padding='max_length'    ,   max_length=ldmad_pipe.tokenizer.model_max_length    ,   truncation=lowerCAmelCase_    ,   return_tensors='pt'    ,   )
								_snake_case   						=		text_inputs['input_ids'].to(lowerCAmelCase_  )

								_snake_case   						=		ldmad_pipe.text_encoder(lowerCAmelCase_  )[0]

								_snake_case   						=		prompt_embeds

								# forward
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_  )
								_snake_case						, _snake_case   						=		output.rgb, output.depth
								_snake_case   						=		rgb_slice_a[0, -3:, -3:, -1]
								_snake_case   						=		depth_slice_a[0, -3:, -1]

								assert np.abs(rgb_slice_a.flatten() - rgb_slice_a.flatten()  ).max() < 1E-4
								assert np.abs(depth_slice_a.flatten() - depth_slice_a.flatten()  ).max() < 1E-4




							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		'cpu'  # ensure determinism for the device-dependent torch.Generator
								_snake_case   						=		self.get_dummy_components()
								_snake_case   						=		PNDMScheduler(skip_prk_steps=lowerCAmelCase_  )
								_snake_case   						=		StableDiffusionLDMaDPipeline(**lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe.to(lowerCAmelCase_  )
								ldmad_pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		self.get_dummy_inputs(lowerCAmelCase_  )
								_snake_case   						=		'french fries'
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_    ,   negative_prompt=lowerCAmelCase_  )

								_snake_case						, _snake_case   						=		output.rgb, output.depth
								_snake_case   						=		rgb[0, -3:, -3:, -1]
								_snake_case   						=		depth[0, -3:, -1]

								assert rgb.shape == (1, 64, 64, 3)
								assert depth.shape == (1, 64, 64)

								_snake_case   						=		np.array(
								    [0.37044, 0.71811503, 0.7223251, 0.48603675, 0.5638391, 0.6364948, 0.42833704, 0.4901315, 0.47926217]  )
								_snake_case   						=		np.array([107.84738, 84.62802, 89.962135]  )
								assert np.abs(rgb_slice.flatten() - expected_slice_rgb  ).max() < 1E-2
								assert np.abs(depth_slice.flatten() - expected_slice_depth  ).max() < 1E-2


@slow
@require_torch_gpu
class 						__UpperCAmelCase      (					unittest.TestCase						):


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								super().tearDown()
								gc.collect()
								torch.cuda.empty_cache()


							def  lowerCamelCase				(       self    ,   lowerCAmelCase_    ,   lowerCAmelCase_="cpu"    ,   lowerCAmelCase_=torch.floataa    ,   lowerCAmelCase_=0  ):





								"""simple docstring"""






								_snake_case   						=		torch.Generator(device=lowerCAmelCase_  ).manual_seed(lowerCAmelCase_  )
								_snake_case   						=		np.random.RandomState(lowerCAmelCase_  ).standard_normal((1, 4, 64, 64)  )
								_snake_case   						=		torch.from_numpy(lowerCAmelCase_  ).to(device=lowerCAmelCase_    ,   dtype=lowerCAmelCase_  )
								_snake_case   						=		{
								    'prompt': 'a photograph of an astronaut riding a horse',
								    'latents': latents,
								    'generator': generator,
								    'num_inference_steps': 3,
								    'guidance_scale': 7.5,
								    'output_type': 'numpy',
								}
								return inputs




							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		StableDiffusionLDMaDPipeline.from_pretrained('Intel/ldm3d'  )
								_snake_case   						=		ldmad_pipe.to(lowerCAmelCase_  )
								ldmad_pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		self.get_inputs(lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_  )
								_snake_case						, _snake_case   						=		output.rgb, output.depth
								_snake_case   						=		rgb[0, -3:, -3:, -1].flatten()
								_snake_case   						=		rgb[0, -3:, -1].flatten()

								assert rgb.shape == (1, 5_12, 5_12, 3)
								assert depth.shape == (1, 5_12, 5_12)

								_snake_case   						=		np.array(
								    [0.53805465, 0.56707305, 0.5486515, 0.57012236, 0.5814511, 0.56253487, 0.54843014, 0.55092263, 0.6459706]  )
								_snake_case   						=		np.array(
								    [0.9263781, 0.6678672, 0.5486515, 0.92202145, 0.67831135, 0.56253487, 0.9241694, 0.7551478, 0.6459706]  )
								assert np.abs(rgb_slice - expected_slice_rgb  ).max() < 3E-3
								assert np.abs(depth_slice - expected_slice_depth  ).max() < 3E-3


@nightly
@require_torch_gpu
class 						__UpperCAmelCase      (					unittest.TestCase						):


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								super().tearDown()
								gc.collect()
								torch.cuda.empty_cache()


							def  lowerCamelCase				(       self    ,   lowerCAmelCase_    ,   lowerCAmelCase_="cpu"    ,   lowerCAmelCase_=torch.floataa    ,   lowerCAmelCase_=0  ):





								"""simple docstring"""






								_snake_case   						=		torch.Generator(device=lowerCAmelCase_  ).manual_seed(lowerCAmelCase_  )
								_snake_case   						=		np.random.RandomState(lowerCAmelCase_  ).standard_normal((1, 4, 64, 64)  )
								_snake_case   						=		torch.from_numpy(lowerCAmelCase_  ).to(device=lowerCAmelCase_    ,   dtype=lowerCAmelCase_  )
								_snake_case   						=		{
								    'prompt': 'a photograph of an astronaut riding a horse',
								    'latents': latents,
								    'generator': generator,
								    'num_inference_steps': 50,
								    'guidance_scale': 7.5,
								    'output_type': 'numpy',
								}
								return inputs


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		StableDiffusionLDMaDPipeline.from_pretrained('Intel/ldm3d'  ).to(lowerCAmelCase_  )
								ldmad_pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		self.get_inputs(lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_  )
								_snake_case						, _snake_case   						=		output.rgb, output.depth

								_snake_case   						=		0.495586
								_snake_case   						=		0.33795515
								_snake_case   						=		112.48518
								_snake_case   						=		98.489746
								assert np.abs(expected_rgb_mean - rgb.mean()  ) < 1E-3
								assert np.abs(expected_rgb_std - rgb.std()  ) < 1E-3
								assert np.abs(expected_depth_mean - depth.mean()  ) < 1E-3
								assert np.abs(expected_depth_std - depth.std()  ) < 1E-3




							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		StableDiffusionLDMaDPipeline.from_pretrained('Intel/ldm3d-4c'  ).to(lowerCAmelCase_  )
								ldmad_pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		self.get_inputs(lowerCAmelCase_  )
								_snake_case   						=		ldmad_pipe(**lowerCAmelCase_  )
								_snake_case						, _snake_case   						=		output.rgb, output.depth

								_snake_case   						=		0.4194127
								_snake_case   						=		0.35375586
								_snake_case   						=		0.5638502
								_snake_case   						=		0.34686103

								assert rgb.shape == (1, 5_12, 5_12, 3)
								assert depth.shape == (1, 5_12, 5_12, 1)
								assert np.abs(expected_rgb_mean - rgb.mean()  ) < 1E-3
								assert np.abs(expected_rgb_std - rgb.std()  ) < 1E-3
								assert np.abs(expected_depth_mean - depth.mean()  ) < 1E-3
								assert np.abs(expected_depth_std - depth.std()  ) < 1E-3



'''simple docstring'''







import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowercase :  Optional[Any]    							=       logging.get_logger(__name__)

_lowercase :  List[str]    							=       {
    "google/pix2struct-textcaps-base": (
        "https://huggingface.co/google/pix2struct-textcaps-base/resolve/main/config.json"
    ),
}






class  lowerCAmelCase__   (  lowerCamelCase_     ):
					lowerCAmelCase_        =     '''pix2struct_text_model'''
					lowerCAmelCase_        =     ['''past_key_values''']
					lowerCAmelCase_        =     {
					    '''hidden_size''': '''hidden_size''',
					    '''num_attention_heads''': '''num_heads''',
					    '''num_hidden_layers''': '''num_layers''',
					}






					def __init__(   self				,							__SCREAMING_SNAKE_CASE=5_02_44				,							__SCREAMING_SNAKE_CASE=7_68				,							__SCREAMING_SNAKE_CASE=64				,							__SCREAMING_SNAKE_CASE=20_48				,							__SCREAMING_SNAKE_CASE=12				,							__SCREAMING_SNAKE_CASE=12				,							__SCREAMING_SNAKE_CASE=32				,							__SCREAMING_SNAKE_CASE=1_28				,							__SCREAMING_SNAKE_CASE=0.1				,							__SCREAMING_SNAKE_CASE=1E-6				,							__SCREAMING_SNAKE_CASE=1.0				,							__SCREAMING_SNAKE_CASE="gelu_new"				,							__SCREAMING_SNAKE_CASE=0				,							__SCREAMING_SNAKE_CASE=False				,							__SCREAMING_SNAKE_CASE=0				,							__SCREAMING_SNAKE_CASE=1				,							__SCREAMING_SNAKE_CASE=False				,							__SCREAMING_SNAKE_CASE=True				,							**__SCREAMING_SNAKE_CASE				,							):


											"""simple docstring"""





											lowercase_	:     Any													=       vocab_size
											lowercase_	:     Tuple													=       hidden_size
											lowercase_	:     Optional[Any]													=       d_kv
											lowercase_	:     List[str]													=       d_ff
											lowercase_	:     List[str]													=       num_layers
											lowercase_	:     Optional[Any]													=       num_heads
											lowercase_	:     Union[str, Any]													=       relative_attention_num_buckets
											lowercase_	:     Optional[int]													=       relative_attention_max_distance
											lowercase_	:     Union[str, Any]													=       dropout_rate
											lowercase_	:     Dict													=       layer_norm_epsilon
											lowercase_	:     Dict													=       initializer_factor
											lowercase_	:     List[Any]													=       use_cache

											lowercase_	:     Optional[int]													=       eos_token_id
											lowercase_	:     Optional[int]													=       decoder_start_token_id

											# for backwards compatibility
											lowercase_	:     Any													=       dense_act_fn

											super().__init__(
											    pad_token_id=__SCREAMING_SNAKE_CASE				,							eos_token_id=__SCREAMING_SNAKE_CASE				,							decoder_start_token_id=__SCREAMING_SNAKE_CASE				,							tie_word_embeddings=__SCREAMING_SNAKE_CASE				,							is_decoder=__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE				,							)






					@classmethod
					def 	_snake_case    (   cls				,							__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											cls._set_token_in_kwargs(__SCREAMING_SNAKE_CASE		)

											lowercase_						, lowercase_	:     Optional[int]													=       cls.get_config_dict(__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		)

											# get the text config dict if we are loading from Pix2StructConfig
											if config_dict.get('''model_type'''		) == "pix2struct":
																	lowercase_	:     List[Any]													=       config_dict['''text_config''']

											if "model_type" in config_dict and hasattr(cls				,							'''model_type'''		) and config_dict["model_type"] != cls.model_type:
																	logger.warning(
																	    F'''You are using a model of type {config_dict['model_type']} to instantiate a model of type '''
																	    F'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''		)

											return cls.from_dict(__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		)







class  lowerCAmelCase__   (  lowerCamelCase_     ):
					lowerCAmelCase_        =     '''pix2struct_vision_model'''






					def __init__(   self				,							__SCREAMING_SNAKE_CASE=7_68				,							__SCREAMING_SNAKE_CASE=7_68				,							__SCREAMING_SNAKE_CASE=20_48				,							__SCREAMING_SNAKE_CASE=64				,							__SCREAMING_SNAKE_CASE=12				,							__SCREAMING_SNAKE_CASE=12				,							__SCREAMING_SNAKE_CASE="gelu_new"				,							__SCREAMING_SNAKE_CASE=1E-6				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=1E-1_0				,							__SCREAMING_SNAKE_CASE=1.0				,							__SCREAMING_SNAKE_CASE=40_96				,							__SCREAMING_SNAKE_CASE=32				,							__SCREAMING_SNAKE_CASE=1_28				,							**__SCREAMING_SNAKE_CASE				,							):


											"""simple docstring"""





											super().__init__(**__SCREAMING_SNAKE_CASE		)

											lowercase_	:     Union[str, Any]													=       hidden_size
											lowercase_	:     Any													=       patch_embed_hidden_size
											lowercase_	:     List[Any]													=       d_ff
											lowercase_	:     Dict													=       dropout_rate
											lowercase_	:     Any													=       num_hidden_layers
											lowercase_	:     Any													=       num_attention_heads
											lowercase_	:     int													=       initializer_range
											lowercase_	:     Dict													=       initializer_factor
											lowercase_	:     Dict													=       attention_dropout
											lowercase_	:     Optional[Any]													=       layer_norm_eps
											lowercase_	:     str													=       dense_act_fn
											lowercase_	:     Dict													=       seq_len
											lowercase_	:     List[Any]													=       relative_attention_num_buckets
											lowercase_	:     int													=       relative_attention_max_distance
											lowercase_	:     Optional[int]													=       d_kv






					@classmethod
					def 	_snake_case    (   cls				,							__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											cls._set_token_in_kwargs(__SCREAMING_SNAKE_CASE		)

											lowercase_						, lowercase_	:     str													=       cls.get_config_dict(__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		)

											# get the vision config dict if we are loading from Pix2StructConfig
											if config_dict.get('''model_type'''		) == "pix2struct":
																	lowercase_	:     Optional[int]													=       config_dict['''vision_config''']

											if "model_type" in config_dict and hasattr(cls				,							'''model_type'''		) and config_dict["model_type"] != cls.model_type:
																	logger.warning(
																	    F'''You are using a model of type {config_dict['model_type']} to instantiate a model of type '''
																	    F'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''		)

											return cls.from_dict(__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		)







class  lowerCAmelCase__   (  lowerCamelCase_     ):
					lowerCAmelCase_        =     '''pix2struct'''
					lowerCAmelCase_        =     True






					def __init__(   self				,							__SCREAMING_SNAKE_CASE=None				,							__SCREAMING_SNAKE_CASE=None				,							__SCREAMING_SNAKE_CASE=1.0				,							__SCREAMING_SNAKE_CASE=0.02				,							__SCREAMING_SNAKE_CASE=False				,							__SCREAMING_SNAKE_CASE=False				,							__SCREAMING_SNAKE_CASE=True				,							**__SCREAMING_SNAKE_CASE				,							):


											"""simple docstring"""





											super().__init__(tie_word_embeddings=__SCREAMING_SNAKE_CASE				,							is_encoder_decoder=__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		)

											if text_config is None:
																	lowercase_	:     Optional[Any]													=       {}
																	logger.info('''text_config is None. Initializing the Pix2StructTextConfig with default values.'''		)

											if vision_config is None:
																	lowercase_	:     Dict													=       {}
																	logger.info('''vision_config is None. Initializing the Pix2StructVisionConfig with default values.'''		)

											lowercase_	:     str													=       PixaStructTextConfig(**__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Tuple													=       PixaStructVisionConfig(**__SCREAMING_SNAKE_CASE		)

											lowercase_	:     Optional[Any]													=       self.text_config.decoder_start_token_id
											lowercase_	:     Union[str, Any]													=       self.text_config.pad_token_id
											lowercase_	:     Union[str, Any]													=       self.text_config.eos_token_id

											lowercase_	:     int													=       initializer_factor
											lowercase_	:     Any													=       initializer_range

											lowercase_	:     str													=       self.initializer_range
											lowercase_	:     str													=       self.initializer_range

											lowercase_	:     int													=       is_vqa






					@classmethod
					def 	_snake_case    (   cls				,							__SCREAMING_SNAKE_CASE				,							__SCREAMING_SNAKE_CASE				,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											return cls(text_config=text_config.to_dict()				,							vision_config=vision_config.to_dict()				,							**__SCREAMING_SNAKE_CASE		)






					def 	_snake_case    (   self		):


											"""simple docstring"""





											lowercase_	:     Tuple													=       copy.deepcopy(self.__dict__		)
											lowercase_	:     Any													=       self.text_config.to_dict()
											lowercase_	:     Optional[Any]													=       self.vision_config.to_dict()
											lowercase_	:     Optional[int]													=       self.__class__.model_type
											return output



