-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fixed minor error while calculating span accuracy #2923
Conversation
Thanks! Would you mind raising a config error checking that they are the same dimension similar to: https://github.com/allenai/allennlp/blob/master/allennlp/training/metrics/categorical_accuracy.py#L48
|
Minor point: config errors should only be used when the error reasonably came from a configuration file problem. That's probably not the case here, and a value error would be more appropriate. |
Sure. I will do it over the weekend. |
I have added the checks and the corresponding tests. Please take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I made some minor changes
* Fixed minor error while calculating span accuracy * Added checks for input shape in BooleanAccuracy * Fixed label shape in QaNet * Use f-string
* Fixed minor error while calculating span accuracy * Added checks for input shape in BooleanAccuracy * Fixed label shape in QaNet * Use f-string
Inputs to BooleanAccuracy must have the same dimensions. Here, the first argument has dimensions
(batch size, 2)
, while the second argument has dimensions(batch size, 1, 2)
. Changingtorch.stack
totorch.cat
makes the dimension of the second argument(batch size, 2)
.Note that span accuracy obtained earlier was not incorrect because of the way accuracy was being computed internally.