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

Minor WTQ ERM model and dataset reader fixes for demo #3068

Merged
merged 4 commits into from
Jul 16, 2019

Conversation

pdasigi
Copy link
Member

@pdasigi pdasigi commented Jul 16, 2019

Earlier we used the final states from the ERM trainer both for training and prediction, but that meant that we could not use interactive beam search on an ERM trained model. The main change in this PR is to use beam search in the ERM model while testing. I confirmed that the dev accuracy of a trained model remains the same after this change.

Copy link
Contributor

@matt-gardner matt-gardner left a comment

Choose a reason for hiding this comment

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

LGTM, modulo one minor question.

# We don't need a separate beam search since the trainer does that already. But we're defining one just to
# be able to use interactive beam search (a functionality that's only implemented in the ``BeamSearch``
# class) in the demo. We'll use this only at test time.
self._beam_search = BeamSearch(beam_size=decoder_beam_size) # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need type: ignore here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Mypy complained that it needs type annotation for that variable. I assumed that's a mypy bug since the variable is actually being defined there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe try self._beam_search: BeamSearch = ...?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like that works. Thanks!

@pdasigi pdasigi merged commit 7728b12 into allenai:master Jul 16, 2019
@pdasigi pdasigi deleted the decoder_beam_search_in_erm branch July 16, 2019 22:21
reiyw pushed a commit to reiyw/allennlp that referenced this pull request Nov 12, 2019
* model dataset reader fixes for demo

* fixed a typo

* mypy ignore

* make mypy happy
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.

None yet

2 participants