Spaces:
Build error
Build error
Commit
·
92a392e
1
Parent(s):
d304ae4
Update tapas_utils.py
Browse files- tapas_utils.py +1 -6
tapas_utils.py
CHANGED
|
@@ -7,11 +7,6 @@ def initialize_tapas():
|
|
| 7 |
model = AutoModelForTableQuestionAnswering.from_pretrained("google/tapas-large-finetuned-wtq")
|
| 8 |
return tokenizer, model
|
| 9 |
|
| 10 |
-
|
| 11 |
-
# ... [same as in your code]
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# ... [same as in your code]
|
| 15 |
def ask_llm_chunk(tokenizer, model, chunk, questions):
|
| 16 |
chunk = chunk.astype(str)
|
| 17 |
try:
|
|
@@ -66,6 +61,6 @@ def summarize_map_reduce(tokenizer, model, data, questions):
|
|
| 66 |
dataframe_chunks = [deepcopy(chunk) for chunk in np.array_split(dataframe, num_chunks)]
|
| 67 |
all_answers = []
|
| 68 |
for chunk in dataframe_chunks:
|
| 69 |
-
chunk_answers = ask_llm_chunk(chunk, questions)
|
| 70 |
all_answers.extend(chunk_answers)
|
| 71 |
return all_answers
|
|
|
|
| 7 |
model = AutoModelForTableQuestionAnswering.from_pretrained("google/tapas-large-finetuned-wtq")
|
| 8 |
return tokenizer, model
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def ask_llm_chunk(tokenizer, model, chunk, questions):
|
| 11 |
chunk = chunk.astype(str)
|
| 12 |
try:
|
|
|
|
| 61 |
dataframe_chunks = [deepcopy(chunk) for chunk in np.array_split(dataframe, num_chunks)]
|
| 62 |
all_answers = []
|
| 63 |
for chunk in dataframe_chunks:
|
| 64 |
+
chunk_answers = ask_llm_chunk(tokenizer, model, chunk, questions)
|
| 65 |
all_answers.extend(chunk_answers)
|
| 66 |
return all_answers
|