

import inspect
from typing import Optional, Union

import numpy as np
import PIL
import torch
from torch.nn import functional as F
from torchvision import transforms
from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    DPMSolverMultistepScheduler,
    LMSDiscreteScheduler,
    PNDMScheduler,
    UNetaDConditionModel,
)
from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion import StableDiffusionPipelineOutput
from diffusers.utils import (
    PIL_INTERPOLATION,
    randn_tensor,
)




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     List[Any]:
  if isinstance(snake_case_	,		torch.Tensor	):
    return image
  elif isinstance(snake_case_	,		PIL.Image.Image	):
    lowercase__			    =						[image]

  if isinstance(image[0]	,		PIL.Image.Image	):
    lowercase__			    =						[np.array(i.resize((w, h)	,		resample=PIL_INTERPOLATION['lanczos']	)	)[None, :] for i in image]
    lowercase__			    =						np.concatenate(snake_case_	,		axis=0	)
    lowercase__			    =						np.array(snake_case_	).astype(np.floataa	) / 255.0
    lowercase__			    =						image.transpose(0	,		3	,		1	,		2	)
    lowercase__			    =						2.0 * image - 1.0
    lowercase__			    =						torch.from_numpy(snake_case_	)
  elif isinstance(image[0]	,		torch.Tensor	):
    lowercase__			    =						torch.cat(snake_case_	,		dim=0	)
  return image




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE=0.9_9_9_5	)       ->     List[Any]:
  if not isinstance(snake_case_	,		np.ndarray	):
    lowercase__			    =						True
    lowercase__			    =						va.device
    lowercase__			    =						va.cpu().numpy()
    lowercase__			    =						va.cpu().numpy()

  lowercase__			    =						np.sum(va * va / (np.linalg.norm(snake_case_	) * np.linalg.norm(snake_case_	))	)
  if np.abs(snake_case_	) > DOT_THRESHOLD:
    lowercase__			    =						(1 - t) * va + t * va
  else:
    lowercase__			    =						np.arccos(snake_case_	)
    lowercase__			    =						np.sin(snake_case_	)
    lowercase__			    =						theta_a * t
    lowercase__			    =						np.sin(snake_case_	)
    lowercase__			    =						np.sin(theta_a - theta_t	) / sin_theta_a
    lowercase__			    =						sin_theta_t / sin_theta_a
    lowercase__			    =						sa * va + sa * va

  if inputs_are_torch:
    lowercase__			    =						torch.from_numpy(snake_case_	).to(snake_case_	)

  return va




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     str:
  lowercase__			    =						F.normalize(snake_case_	,		dim=-1	)
  lowercase__			    =						F.normalize(snake_case_	,		dim=-1	)
  return (x - y).norm(dim=-1	).div(2	).arcsin().pow(2	).mul(2	)




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     List[Any]:
  for param in model.parameters():
    lowercase__			    =						value


