Skip to content

Conversation

NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Mar 29, 2022

What does this PR do?

Remember TAPAS, the table QA model by Google AI? Microsoft has now released TAPEX, a seq2seq model that outperforms TAPAS and is actually much simpler: table QA is just treated as a seq2seq problem.

As the weights can be directly loaded into a BART model, this PR only implements TapexTokenizer, which can be used to prepare tables and corresponding texts for the model.

This PR also adds 3 scripts that showcase how to fine-tune TAPEX on 3 important benchmarks: WikiSQL and WTQ for table question answering and TabFact for table fact verification.

Kudos to @SivilTaram (the original author) for improving my initial TapexTokenizer implementation, as well as adding the 3 fine-tuning scripts.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 29, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

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

Thanks a lot for adding this super cool model!
LGTM, just left a few nits.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

If the expected architecture should be BART by default, then this model should be added in the relevant auto mapping to work with AutoConfig and AutoModelForXxx. This is jsut a defult value that can be changed in the config if there are checkpoints that rely on a different architecture.

@NielsRogge
Copy link
Contributor Author

NielsRogge commented Mar 29, 2022

make fixup is complaining:

examples/research_projects/tapex/run_wikitablequestions_with_tapex.py:50:1: F401 'wikisql_utils._TYPE_CONVERTER' imported but unused
examples/research_projects/tapex/run_wikitablequestions_with_tapex.py:50:1: F401 'wikisql_utils.retrieve_wikisql_query_answer_tapas' imported but unused

However, these functions are used in the script, so I can't remove these imports.

@SivilTaram
Copy link

@NielsRogge Thanks for your huge effort! I personally think these two warnings are correct since these two imports are only used in run_wikisql_with_tapex.py instead of run_wikitablequestions_with_tapex.py (the hint message). I think we can remove them.

examples/research_projects/tapex/run_wikitablequestions_with_tapex.py:50:1: F401 'wikisql_utils._TYPE_CONVERTER' imported but unused
examples/research_projects/tapex/run_wikitablequestions_with_tapex.py:50:1: F401 'wikisql_utils.retrieve_wikisql_query_answer_tapas' imported but unused

@NielsRogge
Copy link
Contributor Author

@sgugger I've addressed all comments.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

The model is still missing in the auto configuration and auto model API to provide the Bart default, which means that it won't work with AutoModelForSeq2Seq for instance. This should be added before merging.

@NielsRogge
Copy link
Contributor Author

NielsRogge commented Apr 4, 2022

All models on the hub do work with the Auto API, can you elaborate? TAPEX is also added to configuration_auto.py and modeling_auto.py.

@NielsRogge NielsRogge force-pushed the add_tapex_bis branch 2 times, most recently from b078744 to 5f86fa5 Compare April 7, 2022 08:36
Niels Rogge and others added 18 commits April 8, 2022 08:33
…estion answering and table-based fact verification.
…kground.

- Remove unused code lines in tabfact script.
- Disable the deafult `pad_to_max_length` option which is memory-consuming.
* Fix the do_lower_case behaviour of TapexTokenizer.
* Add unit tests for target scenarios and cased/uncased scenarios for both source and target.
…enizer function.

* Fix typos in tapex example README.
…zer to control whether do_lower_case

* Guarantee the hyper-parameter can be run without out-of-memory on 16GB card and report the new reproduced number on wikisql
* Provide evaluation command.
@NielsRogge NielsRogge merged commit 4ef0abb into huggingface:main Apr 8, 2022
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

Successfully merging this pull request may close these issues.

5 participants