Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with span_corruption preprocessors #15

Open
mondonomo opened this issue May 15, 2022 · 0 comments
Open

Issue with span_corruption preprocessors #15

mondonomo opened this issue May 15, 2022 · 0 comments

Comments

@mondonomo
Copy link

mondonomo commented May 15, 2022

Hi, I'm trying to pretrain byt5 on the custom corpora (of short texts), but I'm stuck with the data pipeline (the code is below). When I decode the outputs, inputs and targets are merged from the different examples, and both are noised.

DEFAULT_OUTPUT_FEATURES = {
    "inputs": seqio.Feature(vocabulary=seqio.ByteVocabulary(), add_eos=True),
    "targets": seqio.Feature(vocabulary=seqio.ByteVocabulary(), add_eos=True),
}

MEAN_NOISE_SPAN_LENGTH = 5
SEQUENCE_LENGTH = sequence_length={"inputs": 128, "targets": 128}


seqio.TaskRegistry.add(
    name="nelma_byt5",
    source=seqio.TextLineDataSource(split_to_filepattern={
            "train": "/disk1/projekti/mondodb_lm/test.tsv",
        }),
    preprocessors=[
        functools.partial(
          t5.data.preprocessors.parse_tsv,
          field_names=['text','class'],
          field_delim='\t',
        ),
        functools.partial(
              seqio.preprocessors.rekey,
              key_map={"inputs": None, "targets": "text"}
        ),
        seqio.preprocessors.tokenize,
        seqio.CacheDatasetPlaceholder(),
        functools.partial(
          t5.data.preprocessors.span_corruption,
          mean_noise_span_length=MEAN_NOISE_SPAN_LENGTH),
        seqio.preprocessors.append_eos_after_trim,
     ],
      output_features=DEFAULT_OUTPUT_FEATURES,
      metric_fns=[])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant