






"""simple docstring"""







import random

import torch
from huggingface_hub import HfApi

from diffusers import UNetaDModel


a			:    str				 =		HfApi()

a			:    List[str]				 =		{}
# fmt: off
a			:    Optional[int]				 =		torch.tensor([
    -0.75_15, -1.68_83, 0.24_20, 0.03_00, 0.63_47, 1.34_33, -1.17_43, -3.74_67,
    1.23_42, -2.24_85, 0.46_36, 0.80_76, -0.79_91, 0.39_69, 0.84_98, 0.91_89,
    -1.88_87, -3.35_22, 0.76_39, 0.20_40, 0.62_71, -2.71_48, -1.63_16, 3.08_39,
    0.31_86, 0.27_21, -0.97_59, -1.24_61, 2.62_57, 1.35_57
])
a			:    Union[str, Any]				 =		torch.tensor([
    -2.36_39, -2.53_44, 0.00_54, -0.66_74, 1.59_90, 1.01_58, 0.31_24, -2.14_36,
    1.87_95, -2.54_29, -0.15_66, -0.39_73, 1.24_90, 2.64_47, 1.22_83, -0.52_08,
    -2.81_54, -3.51_19, 2.38_38, 1.20_33, 1.72_01, -2.12_56, -1.45_76, 2.79_48,
    2.42_04, -0.97_52, -1.25_46, 0.80_27, 3.27_58, 3.13_65
])
a			:    Optional[Any]				 =		torch.tensor([
    -0.65_31, -0.68_91, -0.31_72, -0.53_75, -0.91_40, -0.53_67, -0.11_75, -0.78_69,
    -0.38_08, -0.45_13, -0.20_98, -0.00_83, 0.31_83, 0.51_40, 0.22_47, -0.13_04,
    -0.13_02, -0.28_02, -0.20_84, -0.20_25, -0.49_67, -0.48_73, -0.08_61, 0.69_25,
    0.02_50, 0.12_90, -0.15_43, 0.63_16, 1.04_60, 1.49_43
])
a			:    Optional[int]				 =		torch.tensor([
    0.09_11, 0.11_07, 0.01_82, 0.04_35, -0.08_05, -0.06_08, 0.03_81, 0.21_72,
    -0.02_80, 0.13_27, -0.02_99, -0.02_55, -0.00_50, -0.11_70, -0.10_46, 0.03_09,
    0.13_67, 0.17_28, -0.05_33, -0.07_48, -0.05_34, 0.16_24, 0.03_84, -0.18_05,
    -0.07_07, 0.06_42, 0.02_20, -0.01_34, -0.13_33, -0.15_05
])
a			:    Optional[Any]				 =		torch.tensor([
    0.13_21, 0.13_37, 0.04_40, 0.06_22, -0.05_91, -0.03_70, 0.05_03, 0.21_33,
    -0.01_77, 0.14_15, -0.01_16, -0.01_12, 0.00_44, -0.09_80, -0.07_89, 0.03_95,
    0.15_02, 0.17_85, -0.04_88, -0.05_14, -0.04_04, 0.15_39, 0.04_54, -0.15_59,
    -0.06_65, 0.06_59, 0.03_83, -0.00_05, -0.12_66, -0.13_86
])
a			:    int				 =		torch.tensor([
    0.11_54, 0.12_18, 0.03_07, 0.05_26, -0.07_11, -0.05_41, 0.03_66, 0.20_78,
    -0.02_67, 0.13_17, -0.02_26, -0.01_93, -0.00_14, -0.10_55, -0.09_02, 0.03_30,
    0.13_91, 0.17_09, -0.05_62, -0.06_93, -0.05_60, 0.14_82, 0.03_81, -0.16_83,
    -0.06_81, 0.06_61, 0.03_31, -0.00_46, -0.12_68, -0.14_31
])
a			:    Tuple				 =		torch.tensor([
    0.11_92, 0.12_40, 0.04_14, 0.06_06, -0.05_57, -0.04_12, 0.04_30, 0.20_42,
    -0.02_00, 0.13_85, -0.01_15, -0.01_32, 0.00_17, -0.09_65, -0.08_02, 0.03_98,
    0.14_33, 0.17_47, -0.04_58, -0.05_33, -0.04_07, 0.15_45, 0.04_19, -0.15_74,
    -0.06_45, 0.06_26, 0.03_41, -0.00_10, -0.11_99, -0.13_90
])
a			:    str				 =		torch.tensor([
    0.10_75, 0.10_74, 0.02_05, 0.04_31, -0.07_74, -0.06_07, 0.02_98, 0.20_42,
    -0.03_20, 0.12_67, -0.02_81, -0.02_50, -0.00_64, -0.10_91, -0.09_46, 0.02_90,
    0.13_28, 0.16_50, -0.05_80, -0.07_38, -0.05_86, 0.14_40, 0.03_37, -0.17_46,
    -0.07_12, 0.06_05, 0.02_50, -0.00_99, -0.13_16, -0.14_73
])
a			:    int				 =		torch.tensor([
    -1.45_72, -2.04_81, -0.04_14, -0.60_05, 1.41_36, 0.58_48, 0.40_28, -2.73_30,
    1.22_12, -2.12_28, 0.21_55, 0.40_39, 0.76_62, 2.05_35, 0.74_77, -0.32_43,
    -2.17_58, -2.76_48, 1.69_47, 0.70_26, 1.23_38, -1.60_78, -0.86_82, 2.28_10,
    1.85_74, -0.57_18, -0.55_86, -0.01_86, 2.34_15, 2.12_51])
