From 23e5a36ee670150a632cfa8004de2c7244f305aa Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 21 Jan 2021 14:31:51 +0100 Subject: [PATCH] Changing model default for TableQuestionAnsweringPipeline. (#9729) * Changing model default for TableQuestionAnsweringPipeline. - Discussion: https://discuss.huggingface.co/t/table-question-answering-is-not-an-available-task-under-pipeline/3284/6 * Updating slow tests that were out of sync. --- src/transformers/pipelines/__init__.py | 6 +++--- ...test_pipelines_table_question_answering.py | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/transformers/pipelines/__init__.py b/src/transformers/pipelines/__init__.py index 24a5b17633..33c6a42947 100755 --- a/src/transformers/pipelines/__init__.py +++ b/src/transformers/pipelines/__init__.py @@ -136,9 +136,9 @@ SUPPORTED_TASKS = { "tf": None, "default": { "model": { - "pt": "nielsr/tapas-base-finetuned-wtq", - "tokenizer": "nielsr/tapas-base-finetuned-wtq", - "tf": "nielsr/tapas-base-finetuned-wtq", + "pt": "google/tapas-base-finetuned-wtq", + "tokenizer": "google/tapas-base-finetuned-wtq", + "tf": "google/tapas-base-finetuned-wtq", }, }, }, diff --git a/tests/test_pipelines_table_question_answering.py b/tests/test_pipelines_table_question_answering.py index 58dedb9575..1856d046ed 100644 --- a/tests/test_pipelines_table_question_answering.py +++ b/tests/test_pipelines_table_question_answering.py @@ -32,7 +32,7 @@ class TQAPipelineTests(CustomInputPipelineCommonMixin, unittest.TestCase): "lysandre/tiny-tapas-random-wtq", "lysandre/tiny-tapas-random-sqa", ] - large_models = ["nielsr/tapas-base-finetuned-wtq"] # Models tested with the @slow decorator + large_models = ["google/tapas-base-finetuned-wtq"] # Models tested with the @slow decorator valid_inputs = [ { "table": { @@ -190,22 +190,25 @@ class TQAPipelineTests(CustomInputPipelineCommonMixin, unittest.TestCase): results = tqa_pipeline(data, queries) expected_results = [ - {"answer": "Transformers", "coordinates": [(0, 0)], "cells": ["Transformers"]}, - {"answer": "Transformers", "coordinates": [(0, 0)], "cells": ["Transformers"]}, + {"answer": "Transformers", "coordinates": [(0, 0)], "cells": ["Transformers"], "aggregator": "NONE"}, + {"answer": "Transformers", "coordinates": [(0, 0)], "cells": ["Transformers"], "aggregator": "NONE"}, { - "answer": "Transformers, Datasets, Tokenizers", + "answer": "COUNT > Transformers, Datasets, Tokenizers", "coordinates": [(0, 0), (1, 0), (2, 0)], "cells": ["Transformers", "Datasets", "Tokenizers"], + "aggregator": "COUNT", }, { - "answer": "36542, 4512, 3934", + "answer": "AVERAGE > 36542, 4512, 3934", "coordinates": [(0, 1), (1, 1), (2, 1)], "cells": ["36542", "4512", "3934"], + "aggregator": "AVERAGE", }, { - "answer": "36542, 4512, 3934", + "answer": "SUM > 36542, 4512, 3934", "coordinates": [(0, 1), (1, 1), (2, 1)], "cells": ["36542", "4512", "3934"], + "aggregator": "SUM", }, ] self.assertListEqual(results, expected_results) @@ -214,8 +217,8 @@ class TQAPipelineTests(CustomInputPipelineCommonMixin, unittest.TestCase): def test_integration_sqa(self): tqa_pipeline = pipeline( "table-question-answering", - model="nielsr/tapas-base-finetuned-sqa", - tokenizer="nielsr/tapas-base-finetuned-sqa", + model="google/tapas-base-finetuned-sqa", + tokenizer="google/tapas-base-finetuned-sqa", ) data = { "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],