




import functools
import math

import flax.linen as nn
import jax
import jax.numpy as jnp


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase = 4096   )->  Union[str, Any]:
		SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       key.shape[-3:]
		SCREAMING_SNAKE_CASE_							=       value.shape[-1]
		SCREAMING_SNAKE_CASE_							=       min(lowerCAmelCase						,	lowerCAmelCase   )
		SCREAMING_SNAKE_CASE_							=       query / jnp.sqrt(lowerCAmelCase   )

		@functools.partial(jax.checkpoint						,	prevent_cse=lowerCAmelCase   )
		def summarize_chunk(lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase   ):
				SCREAMING_SNAKE_CASE_							=       jnp.einsum('...qhd,...khd->...qhk'						,	lowerCAmelCase						,	lowerCAmelCase						,	precision=lowerCAmelCase   )

				SCREAMING_SNAKE_CASE_							=       jnp.max(lowerCAmelCase						,	axis=-1						,	keepdims=lowerCAmelCase   )
				SCREAMING_SNAKE_CASE_							=       jax.lax.stop_gradient(lowerCAmelCase   )
				SCREAMING_SNAKE_CASE_							=       jnp.exp(attn_weights - max_score   )

				SCREAMING_SNAKE_CASE_							=       jnp.einsum('...vhf,...qhv->...qhf'						,	lowerCAmelCase						,	lowerCAmelCase						,	precision=lowerCAmelCase   )
				SCREAMING_SNAKE_CASE_							=       jnp.einsum('...qhk->...qh'						,	lowerCAmelCase   )

				return (exp_values, exp_weights.sum(axis=-1   ), max_score)

		def chunk_scanner(lowerCAmelCase   ):
				# julienne key array
				SCREAMING_SNAKE_CASE_							=       jax.lax.dynamic_slice(
				    operand=lowerCAmelCase						,	start_indices=[0] * (key.ndim - 3) + [chunk_idx, 0, 0]						,	slice_sizes=list(key.shape[:-3]   ) + [key_chunk_size, num_heads, k_features]						,	)

				# julienne value array
				SCREAMING_SNAKE_CASE_							=       jax.lax.dynamic_slice(
				    operand=lowerCAmelCase						,	start_indices=[0] * (value.ndim - 3) + [chunk_idx, 0, 0]						,	slice_sizes=list(value.shape[:-3]   ) + [key_chunk_size, num_heads, v_features]						,	)

				return summarize_chunk(lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase   )

		SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       jax.lax.map(f=lowerCAmelCase						,	xs=jnp.arange(0						,	lowerCAmelCase						,	lowerCAmelCase   )   )

		SCREAMING_SNAKE_CASE_							=       jnp.max(lowerCAmelCase						,	axis=0						,	keepdims=lowerCAmelCase   )
		SCREAMING_SNAKE_CASE_							=       jnp.exp(chunk_max - global_max   )

		chunk_values *= jnp.expand_dims(lowerCAmelCase						,	axis=-1   )
		chunk_weights *= max_diffs

		SCREAMING_SNAKE_CASE_							=       chunk_values.sum(axis=0   )
		SCREAMING_SNAKE_CASE_							=       jnp.expand_dims(lowerCAmelCase						,	-1   ).sum(axis=0   )

		return all_values / all_weights


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase						,	lowerCAmelCase=jax.lax.Precision.HIGHEST						,	lowerCAmelCase = 1024						,	lowerCAmelCase = 4096   )->  Tuple:
		SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       query.shape[-3:]

		def chunk_scanner(lowerCAmelCase						,	lowerCAmelCase   ):
				# julienne query array
				SCREAMING_SNAKE_CASE_							=       jax.lax.dynamic_slice(
				    operand=lowerCAmelCase						,	start_indices=([0] * (query.ndim - 3)) + [chunk_idx, 0, 0]						,	slice_sizes=list(query.shape[:-3]   ) + [min(lowerCAmelCase						,	lowerCAmelCase   ), num_heads, q_features]						,	)

				return (
				    chunk_idx + query_chunk_size,  # unused ignore it
				    _query_chunk_attention(
				        query=lowerCAmelCase						,	key=lowerCAmelCase						,	value=lowerCAmelCase						,	precision=lowerCAmelCase						,	key_chunk_size=lowerCAmelCase   ),
				)

		SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       jax.lax.scan(
		    f=lowerCAmelCase						,	init=0						,	xs=lowerCAmelCase						,	length=math.ceil(num_q / query_chunk_size   )   )

		return jnp.concatenate(lowerCAmelCase						,	axis=-3   )  # fuse the chunked result back



class       lowercase_		(nn.Module   ):
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=8
						lowerCAmelCase__ 			=64
						lowerCAmelCase__ 			=0.0
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=jnp.floataa



						def   __a				( self  :      List[str]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.dim_head * self.heads
								SCREAMING_SNAKE_CASE_							=       self.dim_head**-0.5

								# Weights were exported with old names {to_q, to_k, to_v, to_out}
								SCREAMING_SNAKE_CASE_							=       nn.Dense(snake_case__				,       use_bias=snake_case__				,       dtype=self.dtype				,       name='to_q'     )
								SCREAMING_SNAKE_CASE_							=       nn.Dense(snake_case__				,       use_bias=snake_case__				,       dtype=self.dtype				,       name='to_k'     )
								SCREAMING_SNAKE_CASE_							=       nn.Dense(snake_case__				,       use_bias=snake_case__				,       dtype=self.dtype				,       name='to_v'     )

								SCREAMING_SNAKE_CASE_							=       nn.Dense(self.query_dim				,       dtype=self.dtype				,       name='to_out_0'     )
								SCREAMING_SNAKE_CASE_							=       nn.Dropout(rate=self.dropout     )



						def   __a				( self  :      str				,       snake_case__  :      Optional[int]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       tensor.shape
								SCREAMING_SNAKE_CASE_							=       self.heads
								SCREAMING_SNAKE_CASE_							=       tensor.reshape(snake_case__				,       snake_case__				,       snake_case__				,       dim // head_size     )
								SCREAMING_SNAKE_CASE_							=       jnp.transpose(snake_case__				,       (0, 2, 1, 3)     )
								SCREAMING_SNAKE_CASE_							=       tensor.reshape(batch_size * head_size				,       snake_case__				,       dim // head_size     )
								return tensor



						def   __a				( self  :      str				,       snake_case__  :      Dict     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       tensor.shape
								SCREAMING_SNAKE_CASE_							=       self.heads
								SCREAMING_SNAKE_CASE_							=       tensor.reshape(batch_size // head_size				,       snake_case__				,       snake_case__				,       snake_case__     )
								SCREAMING_SNAKE_CASE_							=       jnp.transpose(snake_case__				,       (0, 2, 1, 3)     )
								SCREAMING_SNAKE_CASE_							=       tensor.reshape(batch_size // head_size				,       snake_case__				,       dim * head_size     )
								return tensor






						def __call__( self  :      Optional[int]				,       snake_case__  :      Dict				,       snake_case__  :      Union[str, Any]=None				,       snake_case__  :      Optional[int]=True     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       hidden_states if context is None else context

								SCREAMING_SNAKE_CASE_							=       self.query(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       self.key(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       self.value(snake_case__     )

								SCREAMING_SNAKE_CASE_							=       self.reshape_heads_to_batch_dim(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       self.reshape_heads_to_batch_dim(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       self.reshape_heads_to_batch_dim(snake_case__     )

								if self.use_memory_efficient_attention:
										SCREAMING_SNAKE_CASE_							=       query_states.transpose(1				,       0				,       2     )
										SCREAMING_SNAKE_CASE_							=       key_states.transpose(1				,       0				,       2     )
										SCREAMING_SNAKE_CASE_							=       value_states.transpose(1				,       0				,       2     )

										# this if statement create a chunk size for each layer of the unet
										# the chunk size is equal to the query_length dimension of the deepest layer of the unet

										SCREAMING_SNAKE_CASE_							=       query_states.shape[-3]
										if flatten_latent_dim % 64 == 0:
												SCREAMING_SNAKE_CASE_							=       int(flatten_latent_dim / 64     )
										elif flatten_latent_dim % 16 == 0:
												SCREAMING_SNAKE_CASE_							=       int(flatten_latent_dim / 16     )
										elif flatten_latent_dim % 4 == 0:
												SCREAMING_SNAKE_CASE_							=       int(flatten_latent_dim / 4     )
										else:
												SCREAMING_SNAKE_CASE_							=       int(snake_case__     )

										SCREAMING_SNAKE_CASE_							=       jax_memory_efficient_attention(
										    snake_case__				,       snake_case__				,       snake_case__				,       query_chunk_size=snake_case__				,       key_chunk_size=40_96 * 4     )

										SCREAMING_SNAKE_CASE_							=       hidden_states.transpose(1				,       0				,       2     )
								else:
										# compute attentions
										SCREAMING_SNAKE_CASE_							=       jnp.einsum('b i d, b j d->b i j'				,       snake_case__				,       snake_case__     )
										SCREAMING_SNAKE_CASE_							=       attention_scores * self.scale
										SCREAMING_SNAKE_CASE_							=       nn.softmax(snake_case__				,       axis=2     )

										# attend to values
										SCREAMING_SNAKE_CASE_							=       jnp.einsum('b i j, b j d -> b i d'				,       snake_case__				,       snake_case__     )

								SCREAMING_SNAKE_CASE_							=       self.reshape_batch_dim_to_heads(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       self.proj_attn(snake_case__     )
								return self.dropout_layer(snake_case__				,       deterministic=snake_case__     )



class       lowercase_		(nn.Module   ):
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=0.0
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=jnp.floataa
						lowerCAmelCase__ 			=False



						def   __a				( self  :      Tuple     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       FlaxAttention(
								    self.dim				,       self.n_heads				,       self.d_head				,       self.dropout				,       self.use_memory_efficient_attention				,       dtype=self.dtype     )
								# cross attention
								SCREAMING_SNAKE_CASE_							=       FlaxAttention(
								    self.dim				,       self.n_heads				,       self.d_head				,       self.dropout				,       self.use_memory_efficient_attention				,       dtype=self.dtype     )
								SCREAMING_SNAKE_CASE_							=       FlaxFeedForward(dim=self.dim				,       dropout=self.dropout				,       dtype=self.dtype     )
								SCREAMING_SNAKE_CASE_							=       nn.LayerNorm(epsilon=1e-5				,       dtype=self.dtype     )
								SCREAMING_SNAKE_CASE_							=       nn.LayerNorm(epsilon=1e-5				,       dtype=self.dtype     )
								SCREAMING_SNAKE_CASE_							=       nn.LayerNorm(epsilon=1e-5				,       dtype=self.dtype     )
								SCREAMING_SNAKE_CASE_							=       nn.Dropout(rate=self.dropout     )






						def __call__( self  :      Dict				,       snake_case__  :      Optional[Any]				,       snake_case__  :      Dict				,       snake_case__  :      Any=True     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       hidden_states
								if self.only_cross_attention:
										SCREAMING_SNAKE_CASE_							=       self.attna(self.norma(snake_case__     )				,       snake_case__				,       deterministic=snake_case__     )
								else:
										SCREAMING_SNAKE_CASE_							=       self.attna(self.norma(snake_case__     )				,       deterministic=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       hidden_states + residual

								# cross attention
								SCREAMING_SNAKE_CASE_							=       hidden_states
								SCREAMING_SNAKE_CASE_							=       self.attna(self.norma(snake_case__     )				,       snake_case__				,       deterministic=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       hidden_states + residual

								# feed forward
								SCREAMING_SNAKE_CASE_							=       hidden_states
								SCREAMING_SNAKE_CASE_							=       self.ff(self.norma(snake_case__     )				,       deterministic=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       hidden_states + residual

								return self.dropout_layer(snake_case__				,       deterministic=snake_case__     )



class       lowercase_		(nn.Module   ):
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=1
						lowerCAmelCase__ 			=0.0
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=jnp.floataa
						lowerCAmelCase__ 			=False



						def   __a				( self  :      Dict     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       nn.GroupNorm(num_groups=32				,       epsilon=1e-5     )

								SCREAMING_SNAKE_CASE_							=       self.n_heads * self.d_head
								if self.use_linear_projection:
										SCREAMING_SNAKE_CASE_							=       nn.Dense(snake_case__				,       dtype=self.dtype     )
								else:
										SCREAMING_SNAKE_CASE_							=       nn.Conv(
										    snake_case__				,       kernel_size=(1, 1)				,       strides=(1, 1)				,       padding='VALID'				,       dtype=self.dtype				,       )

								SCREAMING_SNAKE_CASE_							=       [
								    FlaxBasicTransformerBlock(
								        snake_case__				,       self.n_heads				,       self.d_head				,       dropout=self.dropout				,       only_cross_attention=self.only_cross_attention				,       dtype=self.dtype				,       use_memory_efficient_attention=self.use_memory_efficient_attention				,       )
								    for _ in range(self.depth     )
								]

								if self.use_linear_projection:
										SCREAMING_SNAKE_CASE_							=       nn.Dense(snake_case__				,       dtype=self.dtype     )
								else:
										SCREAMING_SNAKE_CASE_							=       nn.Conv(
										    snake_case__				,       kernel_size=(1, 1)				,       strides=(1, 1)				,       padding='VALID'				,       dtype=self.dtype				,       )

								SCREAMING_SNAKE_CASE_							=       nn.Dropout(rate=self.dropout     )






						def __call__( self  :      int				,       snake_case__  :      Tuple				,       snake_case__  :      Optional[Any]				,       snake_case__  :      List[Any]=True     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       hidden_states.shape
								SCREAMING_SNAKE_CASE_							=       hidden_states
								SCREAMING_SNAKE_CASE_							=       self.norm(snake_case__     )
								if self.use_linear_projection:
										SCREAMING_SNAKE_CASE_							=       hidden_states.reshape(snake_case__				,       height * width				,       snake_case__     )
										SCREAMING_SNAKE_CASE_							=       self.proj_in(snake_case__     )
								else:
										SCREAMING_SNAKE_CASE_							=       self.proj_in(snake_case__     )
										SCREAMING_SNAKE_CASE_							=       hidden_states.reshape(snake_case__				,       height * width				,       snake_case__     )

								for transformer_block in self.transformer_blocks:
										SCREAMING_SNAKE_CASE_							=       transformer_block(snake_case__				,       snake_case__				,       deterministic=snake_case__     )

								if self.use_linear_projection:
										SCREAMING_SNAKE_CASE_							=       self.proj_out(snake_case__     )
										SCREAMING_SNAKE_CASE_							=       hidden_states.reshape(snake_case__				,       snake_case__				,       snake_case__				,       snake_case__     )
								else:
										SCREAMING_SNAKE_CASE_							=       hidden_states.reshape(snake_case__				,       snake_case__				,       snake_case__				,       snake_case__     )
										SCREAMING_SNAKE_CASE_							=       self.proj_out(snake_case__     )

								SCREAMING_SNAKE_CASE_							=       hidden_states + residual
								return self.dropout_layer(snake_case__				,       deterministic=snake_case__     )



class       lowercase_		(nn.Module   ):
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=0.0
						lowerCAmelCase__ 			=jnp.floataa



						def   __a				( self  :      Tuple     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       FlaxGEGLU(self.dim				,       self.dropout				,       self.dtype     )
								SCREAMING_SNAKE_CASE_							=       nn.Dense(self.dim				,       dtype=self.dtype     )






						def __call__( self  :      List[Any]				,       snake_case__  :      Union[str, Any]				,       snake_case__  :      Any=True     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.net_a(snake_case__				,       deterministic=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       self.net_a(snake_case__     )
								return hidden_states



class       lowercase_		(nn.Module   ):
						lowerCAmelCase__ 			=42
						lowerCAmelCase__ 			=0.0
						lowerCAmelCase__ 			=jnp.floataa



						def   __a				( self  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.dim * 4
								SCREAMING_SNAKE_CASE_							=       nn.Dense(inner_dim * 2				,       dtype=self.dtype     )
								SCREAMING_SNAKE_CASE_							=       nn.Dropout(rate=self.dropout     )






						def __call__( self  :      Optional[Any]				,       snake_case__  :      List[Any]				,       snake_case__  :      List[str]=True     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.proj(snake_case__     )
								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       jnp.split(snake_case__				,       2				,       axis=2     )
								return self.dropout_layer(hidden_linear * nn.gelu(snake_case__     )				,       deterministic=snake_case__     )





import unittest

from transformers import (
    MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
    TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
    SummarizationPipeline,
    TFPreTrainedModel,
    pipeline,
)
from transformers.testing_utils import get_gpu_count, is_pipeline_test, require_tf, require_torch, slow, torch_device
from transformers.tokenization_utils import TruncationStrategy

from .test_pipelines_common import ANY


SCREAMING_SNAKE_CASE:    Optional[Any]											=   -1 if torch_device == '''cpu''' else 0



@is_pipeline_test
class       lowercase_		(unittest.TestCase   ):
						lowerCAmelCase__ 			=MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING
						lowerCAmelCase__ 			=TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING



						def   __a				( self  :      Optional[Any]				,       snake_case__  :      Tuple				,       snake_case__  :      Tuple				,       snake_case__  :      Optional[Any]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       SummarizationPipeline(model=snake_case__				,       tokenizer=snake_case__     )
								return summarizer, ["(CNN)The Palestinian Authority officially became", "Some other text"]



						def   __a				( self  :      Tuple				,       snake_case__  :      str				,       snake_case__  :      Union[str, Any]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       summarizer.model

								SCREAMING_SNAKE_CASE_							=       summarizer('(CNN)The Palestinian Authority officially became'     )
								self.assertEqual(snake_case__				,       [{'summary_text': ANY(snake_case__     )}]     )

								SCREAMING_SNAKE_CASE_							=       summarizer(
								    '(CNN)The Palestinian Authority officially became '				,       num_beams=2				,       min_length=2				,       max_length=5				,       )
								self.assertEqual(snake_case__				,       [{'summary_text': ANY(snake_case__     )}]     )

								# Some models (Switch Transformers, LED, T5, LongT5, etc) can handle long sequences.
								SCREAMING_SNAKE_CASE_							=       [
								    'SwitchTransformersConfig',
								    'T5Config',
								    'LongT5Config',
								    'LEDConfig',
								    'PegasusXConfig',
								    'FSMTConfig',
								    'M2M100Config',
								    'ProphetNetConfig',  # positional embeddings up to a fixed maximum size (otherwise clamping the values)
								]
								if model.config.__class__.__name__ not in model_can_handle_longer_seq:
										# Too long and exception is expected.
										# For TF models, if the weights are initialized in GPU context, we won't get expected index error from
										# the embedding layer.
										if not (
										    isinstance(snake_case__				,       snake_case__     )
										    and get_gpu_count() > 0
										    and len(summarizer.model.trainable_weights     ) > 0
										):
												with self.assertRaises(snake_case__     ):
														SCREAMING_SNAKE_CASE_							=       summarizer('This ' * 10_00     )
								SCREAMING_SNAKE_CASE_							=       summarizer('This ' * 10_00				,       truncation=TruncationStrategy.ONLY_FIRST     )



						@require_torch
						def   __a				( self  :      Dict     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       pipeline(task='summarization'				,       model='sshleifer/tiny-mbart'				,       framework='pt'     )
								SCREAMING_SNAKE_CASE_							=       summarizer('This is a small test'     )
								self.assertEqual(
								    snake_case__				,       [
								        {
								            'summary_text': 'เข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไป'
								        }
								    ]				,       )



						@require_tf
						def   __a				( self  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       pipeline(task='summarization'				,       model='sshleifer/tiny-mbart'				,       framework='tf'     )
								SCREAMING_SNAKE_CASE_							=       summarizer('This is a small test'     )
								self.assertEqual(
								    snake_case__				,       [
								        {
								            'summary_text': 'เข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไปเข้าไป'
								        }
								    ]				,       )






						@require_torch
						@slow
						def   __a				( self  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       pipeline(task='summarization'				,       device=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       (
								    ' (CNN)The Palestinian Authority officially became the 123rd member of the International Criminal Court on'
								    ' Wednesday, a step that gives the court jurisdiction over alleged crimes in Palestinian territories. The'
								    ' formal accession was marked with a ceremony at The Hague, in the Netherlands, where the court is based.'
								    ' The Palestinians signed the ICC\'s founding Rome Statute in January, when they also accepted its'
								    ' jurisdiction over alleged crimes committed "in the occupied Palestinian territory, including East'
								    ' Jerusalem, since June 13, 2014." Later that month, the ICC opened a preliminary examination into the'
								    ' situation in Palestinian territories, paving the way for possible war crimes investigations against'
								    ' Israelis. As members of the court, Palestinians may be subject to counter-charges as well. Israel and'
								    ' the United States, neither of which is an ICC member, opposed the Palestinians\' efforts to join the'
								    ' body. But Palestinian Foreign Minister Riad al-Malki, speaking at Wednesday\'s ceremony, said it was a'
								    ' move toward greater justice. "As Palestine formally becomes a State Party to the Rome Statute today, the'
								    ' world is also a step closer to ending a long era of impunity and injustice," he said, according to an'
								    ' ICC news release. "Indeed, today brings us closer to our shared goals of justice and peace." Judge'
								    ' Kuniko Ozaki, a vice president of the ICC, said acceding to the treaty was just the first step for the'
								    ' Palestinians. "As the Rome Statute today enters into force for the State of Palestine, Palestine'
								    ' acquires all the rights as well as responsibilities that come with being a State Party to the Statute.'
								    ' These are substantive commitments, which cannot be taken lightly," she said. Rights group Human Rights'
								    ' Watch welcomed the development. "Governments seeking to penalize Palestine for joining the ICC should'
								    ' immediately end their pressure, and countries that support universal acceptance of the court\'s treaty'
								    ' should speak out to welcome its membership," said Balkees Jarrah, international justice counsel for the'
								    ' group. \"What\'s objectionable is the attempts to undermine international justice, not Palestine\'s'
								    ' decision to join a treaty to which over 100 countries around the world are members." In January, when'
								    ' the preliminary ICC examination was opened, Israeli Prime Minister Benjamin Netanyahu described it as an'
								    ' outrage, saying the court was overstepping its boundaries. The United States also said it "strongly"'
								    ' disagreed with the court\'s decision. \"As we have said repeatedly, we do not believe that Palestine is a'
								    ' state and therefore we do not believe that it is eligible to join the ICC," the State Department said in'
								    ' a statement. It urged the warring sides to resolve their differences through direct negotiations. "We'
								    ' will continue to oppose actions against Israel at the ICC as counterproductive to the cause of peace,"'
								    ' it said. But the ICC begs to differ with the definition of a state for its purposes and refers to the'
								    ' territories as "Palestine." While a preliminary examination is not a formal investigation, it allows the'
								    ' court to review evidence and determine whether to investigate suspects on both sides. Prosecutor Fatou'
								    ' Bensouda said her office would "conduct its analysis in full independence and impartiality." The war'
								    ' between Israel and Hamas militants in Gaza last summer left more than 2,000 people dead. The inquiry'
								    ' will include alleged war crimes committed since June. The International Criminal Court was set up in'
								    ' 2002 to prosecute genocide, crimes against humanity and war crimes. CNN\'s Vasco Cotovio, Kareem Khadder'
								    ' and Faith Karimi contributed to this report.'
								)
								SCREAMING_SNAKE_CASE_							=       (
								    ' The Palestinian Authority becomes the 123rd member of the International Criminal Court . The move gives'
								    ' the court jurisdiction over alleged crimes in Palestinian territories . Israel and the United States'
								    ' opposed the Palestinians\' efforts to join the court . Rights group Human Rights Watch welcomes the move,'
								    ' says governments seeking to penalize Palestine should end pressure .'
								)
								SCREAMING_SNAKE_CASE_							=       summarizer(snake_case__     )
								self.assertEqual(result[0]['summary_text']				,       snake_case__     )