



import gc
import random
import unittest

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

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    EulerAncestralDiscreteScheduler,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionInstructPixaPixPipeline,
    UNetaDConditionModel,
)
from diffusers.image_processor import VaeImageProcessor
from diffusers.utils import floats_tensor, load_image, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..pipeline_params import (
    IMAGE_TO_IMAGE_IMAGE_PARAMS,
    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_VARIATION_PARAMS,
)
from ..test_pipelines_common import PipelineKarrasSchedulerTesterMixin, PipelineLatentTesterMixin, PipelineTesterMixin


enable_full_determinism()

class   UpperCAmelCase_    (  __snake_case       ,       __snake_case       ,       __snake_case       ,       unittest.TestCase			):

						'''simple docstring'''




						UpperCamelCase__     :					str							    =    StableDiffusionInstructPixaPixPipeline
						UpperCamelCase__     :					Tuple							    =    TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"height", "width", "cross_attention_kwargs"}
						UpperCamelCase__     :					Dict							    =    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS
						UpperCamelCase__     :					Tuple							    =    IMAGE_TO_IMAGE_IMAGE_PARAMS
						UpperCamelCase__     :					int							    =    IMAGE_TO_IMAGE_IMAGE_PARAMS






						def 			_A      (       self						):







													'''simple docstring'''

													torch.manual_seed(0						)
													__SCREAMING_SNAKE_CASE										=   UNetaDConditionModel(
													    block_out_channels=(32, 64) ,				layers_per_block=2 ,				sample_size=32 ,				in_channels=8 ,				out_channels=4 ,				down_block_types=('DownBlock2D', 'CrossAttnDownBlock2D') ,				up_block_types=('CrossAttnUpBlock2D', 'UpBlock2D') ,				cross_attention_dim=32 ,				)
													__SCREAMING_SNAKE_CASE										=   PNDMScheduler(skip_prk_steps=A__						)
													torch.manual_seed(0						)
													__SCREAMING_SNAKE_CASE										=   AutoencoderKL(
													    block_out_channels=[32, 64] ,				in_channels=3 ,				out_channels=3 ,				down_block_types=['DownEncoderBlock2D', 'DownEncoderBlock2D'] ,				up_block_types=['UpDecoderBlock2D', 'UpDecoderBlock2D'] ,				latent_channels=4 ,				)
													torch.manual_seed(0						)
													__SCREAMING_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=1_000 ,				)
													__SCREAMING_SNAKE_CASE										=   CLIPTextModel(A__						)
													__SCREAMING_SNAKE_CASE										=   CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip'						)

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






						def 			_A      (       self ,				_A ,				_A=0						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   floats_tensor((1, 3, 32, 32) ,				rng=random.Random(A__						)						).to(A__						)
													__SCREAMING_SNAKE_CASE										=   image.cpu().permute(0 ,				2 ,				3 ,				1						)[0]
													__SCREAMING_SNAKE_CASE										=   Image.fromarray(np.uinta(A__						)						).convert('RGB'						)
													if str(A__						).startswith('mps'						):
																				__SCREAMING_SNAKE_CASE										=   torch.manual_seed(A__						)
													else:
																				__SCREAMING_SNAKE_CASE										=   torch.Generator(device=A__						).manual_seed(A__						)
													__SCREAMING_SNAKE_CASE										=   {
													    '''prompt''': '''A painting of a squirrel eating a burger''',
													    '''image''': image,
													    '''generator''': generator,
													    '''num_inference_steps''': 2,
													    '''guidance_scale''': 6.0,
													    '''image_guidance_scale''': 1,
													    '''output_type''': '''numpy''',
													}
													return inputs






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   '''cpu'''  # ensure determinism for the device-dependent torch.Generator
													__SCREAMING_SNAKE_CASE										=   self.get_dummy_components()
													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline(**A__						)
													__SCREAMING_SNAKE_CASE										=   sd_pipe.to(A__						)
													sd_pipe.set_progress_bar_config(disable=A__						)

													__SCREAMING_SNAKE_CASE										=   self.get_dummy_inputs(A__						)
													__SCREAMING_SNAKE_CASE										=   sd_pipe(**A__						).images
													__SCREAMING_SNAKE_CASE										=   image[0, -3:, -3:, -1]
													assert image.shape == (1, 32, 32, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.7_5_2_6, 0.3_7_5_0, 0.4_5_4_7, 0.6_1_1_7, 0.5_8_6_6, 0.5_0_1_6, 0.4_3_2_7, 0.5_6_4_2, 0.4_8_1_5]						)

													assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   '''cpu'''  # ensure determinism for the device-dependent torch.Generator
													__SCREAMING_SNAKE_CASE										=   self.get_dummy_components()
													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline(**A__						)
													__SCREAMING_SNAKE_CASE										=   sd_pipe.to(A__						)
													sd_pipe.set_progress_bar_config(disable=A__						)

													__SCREAMING_SNAKE_CASE										=   self.get_dummy_inputs(A__						)
													__SCREAMING_SNAKE_CASE										=   '''french fries'''
													__SCREAMING_SNAKE_CASE										=   sd_pipe(**A__ ,				negative_prompt=A__						)
													__SCREAMING_SNAKE_CASE										=   output.images
													__SCREAMING_SNAKE_CASE										=   image[0, -3:, -3:, -1]

													assert image.shape == (1, 32, 32, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.7_5_1_1, 0.3_6_4_2, 0.4_5_5_3, 0.6_2_3_6, 0.5_7_9_7, 0.5_0_1_3, 0.4_3_4_3, 0.5_6_1_1, 0.4_8_3_1]						)

													assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   '''cpu'''  # ensure determinism for the device-dependent torch.Generator
													__SCREAMING_SNAKE_CASE										=   self.get_dummy_components()
													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline(**A__						)
													__SCREAMING_SNAKE_CASE										=   sd_pipe.to(A__						)
													sd_pipe.set_progress_bar_config(disable=A__						)

													__SCREAMING_SNAKE_CASE										=   self.get_dummy_inputs(A__						)
													__SCREAMING_SNAKE_CASE										=   [inputs['''prompt''']] * 2

													__SCREAMING_SNAKE_CASE										=   np.array(inputs['image']						).astype(np.floataa						) / 255.0
													__SCREAMING_SNAKE_CASE										=   torch.from_numpy(A__						).unsqueeze(0						).to(A__						)
													__SCREAMING_SNAKE_CASE										=   image / 2 + 0.5
													__SCREAMING_SNAKE_CASE										=   image.permute(0 ,				3 ,				1 ,				2						)
													__SCREAMING_SNAKE_CASE										=   image.repeat(2 ,				1 ,				1 ,				1						)

													__SCREAMING_SNAKE_CASE										=   sd_pipe(**A__						).images
													__SCREAMING_SNAKE_CASE										=   image[-1, -3:, -3:, -1]

													assert image.shape == (2, 32, 32, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.5_8_1_2, 0.5_7_4_8, 0.5_2_2_2, 0.5_9_0_8, 0.5_6_9_5, 0.7_1_7_4, 0.6_8_0_4, 0.5_5_2_3, 0.5_5_7_9]						)

													assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   '''cpu'''  # ensure determinism for the device-dependent torch.Generator
													__SCREAMING_SNAKE_CASE										=   self.get_dummy_components()
													__SCREAMING_SNAKE_CASE										=   EulerAncestralDiscreteScheduler(
													    beta_start=0.0_0_0_8_5 ,				beta_end=0.0_1_2 ,				beta_schedule='scaled_linear'						)
													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline(**A__						)
													__SCREAMING_SNAKE_CASE										=   sd_pipe.to(A__						)
													sd_pipe.set_progress_bar_config(disable=A__						)

													__SCREAMING_SNAKE_CASE										=   self.get_dummy_inputs(A__						)
													__SCREAMING_SNAKE_CASE										=   sd_pipe(**A__						).images
													__SCREAMING_SNAKE_CASE										=   image[0, -3:, -3:, -1]

													__SCREAMING_SNAKE_CASE										=   [round(A__ ,				4						) for x in image_slice.flatten().tolist()]
													print(','.join([str(A__						) for x in slice]						)						)

													assert image.shape == (1, 32, 32, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.7_4_1_7, 0.3_8_4_2, 0.4_7_3_2, 0.5_7_7_6, 0.5_8_9_1, 0.5_1_3_9, 0.4_0_5_2, 0.5_6_7_3, 0.4_9_8_6]						)

													assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													super().test_inference_batch_single_identical(expected_max_diff=3e-3						)






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   self.get_dummy_components()
													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline(**A__						)
													__SCREAMING_SNAKE_CASE										=   VaeImageProcessor(do_resize=A__ ,				do_normalize=A__						)
													__SCREAMING_SNAKE_CASE										=   pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)

													__SCREAMING_SNAKE_CASE										=   pipe(**self.get_dummy_inputs_by_type(A__ ,				input_image_type='pt'						)						)[0]

													__SCREAMING_SNAKE_CASE										=   components['''vae''']
													__SCREAMING_SNAKE_CASE										=   self.get_dummy_inputs_by_type(A__ ,				input_image_type='pt'						)

													for image_param in self.image_latents_params:
																				if image_param in inputs.keys():
																											__SCREAMING_SNAKE_CASE										=   vae.encode(inputs[image_param]						).latent_dist.mode()

													__SCREAMING_SNAKE_CASE										=   pipe(**A__						)[0]

													__SCREAMING_SNAKE_CASE										=   np.abs(out - out_latents_inputs						).max()
													self.assertLess(A__ ,				1e-4 ,				'passing latents as image input generate different result from passing image'						)







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

						'''simple docstring'''




						def 			_A      (       self						):







													'''simple docstring'''

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






						def 			_A      (       self ,				_A=0						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   torch.manual_seed(A__						)
													__SCREAMING_SNAKE_CASE										=   load_image(
													    'https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_pix2pix/example.jpg'						)
													__SCREAMING_SNAKE_CASE										=   {
													    '''prompt''': '''turn him into a cyborg''',
													    '''image''': image,
													    '''generator''': generator,
													    '''num_inference_steps''': 3,
													    '''guidance_scale''': 7.5,
													    '''image_guidance_scale''': 1.0,
													    '''output_type''': '''numpy''',
													}
													return inputs






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline.from_pretrained(
													    'timbrooks/instruct-pix2pix' ,				safety_checker=A__						)
													pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)
													pipe.enable_attention_slicing()

													__SCREAMING_SNAKE_CASE										=   self.get_inputs()
													__SCREAMING_SNAKE_CASE										=   pipe(**A__						).images
													__SCREAMING_SNAKE_CASE										=   image[0, -3:, -3:, -1].flatten()

													assert image.shape == (1, 512, 512, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.5_9_0_2, 0.6_0_1_5, 0.6_0_2_7, 0.5_9_8_3, 0.6_0_9_2, 0.6_0_6_1, 0.5_7_6_5, 0.5_7_8_5, 0.5_5_5_5]						)

													assert np.abs(expected_slice - image_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline.from_pretrained(
													    'timbrooks/instruct-pix2pix' ,				safety_checker=A__						)
													__SCREAMING_SNAKE_CASE										=   LMSDiscreteScheduler.from_config(pipe.scheduler.config						)
													pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)
													pipe.enable_attention_slicing()

													__SCREAMING_SNAKE_CASE										=   self.get_inputs()
													__SCREAMING_SNAKE_CASE										=   pipe(**A__						).images
													__SCREAMING_SNAKE_CASE										=   image[0, -3:, -3:, -1].flatten()

													assert image.shape == (1, 512, 512, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.6_5_7_8, 0.6_8_1_7, 0.6_9_7_2, 0.6_7_6_1, 0.6_8_5_6, 0.6_9_1_6, 0.6_4_2_8, 0.6_5_1_6, 0.6_3_0_1]						)

													assert np.abs(expected_slice - image_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline.from_pretrained(
													    'timbrooks/instruct-pix2pix' ,				safety_checker=A__						)
													__SCREAMING_SNAKE_CASE										=   DDIMScheduler.from_config(pipe.scheduler.config						)
													pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)
													pipe.enable_attention_slicing()

													__SCREAMING_SNAKE_CASE										=   self.get_inputs()
													__SCREAMING_SNAKE_CASE										=   pipe(**A__						).images
													__SCREAMING_SNAKE_CASE										=   image[0, -3:, -3:, -1].flatten()

													assert image.shape == (1, 512, 512, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.3_8_2_8, 0.3_8_3_4, 0.3_8_1_8, 0.3_7_9_2, 0.3_8_6_5, 0.3_7_5_2, 0.3_7_9_2, 0.3_8_4_7, 0.3_7_5_3]						)

													assert np.abs(expected_slice - image_slice						).max() < 1e-3






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   0

													def callback_fn(_A ,				_A ,				_A						) -> None:
																				__SCREAMING_SNAKE_CASE										=   True
																				nonlocal number_of_steps
																				number_of_steps += 1
																				if step == 1:
																											__SCREAMING_SNAKE_CASE										=   latents.detach().cpu().numpy()
																											assert latents.shape == (1, 4, 64, 64)
																											__SCREAMING_SNAKE_CASE										=   latents[0, -3:, -3:, -1]
																											__SCREAMING_SNAKE_CASE										=   np.array([-0.2_4_6_3, -0.4_6_4_4, -0.9_7_5_6, 1.5_1_7_6, 1.4_4_1_4, 0.7_8_6_6, 0.9_8_9_7, 0.8_5_2_1, 0.7_9_8_3]						)

																											assert np.abs(latents_slice.flatten() - expected_slice						).max() < 5e-2
																				elif step == 2:
																											__SCREAMING_SNAKE_CASE										=   latents.detach().cpu().numpy()
																											assert latents.shape == (1, 4, 64, 64)
																											__SCREAMING_SNAKE_CASE										=   latents[0, -3:, -3:, -1]
																											__SCREAMING_SNAKE_CASE										=   np.array([-0.2_6_4_4, -0.4_6_2_6, -0.9_6_5_3, 1.5_1_7_6, 1.4_5_5_1, 0.7_6_8_6, 0.9_8_0_5, 0.8_4_5_2, 0.8_1_1_5]						)

																											assert np.abs(latents_slice.flatten() - expected_slice						).max() < 5e-2

													__SCREAMING_SNAKE_CASE										=   False

													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline.from_pretrained(
													    'timbrooks/instruct-pix2pix' ,				safety_checker=A__ ,				torch_dtype=torch.floataa						)
													__SCREAMING_SNAKE_CASE										=   pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)
													pipe.enable_attention_slicing()

													__SCREAMING_SNAKE_CASE										=   self.get_inputs()
													pipe(**A__ ,				callback=A__ ,				callback_steps=1						)
													assert callback_fn.has_been_called
													assert number_of_steps == 3






						def 			_A      (       self						):







													'''simple docstring'''

													torch.cuda.empty_cache()
													torch.cuda.reset_max_memory_allocated()
													torch.cuda.reset_peak_memory_stats()

													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline.from_pretrained(
													    'timbrooks/instruct-pix2pix' ,				safety_checker=A__ ,				torch_dtype=torch.floataa						)
													__SCREAMING_SNAKE_CASE										=   pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)
													pipe.enable_attention_slicing(1						)
													pipe.enable_sequential_cpu_offload()

													__SCREAMING_SNAKE_CASE										=   self.get_inputs()
													__SCREAMING_SNAKE_CASE										=   pipe(**A__						)

													__SCREAMING_SNAKE_CASE										=   torch.cuda.max_memory_allocated()
													# make sure that less than 2.2 GB is allocated
													assert mem_bytes < 2.2 * 10**9






						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   self.get_inputs()
													# resize to resolution that is divisible by 8 but not 16 or 32
													__SCREAMING_SNAKE_CASE										=   inputs['''image'''].resize((504, 504)						)

													__SCREAMING_SNAKE_CASE										=   '''timbrooks/instruct-pix2pix'''
													__SCREAMING_SNAKE_CASE										=   StableDiffusionInstructPixaPixPipeline.from_pretrained(
													    A__ ,				safety_checker=A__ ,				)
													pipe.to(A__						)
													pipe.set_progress_bar_config(disable=A__						)
													pipe.enable_attention_slicing()

													__SCREAMING_SNAKE_CASE										=   pipe(**A__						)
													__SCREAMING_SNAKE_CASE										=   output.images[0]

													__SCREAMING_SNAKE_CASE										=   image[255:258, 383:386, -1]

													assert image.shape == (504, 504, 3)
													__SCREAMING_SNAKE_CASE										=   np.array([0.2_7_2_6, 0.2_5_2_9, 0.2_6_6_4, 0.2_6_5_5, 0.2_6_4_1, 0.2_6_4_2, 0.2_5_9_1, 0.2_6_4_9, 0.2_5_9_0]						)

													assert np.abs(image_slice.flatten() - expected_slice						).max() < 5e-3














