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


_lowercase:	str       			=		logging.get_logger(__name__)

_lowercase:	List[Any]       			=		{
    '''google/vivit-b-16x2-kinetics400''': (
        '''https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json'''
    ),
    # See all Vivit models at https://huggingface.co/models?filter=vivit
}



class        lowerCamelCase__				(   UpperCAmelCase				):
			UpperCamelCase__    							="vivit"





			def __init__(       self	:	List[str]  ,  lowercase__	:	Union[str, Any]=2_24  ,  lowercase__	:	Any=32  ,  lowercase__	:	Any=[2, 16, 16]  ,  lowercase__	:	List[Any]=3  ,  lowercase__	:	Any=7_68  ,  lowercase__	:	Union[str, Any]=12  ,  lowercase__	:	List[Any]=12  ,  lowercase__	:	str=30_72  ,  lowercase__	:	Optional[int]="gelu_fast"  ,  lowercase__	:	int=0.0  ,  lowercase__	:	int=0.0  ,  lowercase__	:	str=0.0_2  ,  lowercase__	:	str=1e-06  ,  lowercase__	:	Any=True  ,  **lowercase__	:	int  ,  ):
										_lowerCAmelCase							=							hidden_size
										_lowerCAmelCase							=							num_hidden_layers
										_lowerCAmelCase							=							num_attention_heads
										_lowerCAmelCase							=							intermediate_size
										_lowerCAmelCase							=							hidden_act
										_lowerCAmelCase							=							hidden_dropout_prob
										_lowerCAmelCase							=							attention_probs_dropout_prob
										_lowerCAmelCase							=							initializer_range
										_lowerCAmelCase							=							layer_norm_eps

										_lowerCAmelCase							=							image_size
										_lowerCAmelCase							=							num_frames
										_lowerCAmelCase							=							tubelet_size
										_lowerCAmelCase							=							num_channels
										_lowerCAmelCase							=							qkv_bias

										super().__init__(**lowercase__						)







import tempfile
import unittest

from make_student import create_student_by_copying_alternating_layers

from transformers import AutoConfig
from transformers.file_utils import cached_property
from transformers.testing_utils import require_torch


_lowercase:	str       			=		'''sshleifer/bart-tiny-random'''
_lowercase:	Union[str, Any]       			=		'''patrickvonplaten/t5-tiny-random'''



@require_torch
class        lowerCamelCase__				(   unittest.TestCase				):





			@cached_property
			def   SCREAMING_SNAKE_CASE__     (       self	:	Tuple						):
										return AutoConfig.from_pretrained(lowercase__						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	int						):
										_lowerCAmelCase			,		*_lowerCAmelCase							=							create_student_by_copying_alternating_layers(lowercase__  ,  tempfile.mkdtemp()  ,  e=1  ,  d=1						)
										self.assertEqual(student.config.num_hidden_layers  ,  1						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Dict						):
										_lowerCAmelCase			,		*_lowerCAmelCase							=							create_student_by_copying_alternating_layers(lowercase__  ,  tempfile.mkdtemp()  ,  e=1  ,  d=lowercase__						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	Union[str, Any]						):
										_lowerCAmelCase			,		*_lowerCAmelCase							=							create_student_by_copying_alternating_layers(lowercase__  ,  tempfile.mkdtemp()  ,  e=1  ,  d=lowercase__						)
										self.assertEqual(student.config.encoder_layers  ,  1						)
										self.assertEqual(student.config.decoder_layers  ,  self.teacher_config.encoder_layers						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	str						):
										_lowerCAmelCase			,		*_lowerCAmelCase							=							create_student_by_copying_alternating_layers(lowercase__  ,  tempfile.mkdtemp()  ,  e=1  ,  d=1						)
										self.assertEqual(student.config.encoder_layers  ,  1						)
										self.assertEqual(student.config.decoder_layers  ,  1						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	List[str]						):
										with self.assertRaises(lowercase__						):
																	create_student_by_copying_alternating_layers(lowercase__  ,  tempfile.mkdtemp()  ,  e=lowercase__  ,  d=lowercase__						)






