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

Naming bug for head_arc and child_arc weights/representations #27

Open
teffland opened this issue Oct 22, 2021 · 0 comments
Open

Naming bug for head_arc and child_arc weights/representations #27

teffland opened this issue Oct 22, 2021 · 0 comments

Comments

@teffland
Copy link

This is for future reference, for anyone working off of this model's edge score outputs.

There is a semantic naming bug in the dependency decoder that actually switches the head_arc_representation and child_arc_representation and the weights that compute them.

The code that computes the arc logits in dependency_decoder.py is:

head_arc_representation = self._dropout(self.head_arc_feedforward(encoded_text))
child_arc_representation = self._dropout(self.child_arc_feedforward(encoded_text))
attended_arcs = self.arc_attention(head_arc_representation, child_arc_representation)

This looks like attended_arcs (shape batch_size, sent_len, sent_len) is a tensor of scores with attended_arcs[b,i,j] representing the score for an arc from i to j (head->child). The rest of the code, however, uses this tensor as if it were child->head, so the tensors are in effect transposed. This also implies that the weights,head_arc_feedforward and child_arc_feedforward, are named backwards.

This causes no performance bugs for udify itself, but if you use the outputs of the model arc scores for something else, you need to transpose these scores to get them to be actually head->child.

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