class        SCREAMING_SNAKE_CASE     (UpperCamelCase_   ):


   def __init__(					self    :       List[str]    ,  a    :       Tuple    ,  a    :       Tuple    ,  a    :       Union[str, Any]    ,  a    :       Any    ,  a    :       Optional[int]    ,  a    :       List[str]    ,  a    :       List[Any]    ,  a    :       Optional[Any]=None    ,  a    :       int=None    ,  a    :       Tuple=None    ,  )->     str:





     """simple docstring"""







     super().__init__()
     self.register_modules(
         vae=a    ,  text_encoder=a    ,  clip_model=a    ,  tokenizer=a    ,  unet=a    ,  scheduler=a    ,  feature_extractor=a    ,  coca_model=a    ,  coca_tokenizer=a    ,  coca_transform=a    ,  )
     lowercase__			    =						(
         feature_extractor.size
         if isinstance(feature_extractor.size    ,  a )
         else feature_extractor.size['''shortest_edge''']
     )
     lowercase__			    =						transforms.Normalize(mean=feature_extractor.image_mean    ,  std=feature_extractor.image_std )
     set_requires_grad(self.text_encoder    ,  a )
     set_requires_grad(self.clip_model    ,  a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Dict    ,  a    :       List[Any] = "auto" )->     Dict:





     """simple docstring"""







     if slice_size == "auto":
       # half the attention head size is usually a good trade-off between
       # speed and memory
       lowercase__			    =						self.unet.config.attention_head_dim // 2
     self.unet.set_attention_slice(a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Tuple )->     int:





     """simple docstring"""







     self.enable_attention_slicing(a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[Any] )->     str:





     """simple docstring"""







     set_requires_grad(self.vae    ,  a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[int] )->     Any:





     """simple docstring"""







     set_requires_grad(self.vae    ,  a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[Any] )->     Optional[Any]:





     """simple docstring"""







     set_requires_grad(self.unet    ,  a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[Any] )->     Union[str, Any]:





     """simple docstring"""







     set_requires_grad(self.unet    ,  a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Union[str, Any]    ,  a    :       Dict    ,  a    :       List[str]    ,  a    :       Union[str, Any] )->     Optional[int]:





     """simple docstring"""







     lowercase__			    =						min(int(num_inference_steps * strength )    ,  a )

     lowercase__			    =						max(num_inference_steps - init_timestep    ,  0 )
     lowercase__			    =						self.scheduler.timesteps[t_start:]

     return timesteps, num_inference_steps - t_start


   def  SCREAMING_SNAKE_CASE_							(					self    :       Tuple    ,  a    :       Tuple    ,  a    :       Dict    ,  a    :       Dict    ,  a    :       Tuple    ,  a    :       List[Any]    ,  a    :       Optional[Any]=None )->     Any:





     """simple docstring"""







     if not isinstance(a    ,  torch.Tensor ):
       raise ValueError(f"""`image` has to be of type `torch.Tensor` but is {type(a )}""" )

     lowercase__			    =						image.to(device=a    ,  dtype=a )

     if isinstance(a    ,  a ):
       lowercase__			    =						[
           self.vae.encode(image[i : i + 1] ).latent_dist.sample(generator[i] ) for i in range(a )
       ]
       lowercase__			    =						torch.cat(a    ,  dim=0 )
     else:
       lowercase__			    =						self.vae.encode(a ).latent_dist.sample(a )

     # Hardcode 0.18215 because stable-diffusion-2-base has not self.vae.config.scaling_factor
     lowercase__			    =						0.18215 * init_latents
     lowercase__			    =						init_latents.repeat_interleave(a    ,  dim=0 )

     lowercase__			    =						randn_tensor(init_latents.shape    ,  generator=a    ,  device=a    ,  dtype=a )

     # get latents
     lowercase__			    =						self.scheduler.add_noise(a    ,  a    ,  a )
     lowercase__			    =						init_latents

     return latents


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[int]    ,  a    :       Optional[int] )->     Any:





     """simple docstring"""







     lowercase__			    =						self.coca_transform(a ).unsqueeze(0 )
     with torch.no_grad(), torch.cuda.amp.autocast():
       lowercase__			    =						self.coca_model.generate(transformed_image.to(device=self.device    ,  dtype=self.coca_model.dtype ) )
     lowercase__			    =						self.coca_tokenizer.decode(generated[0].cpu().numpy() )
     return generated.split('<end_of_text>' )[0].replace('<start_of_text>'    ,  '' ).rstrip(' .,' )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[Any]    ,  a    :       Optional[Any]    ,  a    :       int )->     List[str]:





     """simple docstring"""







     lowercase__			    =						self.feature_extractor.preprocess(a )
     lowercase__			    =						torch.from_numpy(clip_image_input['pixel_values'][0] ).unsqueeze(0 ).to(self.device ).half()
     lowercase__			    =						self.clip_model.get_image_features(a )
     lowercase__			    =						image_embeddings_clip / image_embeddings_clip.norm(p=2    ,  dim=-1    ,  keepdim=a )
     lowercase__			    =						image_embeddings_clip.repeat_interleave(a    ,  dim=0 )
     return image_embeddings_clip


   @torch.enable_grad()
   def  SCREAMING_SNAKE_CASE_							(					self    :       List[str]    ,  a    :       int    ,  a    :       Union[str, Any]    ,  a    :       int    ,  a    :       List[Any]    ,  a    :       Optional[int]    ,  a    :       Dict    ,  a    :       List[Any]    ,  )->     Tuple:





     """simple docstring"""







     lowercase__			    =						latents.detach().requires_grad_()

     lowercase__			    =						self.scheduler.scale_model_input(a    ,  a )

     # predict the noise residual
     lowercase__			    =						self.unet(a    ,  a    ,  encoder_hidden_states=a ).sample

     if isinstance(self.scheduler    ,  (PNDMScheduler, DDIMScheduler, DPMSolverMultistepScheduler) ):
       lowercase__			    =						self.scheduler.alphas_cumprod[timestep]
       lowercase__			    =						1 - alpha_prod_t
       # compute predicted original sample from predicted noise also called
       # "predicted x_0" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
       lowercase__			    =						(latents - beta_prod_t ** 0.5 * noise_pred) / alpha_prod_t ** 0.5

       lowercase__			    =						torch.sqrt(a )
       lowercase__			    =						pred_original_sample * (fac) + latents * (1 - fac)
     elif isinstance(self.scheduler    ,  a ):
       lowercase__			    =						self.scheduler.sigmas[index]
       lowercase__			    =						latents - sigma * noise_pred
     else:
       raise ValueError(f"""scheduler type {type(self.scheduler )} not supported""" )

     # Hardcode 0.18215 because stable-diffusion-2-base has not self.vae.config.scaling_factor
     lowercase__			    =						1 / 0.18215 * sample
     lowercase__			    =						self.vae.decode(a ).sample
     lowercase__			    =						(image / 2 + 0.5).clamp(0    ,  1 )

     lowercase__			    =						transforms.Resize(self.feature_extractor_size )(a )
     lowercase__			    =						self.normalize(a ).to(latents.dtype )

     lowercase__			    =						self.clip_model.get_image_features(a )
     lowercase__			    =						image_embeddings_clip / image_embeddings_clip.norm(p=2    ,  dim=-1    ,  keepdim=a )

     lowercase__			    =						spherical_dist_loss(a    ,  a ).mean() * clip_guidance_scale

     lowercase__			    =						-torch.autograd.grad(a    ,  a )[0]

     if isinstance(self.scheduler    ,  a ):
       lowercase__			    =						latents.detach() + grads * (sigma**2)
       lowercase__			    =						noise_pred_original
     else:
       lowercase__			    =						noise_pred_original - torch.sqrt(a ) * grads
     return noise_pred, latents


   @torch.no_grad()
   def __call__(					self    :       int    ,  a    :       int    ,  a    :       Optional[int]    ,  a    :       List[Any] = None    ,  a    :       str = None    ,  a    :       List[str] = 512    ,  a    :       Tuple = 512    ,  a    :       List[str] = 0.6    ,  a    :       List[str] = 50    ,  a    :       Optional[Any] = 7.5    ,  a    :       Dict = 1    ,  a    :       Optional[Any] = 0.0    ,  a    :       Any = 100    ,  a    :       Optional[int] = None    ,  a    :       Union[str, Any] = "pil"    ,  a    :       int = True    ,  a    :       Optional[Any] = 0.8    ,  a    :       int = 0.1    ,  a    :       Union[str, Any] = 0.1    ,  )->     Optional[Any]:





     """simple docstring"""







     if isinstance(a    ,  a ) and len(a ) != batch_size:
       raise ValueError(f"""You have passed {batch_size} batch_size, but only {len(a )} generators.""" )

     if height % 8 != 0 or width % 8 != 0:
       raise ValueError(f"""`height` and `width` have to be divisible by 8 but are {height} and {width}.""" )

     if isinstance(a    ,  torch.Generator ) and batch_size > 1:
       lowercase__			    =						[generator] + [None] * (batch_size - 1)

     lowercase__			    =						[
         ('''model''', self.coca_model is None),
         ('''tokenizer''', self.coca_tokenizer is None),
         ('''transform''', self.coca_transform is None),
     ]
     lowercase__			    =						[x[0] for x in coca_is_none if x[1]]
     lowercase__			    =						''', '''.join(a )
     # generate prompts with coca model if prompt is None
     if content_prompt is None:
       if len(a ):
         raise ValueError(
             f"""Content prompt is None and CoCa [{coca_is_none_str}] is None."""
             f"""Set prompt or pass Coca [{coca_is_none_str}] to DiffusionPipeline.""" )
       lowercase__			    =						self.get_image_description(a )
     if style_prompt is None:
       if len(a ):
         raise ValueError(
             f"""Style prompt is None and CoCa [{coca_is_none_str}] is None."""
             f""" Set prompt or pass Coca [{coca_is_none_str}] to DiffusionPipeline.""" )
       lowercase__			    =						self.get_image_description(a )

     # get prompt text embeddings for content and style
     lowercase__			    =						self.tokenizer(
         a    ,  padding='max_length'    ,  max_length=self.tokenizer.model_max_length    ,  truncation=a    ,  return_tensors='pt'    ,  )
     lowercase__			    =						self.text_encoder(content_text_input.input_ids.to(self.device ) )[0]

     lowercase__			    =						self.tokenizer(
         a    ,  padding='max_length'    ,  max_length=self.tokenizer.model_max_length    ,  truncation=a    ,  return_tensors='pt'    ,  )
     lowercase__			    =						self.text_encoder(style_text_input.input_ids.to(self.device ) )[0]

     lowercase__			    =						slerp(a    ,  a    ,  a )

     # duplicate text embeddings for each generation per prompt
     lowercase__			    =						text_embeddings.repeat_interleave(a    ,  dim=0 )

     # set timesteps
     lowercase__			    =						'''offset''' in set(inspect.signature(self.scheduler.set_timesteps ).parameters.keys() )
     lowercase__			    =						{}
     if accepts_offset:
       lowercase__			    =						1

     self.scheduler.set_timesteps(a    ,  **a )
     # Some schedulers like PNDM have timesteps as arrays
     # It's more optimized to move all timesteps to correct device beforehand
     self.scheduler.timesteps.to(self.device )

     lowercase__			    =						self.get_timesteps(a    ,  a    ,  self.device )
     lowercase__			    =						timesteps[:1].repeat(a )

     # Preprocess image
     lowercase__			    =						preprocess(a    ,  a    ,  a )
     lowercase__			    =						self.prepare_latents(
         a    ,  a    ,  a    ,  text_embeddings.dtype    ,  self.device    ,  a )

     lowercase__			    =						preprocess(a    ,  a    ,  a )
     lowercase__			    =						self.prepare_latents(
         a    ,  a    ,  a    ,  text_embeddings.dtype    ,  self.device    ,  a )

     lowercase__			    =						slerp(a    ,  a    ,  a )

     if clip_guidance_scale > 0:
       lowercase__			    =						self.get_clip_image_embeddings(a    ,  a )
       lowercase__			    =						self.get_clip_image_embeddings(a    ,  a )
       lowercase__			    =						slerp(
           a    ,  a    ,  a )

     # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
     # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
     # corresponds to doing no classifier free guidance.
     lowercase__			    =						guidance_scale > 1.0
     # get unconditional embeddings for classifier free guidance
     if do_classifier_free_guidance:
       lowercase__			    =						content_text_input.input_ids.shape[-1]
       lowercase__			    =						self.tokenizer(['']    ,  padding='max_length'    ,  max_length=a    ,  return_tensors='pt' )
       lowercase__			    =						self.text_encoder(uncond_input.input_ids.to(self.device ) )[0]
       # duplicate unconditional embeddings for each generation per prompt
       lowercase__			    =						uncond_embeddings.repeat_interleave(a    ,  dim=0 )

       # For classifier free guidance, we need to do two forward passes.
       # Here we concatenate the unconditional and text embeddings into a single batch
       # to avoid doing two forward passes
       lowercase__			    =						torch.cat([uncond_embeddings, text_embeddings] )

     # get the initial random noise unless the user supplied it

     # Unlike in other pipelines, latents need to be generated in the target device
     # for 1-to-1 results reproducibility with the CompVis implementation.
     # However this currently doesn't work in `mps`.
     lowercase__			    =						(batch_size, self.unet.config.in_channels, height // 8, width // 8)
     lowercase__			    =						text_embeddings.dtype
     if latents is None:
       if self.device.type == "mps":
         # randn does not work reproducibly on mps
         lowercase__			    =						torch.randn(a    ,  generator=a    ,  device='cpu'    ,  dtype=a ).to(
             self.device )
       else:
         lowercase__			    =						torch.randn(a    ,  generator=a    ,  device=self.device    ,  dtype=a )
     else:
       if latents.shape != latents_shape:
         raise ValueError(f"""Unexpected latents shape, got {latents.shape}, expected {latents_shape}""" )
       lowercase__			    =						latents.to(self.device )

     # scale the initial noise by the standard deviation required by the scheduler
     lowercase__			    =						latents * self.scheduler.init_noise_sigma

     # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
     # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
     # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
     # and should be between [0, 1]
     lowercase__			    =						'''eta''' in set(inspect.signature(self.scheduler.step ).parameters.keys() )
     lowercase__			    =						{}
     if accepts_eta:
       lowercase__			    =						eta

     # check if the scheduler accepts generator
     lowercase__			    =						'''generator''' in set(inspect.signature(self.scheduler.step ).parameters.keys() )
     if accepts_generator:
       lowercase__			    =						generator

     with self.progress_bar(total=a ):
       for i, t in enumerate(a ):
         # expand the latents if we are doing classifier free guidance
         lowercase__			    =						torch.cat([latents] * 2 ) if do_classifier_free_guidance else latents
         lowercase__			    =						self.scheduler.scale_model_input(a    ,  a )

         # predict the noise residual
         lowercase__			    =						self.unet(a    ,  a    ,  encoder_hidden_states=a ).sample

         # perform classifier free guidance
         if do_classifier_free_guidance:
           lowercase__			    =						noise_pred.chunk(2 )
           lowercase__			    =						noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)

         # perform clip guidance
         if clip_guidance_scale > 0:
           lowercase__			    =						(
               text_embeddings.chunk(2 )[1] if do_classifier_free_guidance else text_embeddings
           )
           lowercase__			    =						self.cond_fn(
               a    ,  a    ,  a    ,  a    ,  a    ,  a    ,  a    ,  )

         # compute the previous noisy sample x_t -> x_t-1
         lowercase__			    =						self.scheduler.step(a    ,  a    ,  a    ,  **a ).prev_sample

          # Hardcode 0.18215 because stable-diffusion-2-base has not self.vae.config.scaling_factor
     lowercase__			    =						1 / 0.18215 * latents
     lowercase__			    =						self.vae.decode(a ).sample

     lowercase__			    =						(image / 2 + 0.5).clamp(0    ,  1 )
     lowercase__			    =						image.cpu().permute(0    ,  2    ,  3    ,  1 ).numpy()

     if output_type == "pil":
       lowercase__			    =						self.numpy_to_pil(a )

     if not return_dict:
       return (image, None)

     return StableDiffusionPipelineOutput(images=a    ,  nsfw_content_detected=a )