a			:    int				 =		torch.tensor([
    -1.36_90, -1.97_20, -0.40_90, -0.69_66, 1.46_60, 0.99_38, -0.13_85, -2.73_24,
    0.77_36, -1.89_17, 0.29_23, 0.42_93, 0.16_93, 1.41_12, 1.18_87, -0.31_81,
    -2.21_60, -2.63_81, 1.31_70, 0.81_63, 0.92_40, -1.65_44, -0.60_99, 2.52_59,
    1.64_30, -0.90_90, -0.93_92, -0.01_26, 2.42_68, 2.32_66
])
a			:    List[Any]				 =		torch.tensor([
    -1.35_25, -1.96_28, -0.39_56, -0.68_60, 1.46_64, 1.00_14, -0.12_59, -2.72_12,
    0.77_72, -1.88_11, 0.29_96, 0.43_88, 0.17_04, 1.40_29, 1.17_01, -0.30_27,
    -2.20_53, -2.62_87, 1.33_50, 0.81_31, 0.92_74, -1.62_92, -0.60_98, 2.51_31,
    1.65_05, -0.89_58, -0.92_98, -0.01_51, 2.42_57, 2.33_55
])
a			:    Optional[Any]				 =		torch.tensor([
    -2.05_85, -2.78_97, -0.28_50, -0.89_40, 1.90_52, 0.57_02, 0.63_45, -3.89_59,
    1.59_32, -3.23_19, 0.19_74, 0.02_87, 1.75_66, 2.65_43, 0.83_87, -0.53_51,
    -3.27_36, -4.33_75, 2.90_29, 1.63_90, 1.46_40, -2.17_01, -1.90_13, 2.93_41,
    3.49_81, -0.62_55, -1.16_44, -0.15_91, 3.70_97, 3.20_66
])
a			:    List[str]				 =		torch.tensor([
    -2.31_39, -2.55_94, -0.01_97, -0.67_85, 1.70_01, 1.16_06, 0.30_75, -2.17_40,
    1.80_71, -2.56_30, -0.09_26, -0.38_11, 1.21_16, 2.62_46, 1.27_31, -0.53_98,
    -2.81_53, -3.61_40, 2.38_93, 1.32_62, 1.62_58, -2.18_56, -1.32_67, 2.83_95,
    2.37_79, -1.06_23, -1.24_68, 0.89_59, 3.33_67, 3.22_43
])
a			:    Tuple				 =		torch.tensor([
    -2.06_28, -2.76_67, -0.20_89, -0.82_63, 2.05_39, 0.59_92, 0.64_95, -3.83_36,
    1.60_25, -3.28_17, 0.17_21, -0.06_33, 1.75_16, 2.70_39, 0.81_00, -0.59_08,
    -3.21_13, -4.43_43, 2.92_57, 1.36_32, 1.55_62, -2.14_89, -1.98_94, 3.05_60,
    3.33_96, -0.73_28, -1.04_17, 0.03_83, 3.70_93, 3.23_43
])
a			:    List[Any]				 =		torch.tensor([
    -1.45_74, -2.05_69, -0.04_73, -0.61_17, 1.40_18, 0.57_69, 0.41_29, -2.73_44,
    1.22_41, -2.13_97, 0.20_00, 0.39_37, 0.76_16, 2.04_53, 0.73_24, -0.33_91,
    -2.17_46, -2.77_44, 1.69_63, 0.69_21, 1.21_87, -1.61_72, -0.88_77, 2.24_39,
    1.84_71, -0.58_39, -0.56_05, -0.04_64, 2.32_50, 2.12_19
])
# fmt: on

a			:    Dict				 =		api.list_models(filter="""diffusers""")
for mod in models:
			if "google" in mod.author or mod.modelId == "CompVis/ldm-celebahq-256":
						a			:    Tuple				 =		"""/home/patrick/google_checkpoints/""" + mod.modelId.split("""/""")[-1]

						print(F"""Started running {mod.modelId}!!!""")

						if mod.modelId.startswith("""CompVis"""):
									a			:    Any				 =		UNetaDModel.from_pretrained(local_checkpoint, subfolder="""unet""")
						else:
									a			:    Dict				 =		UNetaDModel.from_pretrained(local_checkpoint)

						torch.manual_seed(0)
						random.seed(0)

						a			:    List[Any]				 =		torch.randn(1, model.config.in_channels, model.config.sample_size, model.config.sample_size)
						a			:    Dict				 =		torch.tensor([10] * noise.shape[0])
						with torch.no_grad():
									a			:    Any				 =		model(noise, time_step).sample

						assert torch.allclose(
						    logits[0, 0, 0, :30], results["""_""".join("""_""".join(mod.modelId.split("""/""")).split("""-"""))], atol=1e-3
						)
						print(F"""{mod.modelId} has passed successfully!!!""")














"""simple docstring"""







import inspect

import jax
import jax.lax as lax
import jax.numpy as jnp

from ..utils import add_start_docstrings
from ..utils.logging import get_logger


a			:    Any				 =		get_logger(__name__)


a			:    Any				 =		r"""
    Args:
        input_ids (`jnp.ndarray` of shape `(batch_size, sequence_length)`):
            Indices of input sequence tokens in the vocabulary.

            Indices can be obtained using [`PreTrainedTokenizer`]. See [`PreTrainedTokenizer.encode`] and
            [`PreTrainedTokenizer.__call__`] for details.

            [What are input IDs?](../glossary#input-ids)
        scores (`jnp.ndarray` of shape `(batch_size, config.vocab_size)`):
            Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
            search or log softmax for each vocabulary token when using beam search
        kwargs (`Dict[str, Any]`, *optional*):
            Additional logits processor specific kwargs.

    Return:
        `jnp.ndarray` of shape `(batch_size, config.vocab_size)`: The processed prediction scores.

"""


