





'''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 	__a(SCREAMING_SNAKE_CASE_  :					List[str]    ):  # picklable for multiprocessing



    '''simple docstring'''





    return i + 1


@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def 	__a():



    '''simple docstring'''





    with parallel_backend("spark"    ):
        assert ParallelBackendConfig.backend_name == "spark"

    _lowerCAmelCase				=      [1, 2, 3]
    with pytest.raises(SCREAMING_SNAKE_CASE_    ):
        with parallel_backend("unsupported backend"    ):
            map_nested(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       num_proc=2    )

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





@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize("num_proc"		,       [2, -1]    )
def 	__a(SCREAMING_SNAKE_CASE_  :					List[str]    ):



    '''simple docstring'''





    _lowerCAmelCase				=      [1, 2]
    _lowerCAmelCase				=      {"a": 1, "b": 2}
    _lowerCAmelCase				=      {"a": [1, 2], "b": [3, 4]}
    _lowerCAmelCase				=      {"a": {"1": 1}, "b": 2}
    _lowerCAmelCase				=      {"a": 1, "b": 2, "c": 3, "d": 4}
    _lowerCAmelCase				=      [2, 3]
    _lowerCAmelCase				=      {"a": 2, "b": 3}
    _lowerCAmelCase				=      {"a": [2, 3], "b": [4, 5]}
    _lowerCAmelCase				=      {"a": {"1": 2}, "b": 3}
    _lowerCAmelCase				=      {"a": 2, "b": 3, "c": 4, "d": 5}

    with parallel_backend("spark"    ):
        assert map_nested(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       num_proc=SCREAMING_SNAKE_CASE_    ) == expected_map_nested_sa
        assert map_nested(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       num_proc=SCREAMING_SNAKE_CASE_    ) == expected_map_nested_sa
        assert map_nested(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       num_proc=SCREAMING_SNAKE_CASE_    ) == expected_map_nested_sa
        assert map_nested(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       num_proc=SCREAMING_SNAKE_CASE_    ) == expected_map_nested_sa
        assert map_nested(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       num_proc=SCREAMING_SNAKE_CASE_    ) == expected_map_nested_sa









'''simple docstring'''


from ...configuration_utils import PretrainedConfig

class    lowerCAmelCase_		(		__magic_name__		):
 __lowerCamelCase						:							List[str]         =					"bert-generation"




 def __init__(	self			,     _lowerCAmelCase=50358			,     _lowerCAmelCase=1024			,     _lowerCAmelCase=24			,     _lowerCAmelCase=16			,     _lowerCAmelCase=4096			,     _lowerCAmelCase="gelu"			,     _lowerCAmelCase=0.1			,     _lowerCAmelCase=0.1			,     _lowerCAmelCase=512			,     _lowerCAmelCase=0.02			,     _lowerCAmelCase=1E-12			,     _lowerCAmelCase=0			,     _lowerCAmelCase=2			,     _lowerCAmelCase=1			,     _lowerCAmelCase="absolute"			,     _lowerCAmelCase=True			,     **_lowerCAmelCase			,     )    ->							Tuple:
     super().__init__(pad_token_id=_lowerCAmelCase			,     bos_token_id=_lowerCAmelCase			,     eos_token_id=_lowerCAmelCase			,     **_lowerCAmelCase		)

     _lowerCAmelCase				=      vocab_size
     _lowerCAmelCase				=      hidden_size
     _lowerCAmelCase				=      num_hidden_layers
     _lowerCAmelCase				=      num_attention_heads
     _lowerCAmelCase				=      hidden_act
     _lowerCAmelCase				=      intermediate_size
     _lowerCAmelCase				=      hidden_dropout_prob
     _lowerCAmelCase				=      attention_probs_dropout_prob
     _lowerCAmelCase				=      max_position_embeddings
     _lowerCAmelCase				=      initializer_range
     _lowerCAmelCase				=      layer_norm_eps
     _lowerCAmelCase				=      position_embedding_type
     _lowerCAmelCase				=      use_cache