import functools
import operator

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


_UpperCamelCase			:	List[Any]								=logging.get_logger(__name__)

_UpperCamelCase			:	Dict								={
    'asapp/sew-tiny-100k': 'https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json',
    # See all SEW models at https://huggingface.co/models?filter=sew
}






class 						UpperCAmelCase__ (							__snake_case							):
		__snake_case      :       Tuple     =   "sew"







		def __init__(					self       ,A__=32       ,A__=768       ,A__=12       ,A__=12       ,A__=3072       ,A__=2       ,A__="gelu"       ,A__=0.1       ,A__=0.1       ,A__=0.1       ,A__=0.0       ,A__=0.1       ,A__=0.1       ,A__=0.02       ,A__=1E-5       ,A__="group"       ,A__="gelu"       ,A__=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)       ,A__=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)       ,A__=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)       ,A__=False       ,A__=128       ,A__=16       ,A__=True       ,A__=0.05       ,A__=10       ,A__=2       ,A__=0.0       ,A__=10       ,A__=0       ,A__="mean"       ,A__=False       ,A__=False       ,A__=256       ,A__=0       ,A__=1       ,A__=2       ,**A__       ,):
						super().__init__(**A__       ,pad_token_id=A__       ,bos_token_id=A__       ,eos_token_id=A__		)
						_A	:				str   =      hidden_size
						_A	:				Optional[Any]   =      feat_extract_norm
						_A	:				Any   =      feat_extract_activation
						_A	:				Optional[int]   =      list(A__		)
						_A	:				str   =      list(A__		)
						_A	:				Optional[Any]   =      list(A__		)
						_A	:				List[Any]   =      conv_bias
						_A	:				Optional[int]   =      num_conv_pos_embeddings
						_A	:				Any   =      num_conv_pos_embedding_groups
						_A	:				Union[str, Any]   =      len(self.conv_dim		)
						_A	:				List[Any]   =      num_hidden_layers
						_A	:				str   =      intermediate_size
						_A	:				List[Any]   =      squeeze_factor
						_A	:				Tuple   =      hidden_act
						_A	:				Union[str, Any]   =      num_attention_heads
						_A	:				Optional[int]   =      hidden_dropout
						_A	:				Optional[int]   =      attention_dropout
						_A	:				Optional[int]   =      activation_dropout
						_A	:				Tuple   =      feat_proj_dropout
						_A	:				Optional[Any]   =      final_dropout
						_A	:				str   =      layerdrop
						_A	:				int   =      layer_norm_eps
						_A	:				List[str]   =      initializer_range
						_A	:				List[Any]   =      vocab_size

						if (
						    (len(self.conv_stride		) != self.num_feat_extract_layers)
						    or (len(self.conv_kernel		) != self.num_feat_extract_layers)
						    or (len(self.conv_dim		) != self.num_feat_extract_layers)
						):
										raise ValueError(
										    '''Configuration for convolutional layers is incorrect.'''
										    '''It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`,'''
										    f"""but is `len(config.conv_dim) = {len(self.conv_dim		)}`, `len(config.conv_stride)"""
										    f"""= {len(self.conv_stride		)}`, `len(config.conv_kernel) = {len(self.conv_kernel		)}`."""		)

						# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
						_A	:				Union[str, Any]   =      apply_spec_augment
						_A	:				str   =      mask_time_prob
						_A	:				Any   =      mask_time_length
						_A	:				int   =      mask_time_min_masks
						_A	:				str   =      mask_feature_prob
						_A	:				Optional[Any]   =      mask_feature_length
						_A	:				Dict   =      mask_feature_min_masks

						# ctc loss
						_A	:				Optional[int]   =      ctc_loss_reduction
						_A	:				List[str]   =      ctc_zero_infinity

						# sequence classification
						_A	:				List[Any]   =      use_weighted_layer_sum
						_A	:				Optional[int]   =      classifier_proj_size







		@property
		def  A__      (					self		):
						return functools.reduce(operator.mul       ,self.conv_stride       ,1		)



