8000 Rename SpanPruner -> Pruner, remove -infs by matt-gardner · Pull Request #1703 · allenai/allennlp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Rename SpanPruner -> Pruner, remove -infs #1703

Merged
merged 5 commits into from
Aug 31, 2018

Conversation

matt-gardner
Copy link
Contributor

Fixes #1696. I decided against modifying the coref model in the places that it uses the log mask, because that was more complicated than I wanted to get to, and the coref model's loss function is able to handle the -infs without a problem.

Git is saying that I removed span_pruner.py and added pruner.py; that's just because I made cosmetic changes to a ton of lines, removing references to "spans". The only change in logic is using replace_masked_values instead of mask.log().

@matt-gardner matt-gardner requested a review from DeNeutoy August 31, 2018 15:15
from allennlp.modules.pruner import Pruner
# TODO(mattg): This line is to keep backwards compatibility. I'm not sure how to give a
# deprecation warning on using this import, but we should remove this around version 0.8.
from allennlp.modules.pruner import Pruner as SpanPruner # pylint: disable=reimported
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't actually preserve backward compatibility, e.g what if someone had from allennlp.modules.span_pruner import .....

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this isn't a huge deal though, up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm not sure there's a way to fix that. I'm hoping that most people will have imported from the base module, which is what we typically do. @joelgrus, do you know of a better way we can handle backwards compatibility with renaming modules like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can just leave the span_pruner.py there and import the Pruner as SpanPruner?

Copy link
Contributor

Choose a reason for hiding this comment

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

That would also be a natural place for the depreciation warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I have to have docs for it, because of our documentation check... Ugh. Ok.

Copy link
Contributor

Choose a reason for hiding this comment

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

just add it to the docs to ignore dictionary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I had forgotten about that.

@matt-gardner
Copy link
Contributor Author

@DeNeutoy, I thought that test failure was a fluke, as it's not related to anything changed in this PR. But it's failed three times in a row now. Any ideas about what's going on there?

@DeNeutoy
Copy link
Contributor

No idea... it's quite high precision, does it go away if you drop it to 6?

@matt-gardner matt-gardner merged commit 5e68d04 into allenai:master Aug 31, 2018
@matt-gardner matt-gardner deleted the cleanup_pruner branch August 31, 2018 17:23
gabrielStanovsky pushed a commit to gabrielStanovsky/allennlp that referenced this pull request Sep 7, 2018
* Rename SpanPruner -> Pruner, remove -infs

* Pylint and docs

* Actually fix docs...

* Make the deprecation warning better, better preserve compatibility, try to fix flaky test

* Remove unused import
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.

2 participants
0