Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

fix decode in encoder decoder#586

Merged
DeNeutoy merged 4 commits into
allenai:masterfrom
DeNeutoy:seq2seq-decode-fix
Dec 7, 2017
Merged

fix decode in encoder decoder#586
DeNeutoy merged 4 commits into
allenai:masterfrom
DeNeutoy:seq2seq-decode-fix

Conversation

@DeNeutoy

@DeNeutoy DeNeutoy commented Dec 7, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@DeNeutoy DeNeutoy requested a review from matt-gardner December 7, 2017 00:52
@DeNeutoy

DeNeutoy commented Dec 7, 2017

Copy link
Copy Markdown
Contributor Author

@MaxDel This will likely be relevant for you too if you are using the encoder decoder stuff.

predicted_tokens = [self.vocab.get_token_from_index(x, namespace="target_tokens")
for x in indices]
all_predicted_tokens.append(predicted_tokens)
if len(all_predicted_tokens) == 1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is removing the batch dimension, which we don't do here anymore? Is that the issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, exactly. Doing this results in the decoded output being the first word if there is a single element in the batch.

@MaksymDel MaksymDel Dec 7, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exactly, I also fixed this issue in my local version some time ago.

@DeNeutoy DeNeutoy merged commit ccc4af3 into allenai:master Dec 7, 2017
@DeNeutoy DeNeutoy deleted the seq2seq-decode-fix branch December 7, 2017 01:32
gabrielStanovsky pushed a commit to gabrielStanovsky/allennlp that referenced this pull request Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants