-
Notifications
You must be signed in to change notification settings - Fork 58
Description
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.