from scipy.stats import spearmanr

import datasets


lowercase_					     =	"""
The Spearman rank-order correlation coefficient is a measure of the
relationship between two datasets. Like other correlation coefficients,
this one varies between -1 and +1 with 0 implying no correlation.
Positive correlations imply that as data in dataset x increases, so
does data in dataset y. Negative correlations imply that as x increases,
y decreases. Correlations of -1 or +1 imply an exact monotonic relationship.

Unlike the Pearson correlation, the Spearman correlation does not
assume that both datasets are normally distributed.

The p-value roughly indicates the probability of an uncorrelated system
producing datasets that have a Spearman correlation at least as extreme
as the one computed from these datasets. The p-values are not entirely
reliable but are probably reasonable for datasets larger than 500 or so.
"""

lowercase_					     =	"""
Args:
    predictions (`List[float]`): Predicted labels, as returned by a model.
    references (`List[float]`): Ground truth labels.
    return_pvalue (`bool`): If `True`, returns the p-value. If `False`, returns
            only the spearmanr score. Defaults to `False`.
Returns:
    spearmanr (`float`): Spearman correlation coefficient.
    p-value (`float`): p-value. **Note**: is only returned if `return_pvalue=True` is input.
Examples:
    Example 1:
        >>> spearmanr_metric = datasets.load_metric(\"spearmanr\")
        >>> results = spearmanr_metric.compute(references=[1, 2, 3, 4, 5], predictions=[10, 9, 2.5, 6, 4])
        >>> print(results)
        {'spearmanr': -0.7}

    Example 2:
        >>> spearmanr_metric = datasets.load_metric(\"spearmanr\")
        >>> results = spearmanr_metric.compute(references=[1, 2, 3, 4, 5],
        ...                                     predictions=[10, 9, 2.5, 6, 4],
        ...                                     return_pvalue=True)
        >>> print(results['spearmanr'])
        -0.7
        >>> print(round(results['spearmanr_pvalue'], 2))
        0.19
"""

