def ul2_objective(dataset: tf.data.Dataset,

sequence_length: seqio.preprocessors.SequenceLengthType,
output_features: seqio.preprocessors.OutputFeaturesType,
use_prefix_lm_task: bool = False,
rates: Optional[Sequence[float]] = None,
mean_noise_span_lengths: Sequence[float] = (3.0,),
noise_densities: Sequence[float] = (0.15,),
shard_ds: bool = True,
optional_task_prefixes: Optional[Sequence[str]] = None,
input_feature_key: str = "inputs",
merge_examples_to_reduce_padding: bool = True,
reserved_for_packing: bool = None,
seed: int = 7) -> tf.data.Dataset:

"""UL2-like pre-training objectives.

This preprocessor amounts to calling the ‘span_corruption‘ function several
times with different values of ‘noise_density‘ and ‘mean_noise_span_length‘.
We either shard or copy the dataset, then apply each function to each shard.
Add S-denoising (prefixLM) using use_prefix_lm_task.

Args:

dataset: A tf.data.Dataset with dictionaries containing the key

‘input_feature_key‘.
UL2- Unifying Language Learning Paradigms