





"""simple docstring"""
import pytest

from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested

from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows



def 					__lowerCamelCase       (							a_					:		int							)      ->				Dict:  # picklable for multiprocessing
      return i + 1



@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def 					__lowerCamelCase       (							)      ->				Tuple:
      with parallel_backend('''spark'''							):
            assert ParallelBackendConfig.backend_name == "spark"

      __SCREAMING_SNAKE_CASE       :List[str]		    =  [1, 2, 3]
      with pytest.raises(a_							):
            with parallel_backend('''unsupported backend'''							):
                  map_nested(a_			,       a_			,       num_proc=2							)

      with pytest.raises(a_							):
            with parallel_backend('''unsupported backend'''							):
                  map_nested(a_			,       a_			,       num_proc=-1							)







@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize('''num_proc'''			,       [2, -1]							)
def 					__lowerCamelCase       (							a_					:		int							)      ->				Any:
      __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  [1, 2]
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  {'''a''': 1, '''b''': 2}
      __SCREAMING_SNAKE_CASE       :str		    =  {'''a''': [1, 2], '''b''': [3, 4]}
      __SCREAMING_SNAKE_CASE       :List[str]		    =  {'''a''': {'''1''': 1}, '''b''': 2}
      __SCREAMING_SNAKE_CASE       :Tuple		    =  {'''a''': 1, '''b''': 2, '''c''': 3, '''d''': 4}
      __SCREAMING_SNAKE_CASE       :List[str]		    =  [2, 3]
      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  {'''a''': 2, '''b''': 3}
      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  {'''a''': [2, 3], '''b''': [4, 5]}
      __SCREAMING_SNAKE_CASE       :Any		    =  {'''a''': {'''1''': 2}, '''b''': 3}
      __SCREAMING_SNAKE_CASE       :Tuple		    =  {'''a''': 2, '''b''': 3, '''c''': 4, '''d''': 5}

      with parallel_backend('''spark'''							):
            assert map_nested(a_			,       a_			,       num_proc=a_							) == expected_map_nested_sa
            assert map_nested(a_			,       a_			,       num_proc=a_							) == expected_map_nested_sa
            assert map_nested(a_			,       a_			,       num_proc=a_							) == expected_map_nested_sa
            assert map_nested(a_			,       a_			,       num_proc=a_							) == expected_map_nested_sa
            assert map_nested(a_			,       a_			,       num_proc=a_							) == expected_map_nested_sa






"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase_       =		logging.get_logger(__name__)

lowerCamelCase_       =		{
    "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  _SCREAMING_SNAKE_CASE(       A  ):
       SCREAMING_SNAKE_CASE_       :				Optional[Any]     						=  '''vivit'''




       def __init__(						self		,SCREAMING_SNAKE_CASE__=2_24		,SCREAMING_SNAKE_CASE__=32		,SCREAMING_SNAKE_CASE__=[2, 16, 16]		,SCREAMING_SNAKE_CASE__=3		,SCREAMING_SNAKE_CASE__=7_68		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=30_72		,SCREAMING_SNAKE_CASE__="gelu_fast"		,SCREAMING_SNAKE_CASE__=0.0		,SCREAMING_SNAKE_CASE__=0.0		,SCREAMING_SNAKE_CASE__=0.0_2		,SCREAMING_SNAKE_CASE__=1E-06		,SCREAMING_SNAKE_CASE__=True		,**SCREAMING_SNAKE_CASE__		,)      ->				str:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  hidden_size
             __SCREAMING_SNAKE_CASE       :List[str]		    =  num_hidden_layers
             __SCREAMING_SNAKE_CASE       :List[str]		    =  num_attention_heads
             __SCREAMING_SNAKE_CASE       :Any		    =  intermediate_size
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  hidden_act
             __SCREAMING_SNAKE_CASE       :int		    =  hidden_dropout_prob
             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  attention_probs_dropout_prob
             __SCREAMING_SNAKE_CASE       :Dict		    =  initializer_range
             __SCREAMING_SNAKE_CASE       :Dict		    =  layer_norm_eps

             __SCREAMING_SNAKE_CASE       :Any		    =  image_size
             __SCREAMING_SNAKE_CASE       :Any		    =  num_frames
             __SCREAMING_SNAKE_CASE       :Any		    =  tubelet_size
             __SCREAMING_SNAKE_CASE       :Tuple		    =  num_channels
             __SCREAMING_SNAKE_CASE       :List[str]		    =  qkv_bias

             super().__init__(**SCREAMING_SNAKE_CASE__							)