Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

transformer_fast_decode, beam search: take an optional cache and return it #999

Merged
merged 1 commit into from
Jan 10, 2019

Conversation

gcampax
Copy link
Contributor

@gcampax gcampax commented Aug 16, 2018

Some models, eg. semantic parsing models with copying mechanisms,
want to use the output of Transformer for multiple predictions.
One way to do so is to modify the symbols_to_logits_fn to generate
the additional predictions and save them in the cache dictionary.

To do so, though, fast_decode() must allow an externally supplied cache,
and must return it to the caller after the loop.

@googlebot googlebot added the cla: yes PR author has signed CLA label Aug 16, 2018
@gcampax
Copy link
Contributor Author

gcampax commented Aug 16, 2018

Note: I have added tests but I cannot run them because pytest claims "no test dir found testing here".

…rn it

Some models, eg. semantic parsing models with copying mechanisms,
want to use the output of Transformer for multiple predictions.
One way to do so is to modify the symbols_to_logits_fn to generate
the additional predictions and save it in the cache dictionary.

To do so, though, fast_decode() must allow an externally supplied cache,
and must return it to the caller after the loop.
Copy link
Contributor

@lukaszkaiser lukaszkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, looks all good!

@lukaszkaiser lukaszkaiser merged commit cef5491 into tensorflow:master Jan 10, 2019
@lukaszkaiser
Copy link
Contributor

I'm terribly sorry that this PR got forgotten for such a long time! It's a great help indeed and was perfectly fine to merge from the start. Thanks again for doing this!

tensorflow-copybara pushed a commit that referenced this pull request Jan 10, 2019
PiperOrigin-RevId: 228622817
kpe pushed a commit to kpe/tensor2tensor that referenced this pull request Mar 2, 2019
…rn it (tensorflow#999)

Some models, eg. semantic parsing models with copying mechanisms,
want to use the output of Transformer for multiple predictions.
One way to do so is to modify the symbols_to_logits_fn to generate
the additional predictions and save it in the cache dictionary.

To do so, though, fast_decode() must allow an externally supplied cache,
and must return it to the caller after the loop.
kpe pushed a commit to kpe/tensor2tensor that referenced this pull request Mar 2, 2019
PiperOrigin-RevId: 228622817
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants