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

fix inconsistent interface implementation #51

Merged
merged 2 commits into from Feb 28, 2020

Conversation

zhaoyanpeng
Copy link
Contributor

The interface implementation in

def marginals(self, scores, lengths=None, _autograd=True):

Is inconsistent with its declaration in
def marginals(self, edge, lengths=None, _autograd=True, _raw=False):

resulting in an error when invoking topk()
return self._struct(KMaxSemiring(k)).marginals(
self.log_potentials, self.lengths, _raw=True
)

This pr will raise an error when invoking unsupported topk() with CKY.

@zhaoyanpeng
Copy link
Contributor Author

The interface implementation in

def marginals(self, scores, lengths=None, _autograd=True):

Is inconsistent with its declaration in

def marginals(self, edge, lengths=None, _autograd=True, _raw=False):

resulting in an error when invoking topk()

return self._struct(KMaxSemiring(k)).marginals(
self.log_potentials, self.lengths, _raw=True
)

This pr will raise an error when invoking unsupported topk() with CKY.

We can now use dist.topk() with CKY.
Hi @srush, could you please review the code?

@srush
Copy link
Collaborator

srush commented Feb 28, 2020

Thanks! CKY is a nasty interface compared to the others, but I wanted to make it fast enough to run.

@srush srush merged commit 8608b6c into harvardnlp:master Feb 28, 2020
@zhaoyanpeng zhaoyanpeng deleted the fix_cky branch March 10, 2020 19:49
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

Successfully merging this pull request may close these issues.

None yet

2 participants