lowercase_					     =	R"""\
@book{kokoska2000crc,
  title={CRC standard probability and statistics tables and formulae},
  author={Kokoska, Stephen and Zwillinger, Daniel},
  year={2000},
  publisher={Crc Press}
}
@article{2020SciPy-NMeth,
  author  = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and
            Haberland, Matt and Reddy, Tyler and Cournapeau, David and
            Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and
            Bright, Jonathan and {van der Walt}, St{\'e}fan J. and
            Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and
            Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and
            Kern, Robert and Larson, Eric and Carey, C J and
            Polat, {\.I}lhan and Feng, Yu and Moore, Eric W. and
            {VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and
            Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and
            Harris, Charles R. and Archibald, Anne M. and
            Ribeiro, Ant{\^o}nio H. and Pedregosa, Fabian and
            {van Mulbregt}, Paul and {SciPy 1.0 Contributors}},
  title   = {{{SciPy} 1.0: Fundamental Algorithms for Scientific
            Computing in Python}},
  journal = {Nature Methods},
  year    = {2020},
  volume  = {17},
  pages   = {261--272},
  adsurl  = {https://rdcu.be/b08Wh},
  doi     = {10.1038/s41592-019-0686-2},
}
"""
@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION    ,			_KWARGS_DESCRIPTION   )
class        SCREAMING_SNAKE_CASE     (datasets.Metric   ):


   def  SCREAMING_SNAKE_CASE_							(					self    :       Union[str, Any] )->     Tuple:





     """simple docstring"""







     return datasets.MetricInfo(
         description=_DESCRIPTION    ,  citation=_CITATION    ,  inputs_description=_KWARGS_DESCRIPTION    ,  features=datasets.Features(
             {
                 'predictions': datasets.Value('float' ),
                 'references': datasets.Value('float' ),
             } )    ,  reference_urls=['https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.spearmanr.html']    ,  )


   def  SCREAMING_SNAKE_CASE_							(					self    :       int    ,  a    :       str    ,  a    :       Any    ,  a    :       str=False )->     Optional[int]:





     """simple docstring"""







     lowercase__			    =						spearmanr(a    ,  a )
     if return_pvalue:
       return {"spearmanr": results[0], "spearmanr_pvalue": results[1]}
     else:
       return {"spearmanr": results[0]}


