





from typing import Callable, Optional, Union

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


_lowerCamelCase					:				Any  							=					logging.get_logger(__name__)

_lowerCamelCase					:				Any  							=					{
    """microsoft/prophetnet-large-uncased""": (
        """https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json"""
    ),
}


class 						lowerCamelCase   (__lowerCamelCase			):







							"""simple docstring"""




							UpperCAmelCase_									=    "prophetnet"
							UpperCAmelCase_									=    ["past_key_values"]
							UpperCAmelCase_									=    {
							    "num_attention_heads": "num_encoder_attention_heads",
							}






							def __init__(					self	:     List[str], _UpperCAmelCase	:     Optional[float] = 0.1, _UpperCAmelCase	:     Optional[Union[str, Callable]] = "gelu", _UpperCAmelCase	:     Optional[int] = 3_0_5_2_2, _UpperCAmelCase	:     Optional[int] = 1_0_2_4, _UpperCAmelCase	:     Optional[int] = 4_0_9_6, _UpperCAmelCase	:     Optional[int] = 1_2, _UpperCAmelCase	:     Optional[int] = 1_6, _UpperCAmelCase	:     Optional[int] = 4_0_9_6, _UpperCAmelCase	:     Optional[int] = 1_2, _UpperCAmelCase	:     Optional[int] = 1_6, _UpperCAmelCase	:     Optional[float] = 0.1, _UpperCAmelCase	:     Optional[float] = 0.1, _UpperCAmelCase	:     Optional[int] = 5_1_2, _UpperCAmelCase	:     Optional[float] = 0.02, _UpperCAmelCase	:     Optional[bool] = True, _UpperCAmelCase	:     Optional[bool] = True, _UpperCAmelCase	:     Optional[int] = 0, _UpperCAmelCase	:     Optional[int] = 2, _UpperCAmelCase	:     Optional[int] = 3_2, _UpperCAmelCase	:     Optional[int] = 1_2_8, _UpperCAmelCase	:     Optional[bool] = False, _UpperCAmelCase	:     Optional[float] = 0.0, _UpperCAmelCase	:     Optional[bool] = True, _UpperCAmelCase	:     Optional[int] = 0, _UpperCAmelCase	:     Optional[int] = 1, _UpperCAmelCase	:     Optional[int] = 2, **_UpperCAmelCase	:     List[str], )      -> Optional[Any]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__   :			Any      =						vocab_size
														SCREAMING_SNAKE_CASE__   :			str      =						hidden_size
														SCREAMING_SNAKE_CASE__   :			Any      =						encoder_ffn_dim
														SCREAMING_SNAKE_CASE__   :			Optional[int]      =						num_encoder_layers
														SCREAMING_SNAKE_CASE__   :			Optional[int]      =						num_encoder_attention_heads
														SCREAMING_SNAKE_CASE__   :			int      =						decoder_ffn_dim
														SCREAMING_SNAKE_CASE__   :			int      =						num_decoder_layers
														SCREAMING_SNAKE_CASE__   :			List[Any]      =						num_decoder_attention_heads
														SCREAMING_SNAKE_CASE__   :			List[Any]      =						max_position_embeddings
														SCREAMING_SNAKE_CASE__   :			List[str]      =						init_std  # Normal(0, this parameter)
														SCREAMING_SNAKE_CASE__   :			List[str]      =						activation_function

														# parameters for prophetnet
														SCREAMING_SNAKE_CASE__   :			Any      =						ngram
														SCREAMING_SNAKE_CASE__   :			Dict      =						num_buckets
														SCREAMING_SNAKE_CASE__   :			int      =						relative_max_distance
														SCREAMING_SNAKE_CASE__   :			Dict      =						disable_ngram_loss
														SCREAMING_SNAKE_CASE__   :			Optional[Any]      =						eps

														# 3 Types of Dropout
														SCREAMING_SNAKE_CASE__   :			Tuple      =						attention_dropout
														SCREAMING_SNAKE_CASE__   :			Optional[Any]      =						activation_dropout
														SCREAMING_SNAKE_CASE__   :			Optional[Any]      =						dropout

														SCREAMING_SNAKE_CASE__   :			str      =						use_cache

														super().__init__(
														    pad_token_id=snake_case__, bos_token_id=snake_case__, eos_token_id=snake_case__, is_encoder_decoder=snake_case__, add_cross_attention=snake_case__, decoder_start_token_id=snake_case__, **snake_case__, )






							@property
							def 					A_	(					self	:     Tuple						)      -> Optional[int]:





														"""simple docstring"""
														return self.num_encoder_layers + self.num_decoder_layers






							@num_hidden_layers.setter
							def 					A_	(					self	:     List[Any], _UpperCAmelCase	:     List[str]						)      -> Any:





														"""simple docstring"""
														raise NotImplementedError(
														    "This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and"
														    " `num_decoder_layers`."						)














"""simple docstring"""



import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference




@slow
@require_torch_gpu
class        lowerCAmelCase__       (  unittest.TestCase					):
   def 	__a				(						self	:     Optional[Any]				):


        '''simple docstring'''
        UpperCAmelCase__		:  int				=				"runwayml/stable-diffusion-v1-5"
        UpperCAmelCase__		:  Optional[Any]				=				TextToVideoZeroPipeline.from_pretrained(snake_case__				,       torch_dtype=torch.floataa				).to("cuda"				)
        UpperCAmelCase__		:  Any				=				DDIMScheduler.from_config(pipe.scheduler.config				)
        UpperCAmelCase__		:  Optional[Any]				=				torch.Generator(device="cuda"				).manual_seed(0				)

        UpperCAmelCase__		:  Any				=				"A bear is playing a guitar on Times Square"
        UpperCAmelCase__		:  Dict				=				pipe(prompt=snake_case__				,       generator=snake_case__				).images

        UpperCAmelCase__		:  List[Any]				=				load_pt(
            "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt"				)

        assert_mean_pixel_difference(snake_case__				,       snake_case__				)