class    __UpperCAmelCase:




						"""simple docstring"""




						@add_start_docstrings(snake_case__      )
						def __call__(       self	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												raise NotImplementedError(
												    F'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''      )


class    __UpperCAmelCase:




						"""simple docstring"""




						@add_start_docstrings(snake_case__      )
						def __call__(       self	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												raise NotImplementedError(
												    F'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''      )


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						@add_start_docstrings(snake_case__      )
						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__	,  **snake_case__      ):
												'''simple docstring'''
												for processor in self:
																		lowercase__    :				Optional[Any]=	inspect.signature(processor.__call__      ).parameters
																		if len(snake_case__      ) > 3:
																								if not all(arg in kwargs for arg in list(function_args.keys()      )[2:]      ):
																														raise ValueError(
																														    F'''Make sure that all the required parameters: {list(function_args.keys()      )} for '''
																														    F'''{processor.__class__} are passed to the logits processor.'''      )
																								lowercase__    :				Union[str, Any]=	processor(snake_case__	,  snake_case__	,  snake_case__	,  **snake_case__      )
																		else:
																								lowercase__    :				Dict=	processor(snake_case__	,  snake_case__	,  snake_case__      )
												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__      ):
												'''simple docstring'''
												if not isinstance(snake_case__	,  snake_case__      ) or not (temperature > 0):
																		raise ValueError(F'''`temperature` has to be a strictly positive float, but is {temperature}'''      )

												lowercase__    :				Any=	temperature




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				int=	scores / self.temperature
												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__	,  snake_case__ = -float("Inf"      )	,  snake_case__ = 1      ):
												'''simple docstring'''
												if not isinstance(snake_case__	,  snake_case__      ) or (top_p < 0 or top_p > 1.0):
																		raise ValueError(F'''`top_p` has to be a float > 0 and < 1, but is {top_p}'''      )
												if not isinstance(snake_case__	,  snake_case__      ) or (min_tokens_to_keep < 1):
																		raise ValueError(F'''`min_tokens_to_keep` has to be a positive integer, but is {min_tokens_to_keep}'''      )

												lowercase__    :				int=	top_p
												lowercase__    :				Optional[int]=	filter_value
												lowercase__    :				Tuple=	min_tokens_to_keep




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__,     lowercase__    :				Dict=	lax.top_k(snake_case__	,  scores.shape[-1]      )

												lowercase__    :				Optional[int]=	jnp.full_like(snake_case__	,  self.filter_value      )
												lowercase__    :				Union[str, Any]=	jax.nn.softmax(snake_case__	,  axis=-1      ).cumsum(axis=-1      )
												lowercase__    :				str=	cumulative_probs < self.top_p

												# include the token that is higher than top_p as well
												lowercase__    :				str=	jnp.roll(snake_case__	,  1      )
												score_mask |= score_mask.at[:, 0].set(snake_case__      )

												# min tokens to keep
												lowercase__    :				Optional[int]=	score_mask.at[:, : self.min_tokens_to_keep].set(snake_case__      )

												lowercase__    :				str=	jnp.where(snake_case__	,  snake_case__	,  snake_case__      )
												lowercase__    :				str=	jax.lax.sort_key_val(snake_case__	,  snake_case__      )[-1]

												return next_scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__	,  snake_case__ = -float("Inf"      )	,  snake_case__ = 1      ):
												'''simple docstring'''
												if not isinstance(snake_case__	,  snake_case__      ) or top_k <= 0:
																		raise ValueError(F'''`top_k` has to be a strictly positive integer, but is {top_k}'''      )

												lowercase__    :				List[Any]=	max(snake_case__	,  snake_case__      )
												lowercase__    :				Dict=	filter_value




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__,     lowercase__    :				Optional[Any]=	scores.shape
												lowercase__    :				int=	jnp.full(batch_size * vocab_size	,  self.filter_value      )

												lowercase__    :				Dict=	min(self.top_k	,  scores.shape[-1]      )  # Safety check
												lowercase__,     lowercase__    :				List[Any]=	lax.top_k(snake_case__	,  snake_case__      )
												lowercase__    :				Optional[int]=	jnp.broadcast_to((jnp.arange(snake_case__      ) * vocab_size)[:, None]	,  (batch_size, topk)      ).flatten()
												lowercase__    :				str=	topk_scores.flatten()
												lowercase__    :				Any=	topk_indices.flatten() + shift

												lowercase__    :				Optional[Any]=	next_scores_flat.at[topk_indices_flat].set(snake_case__      )
												lowercase__    :				str=	next_scores_flat.reshape(snake_case__	,  snake_case__      )
												return next_scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				Any=	bos_token_id




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				Any=	jnp.full(scores.shape	,  -float("inf"      )      )

												lowercase__    :				int=	1 - jnp.bool_(cur_len - 1      )

												lowercase__    :				int=	jnp.where(snake_case__	,  new_scores.at[:, self.bos_token_id].set(0      )	,  snake_case__      )

												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				Tuple=	max_length
												lowercase__    :				str=	eos_token_id




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				List[Any]=	jnp.full(scores.shape	,  -float("inf"      )      )

												lowercase__    :				Any=	1 - jnp.bool_(cur_len - self.max_length + 1      )

												lowercase__    :				Optional[int]=	jnp.where(snake_case__	,  new_scores.at[:, self.eos_token_id].set(0      )	,  snake_case__      )

												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												if not isinstance(snake_case__	,  snake_case__      ) or min_length < 0:
																		raise ValueError(F'''`min_length` has to be a positive integer, but is {min_length}'''      )

												if not isinstance(snake_case__	,  snake_case__      ) or eos_token_id < 0:
																		raise ValueError(F'''`eos_token_id` has to be a positive integer, but is {eos_token_id}'''      )

												lowercase__    :				List[str]=	min_length
												lowercase__    :				Dict=	eos_token_id




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												# create boolean flag to decide if min length penalty should be applied
												lowercase__    :				Tuple=	1 - jnp.clip(cur_len - self.min_length	,  0	,  1      )

												lowercase__    :				Dict=	jnp.where(snake_case__	,  scores.at[:, self.eos_token_id].set(-float("inf"      )      )	,  snake_case__      )

												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				Optional[Any]=	list(snake_case__      )
												lowercase__    :				List[Any]=	begin_index




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				str=	1 - jnp.bool_(cur_len - self.begin_index      )

												lowercase__    :				str=	jnp.where(snake_case__	,  scores.at[:, self.begin_suppress_tokens].set(-float("inf"      )      )	,  snake_case__      )

												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				List[Any]=	list(snake_case__      )




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				Any=	scores.at[..., self.suppress_tokens].set(-float("inf"      )      )

												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				int=	dict(snake_case__      )
												# Converts the dictionary of format {index: token} containing the tokens to be forced to an array, where the
												# index of the array corresponds to the index of the token to be forced, for XLA compatibility.
												# Indexes without forced tokens will have a negative value.
												lowercase__    :				List[Any]=	jnp.ones((max(force_token_map.keys()      ) + 1)	,  dtype=jnp.intaa      ) * -1
												for index, token in force_token_map.items():
																		if token is not None:
																								lowercase__    :				List[Any]=	force_token_array.at[index].set(snake_case__      )
												lowercase__    :				int=	jnp.intaa(snake_case__      )




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												def _force_token(snake_case__      ):
																		lowercase__    :				Dict=	scores.shape[0]
																		lowercase__    :				Any=	self.force_token_array[generation_idx]

																		lowercase__    :				List[Any]=	jnp.ones_like(snake_case__	,  dtype=scores.dtype      ) * -float("inf"      )
																		lowercase__    :				List[Any]=	jnp.zeros((batch_size, 1)	,  dtype=scores.dtype      )
																		lowercase__    :				List[str]=	lax.dynamic_update_slice(snake_case__	,  snake_case__	,  (0, current_token)      )
																		return new_scores

												lowercase__    :				Dict=	lax.cond(
												    cur_len >= self.force_token_array.shape[0]	,  lambda: scores	,  lambda: lax.cond(
												        self.force_token_array[cur_len] >= 0	,  lambda: _force_token(snake_case__      )	,  lambda: scores	,  )	,  )
												return scores


