transformers
transformers copied to clipboard
Add EntityPairClassification Pipeline, AutoClass & LUKE ONNX Support
What does this PR do?
This PR started out in adding support for Luke in ONNX.
To not break existing AutoPatterns in FeaturesManager, AutoModelForEntityPairClassification has also been added.
Additionally, a pipeline for EntityPairClassification has been added to make the task more supported overall by the library.
Note: A previous PR (https://github.com/huggingface/transformers/pull/16562) has been closed / not merged for LUKE ONNX support. I believe this PR addresses the remaining comments in that one.
All ONNX tests pass - happy to implement any additional comments for the Pipeline / Autoclass.
I have only implemented one of the additional Tasks EntityPairClassification - if this has been done to the appropriate standard, I can also implement it for the other two remaining Luke Heads which are not currently supported Span Classification & Entity Classification
@NielsRogge - Worked on the original LUKE implementation @lewtun & @michaelbenayoun - Reviewed the previous PR
Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the contributor guideline, Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case.
- [x] Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
- [x] Did you write any new necessary tests?

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.
Hi @NielsRogge - what next steps would you suggest? Happy to make updates to the PR
I don't think it makes sense to create an auto-map just for this model, and the pipeline can be done as a custom pipeline with code on the Hub. If/when there are more models associated to this task, we can revisit this approach of course.
Thanks @NielsRogge , @lewtun & @sgugger !
I'll update the PR by reverting the autoclass creation and bypass the AutoModel Constructors in test_onnx_v2.py & use the LukeForXxx classes in features.py directly.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Hi @kayvane1, feel free to revive this PR :)