|
19 | 19 | AutoModelForTableQuestionAnswering, |
20 | 20 | AutoTokenizer, |
21 | 21 | TableQuestionAnsweringPipeline, |
22 | | - TFAutoModelForTableQuestionAnswering, |
23 | 22 | pipeline, |
24 | 23 | ) |
25 | 24 | from transformers.testing_utils import ( |
26 | 25 | is_pipeline_test, |
27 | | - require_pandas, |
28 | | - require_tensorflow_probability, |
29 | 26 | require_torch, |
30 | 27 | slow, |
31 | 28 | ) |
@@ -316,55 +313,6 @@ def test_integration_wtq_pt(self, torch_dtype="float32"): |
316 | 313 | def test_integration_wtq_pt_fp16(self): |
317 | 314 | self.test_integration_wtq_pt(torch_dtype="float16") |
318 | 315 |
|
319 | | - @slow |
320 | | - @require_tensorflow_probability |
321 | | - @require_pandas |
322 | | - def test_integration_wtq_tf(self): |
323 | | - model_id = "google/tapas-base-finetuned-wtq" |
324 | | - model = TFAutoModelForTableQuestionAnswering.from_pretrained(model_id) |
325 | | - tokenizer = AutoTokenizer.from_pretrained(model_id) |
326 | | - table_querier = pipeline("table-question-answering", model=model, tokenizer=tokenizer) |
327 | | - |
328 | | - data = { |
329 | | - "Repository": ["Transformers", "Datasets", "Tokenizers"], |
330 | | - "Stars": ["36542", "4512", "3934"], |
331 | | - "Contributors": ["651", "77", "34"], |
332 | | - "Programming language": ["Python", "Python", "Rust, Python and NodeJS"], |
333 | | - } |
334 | | - queries = [ |
335 | | - "What repository has the largest number of stars?", |
336 | | - "Given that the numbers of stars defines if a repository is active, what repository is the most active?", |
337 | | - "What is the number of repositories?", |
338 | | - "What is the average number of stars?", |
339 | | - "What is the total amount of stars?", |
340 | | - ] |
341 | | - |
342 | | - results = table_querier(data, queries) |
343 | | - |
344 | | - expected_results = [ |
345 | | - {"answer": "Transformers", "coordinates": [(0, 0)], "cells": ["Transformers"], "aggregator": "NONE"}, |
346 | | - {"answer": "Transformers", "coordinates": [(0, 0)], "cells": ["Transformers"], "aggregator": "NONE"}, |
347 | | - { |
348 | | - "answer": "COUNT > Transformers, Datasets, Tokenizers", |
349 | | - "coordinates": [(0, 0), (1, 0), (2, 0)], |
350 | | - "cells": ["Transformers", "Datasets", "Tokenizers"], |
351 | | - "aggregator": "COUNT", |
352 | | - }, |
353 | | - { |
354 | | - "answer": "AVERAGE > 36542, 4512, 3934", |
355 | | - "coordinates": [(0, 1), (1, 1), (2, 1)], |
356 | | - "cells": ["36542", "4512", "3934"], |
357 | | - "aggregator": "AVERAGE", |
358 | | - }, |
359 | | - { |
360 | | - "answer": "SUM > 36542, 4512, 3934", |
361 | | - "coordinates": [(0, 1), (1, 1), (2, 1)], |
362 | | - "cells": ["36542", "4512", "3934"], |
363 | | - "aggregator": "SUM", |
364 | | - }, |
365 | | - ] |
366 | | - self.assertListEqual(results, expected_results) |
367 | | - |
368 | 316 | @slow |
369 | 317 | @require_torch |
370 | 318 | def test_integration_sqa_pt(self, torch_dtype="float32"): |
@@ -395,34 +343,6 @@ def test_integration_sqa_pt(self, torch_dtype="float32"): |
395 | 343 | def test_integration_sqa_pt_fp16(self): |
396 | 344 | self.test_integration_sqa_pt(torch_dtype="float16") |
397 | 345 |
|
398 | | - @slow |
399 | | - @require_tensorflow_probability |
400 | | - @require_pandas |
401 | | - def test_integration_sqa_tf(self): |
402 | | - model_id = "google/tapas-base-finetuned-sqa" |
403 | | - model = TFAutoModelForTableQuestionAnswering.from_pretrained(model_id) |
404 | | - tokenizer = AutoTokenizer.from_pretrained(model_id) |
405 | | - table_querier = pipeline( |
406 | | - "table-question-answering", |
407 | | - model=model, |
408 | | - tokenizer=tokenizer, |
409 | | - ) |
410 | | - data = { |
411 | | - "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], |
412 | | - "Age": ["56", "45", "59"], |
413 | | - "Number of movies": ["87", "53", "69"], |
414 | | - "Date of birth": ["7 february 1967", "10 june 1996", "28 november 1967"], |
415 | | - } |
416 | | - queries = ["How many movies has George Clooney played in?", "How old is he?", "What's his date of birth?"] |
417 | | - results = table_querier(data, queries, sequential=True) |
418 | | - |
419 | | - expected_results = [ |
420 | | - {"answer": "69", "coordinates": [(2, 2)], "cells": ["69"]}, |
421 | | - {"answer": "59", "coordinates": [(2, 1)], "cells": ["59"]}, |
422 | | - {"answer": "28 november 1967", "coordinates": [(2, 3)], "cells": ["28 november 1967"]}, |
423 | | - ] |
424 | | - self.assertListEqual(results, expected_results) |
425 | | - |
426 | 346 | @slow |
427 | 347 | @require_torch |
428 | 348 | def test_large_model_pt_tapex(self, torch_dtype="float32"): |
|
0 commit comments