class    __UpperCAmelCase(       SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						def __init__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												lowercase__    :				str=	generate_config.eos_token_id
												lowercase__    :				Optional[int]=	generate_config.no_timestamps_token_id
												lowercase__    :				Dict=	generate_config.no_timestamps_token_id + 1

												lowercase__    :				List[Any]=	decoder_input_length + 1

												if generate_config.is_multilingual:
																		# room for language token and task token
																		self.begin_index += 2
												if hasattr(snake_case__	,  "max_initial_timestamp_index"      ):
																		lowercase__    :				int=	generate_config.max_initial_timestamp_index
												else:
																		lowercase__    :				Dict=	model_config.vocab_size
												if self.max_initial_timestamp_index is None:
																		lowercase__    :				str=	model_config.vocab_size




						def __call__(       self	,  snake_case__	,  snake_case__	,  snake_case__      ):
												'''simple docstring'''
												# suppress <|notimestamps|> which is handled by without_timestamps
												lowercase__    :				int=	scores.at[:, self.no_timestamps_token_id].set(-float("inf"      )      )

												def handle_pairs(snake_case__	,  snake_case__      ):
																		lowercase__    :				Union[str, Any]=	jnp.where((cur_len - self.begin_index) >= 1	,  snake_case__	,  snake_case__      )
																		lowercase__    :				Tuple=	jnp.where(
																		    input_ids_k[cur_len - 1] >= self.timestamp_begin	,  True and last_was_timestamp	,  snake_case__	,  )

																		lowercase__    :				int=	jnp.where((cur_len - self.begin_index) < 2	,  snake_case__	,  snake_case__      )
																		lowercase__    :				Optional[int]=	jnp.where(
																		    input_ids_k[cur_len - 2] >= self.timestamp_begin	,  snake_case__	,  snake_case__	,  )

																		return jnp.where(
																		    snake_case__	,  jnp.where(
																		        penultimate_was_timestamp > 0	,  scores_k.at[self.timestamp_begin :].set(-float("inf"      )      )	,  scores_k.at[: self.eos_token_id].set(-float("inf"      )      )	,  )	,  snake_case__	,  )

												lowercase__    :				List[str]=	jax.vmap(snake_case__      )(snake_case__	,  snake_case__      )

												lowercase__    :				str=	jnp.where(cur_len == self.begin_index	,  snake_case__	,  snake_case__      )
												lowercase__    :				List[Any]=	jnp.where(
												    self.max_initial_timestamp_index is not None	,  True and apply_max_initial_timestamp	,  snake_case__	,  )

												lowercase__    :				Any=	self.timestamp_begin + self.max_initial_timestamp_index

												lowercase__    :				str=	jnp.where(
												    snake_case__	,  scores.at[:, last_allowed + 1 :].set(-float("inf"      )      )	,  snake_case__	,  )

												# if sum of probability over timestamps is above any other token, sample timestamp
												lowercase__    :				str=	jax.nn.log_softmax(snake_case__	,  axis=-1      )

												def handle_cumulative_probs(snake_case__	,  snake_case__      ):
																		lowercase__    :				Dict=	jax.nn.logsumexp(logprobs_k[self.timestamp_begin :]	,  axis=-1      )
																		lowercase__    :				Union[str, Any]=	jnp.max(logprobs_k[: self.timestamp_begin]      )
																		return jnp.where(
																		    timestamp_logprob > max_text_token_logprob	,  scores_k.at[: self.timestamp_begin].set(-float("inf"      )      )	,  snake_case__	,  )

												lowercase__    :				Optional[int]=	jax.vmap(snake_case__      )(snake_case__	,  snake_case__      )

												return scores






