Bntqa Mbart
模型概述
該模型專注於低資源印度語系(特別是孟加拉語)的表格問答任務,能夠從結構化表格中提取信息或生成表格作為答案。
模型特點
低資源語言支持
專門針對孟加拉語等低資源印度語系設計,填補了這些語言在表格問答領域的空白
全自動數據生成
採用全自動大規模表格問答數據生成流程,解決了低資源語言標註數據稀缺的問題
跨語言遷移能力
具備零樣本跨語言遷移能力,可適應相關語言的任務
模型能力
表格問題回答
結構化數據查詢
數學推理
跨語言遷移
使用案例
商業智能
財務報表分析
從孟加拉語財務報表中提取特定數據項
教育
學習材料問答
回答基於孟加拉語教材中表格內容的問題
🚀 BnTQA-mBart 孟加拉語表格問答模型
BnTQA - mBart 是一個用於孟加拉語表格問答的模型,它基於 Facebook 的 mBART - large - 50 模型,能夠處理孟加拉語表格中的問答任務,為低資源語言的表格問答研究提供了有效的解決方案。
🚀 快速開始
本模型可用於孟加拉語表格問答任務,通過加載預訓練模型和數據集,能夠對錶格中的問題進行回答。
✨ 主要特性
- 低資源語言支持:針對孟加拉語等低資源語言的表格問答任務進行優化。
- 大規模數據生成:採用全自動的大規模表格問答數據生成流程。
- 性能優越:在大規模數據集上訓練的模型性能優於現有最先進的大語言模型。
📦 安裝指南
文檔未提供具體安裝步驟,可參考相關依賴庫的官方安裝說明,如pandas
、datasets
、transformers
等。
💻 使用示例
基礎用法
import pandas as pd
from datasets import load_dataset
from transformers import MBartForConditionalGeneration
model = MBartForConditionalGeneration.from_pretrained("vaishali/BnTQA-mBart")
tokenizer = AutoTokenizer.from_pretrained(args.pretrained_model_name, src_lang="bn_IN", tgt_lang="bn_IN")
forced_bos_id = forced_bos_token_id = tokenizer.lang_code_to_id["bn_IN"]
# linearize table
def process_header(headers: List):
return "<কলাম> " + " | ".join(headers)
def process_row(row: List, row_index: int):
en2bnDigits = {'0': '০', '1': '১', '2': '২', '3': '৩', '4': '৪', '5': '৫', '6': '৬', '7': '৭', '8': '৮', '9': '৯', '.': '.'}
row_str = ""
row_cell_values = []
for cell_value in row:
if isinstance(cell_value, int) or isinstance(cell_value, float):
cell_value = convert_engDigit_to_bengali(str(cell_value))
row_cell_values.append(str(cell_value))
else:
row_cell_values.append(cell_value)
row_str += " | ".join(row_cell_values)
bn_row_index = []
for c in str(row_index):
bn_row_index.append(en2bnDigits[c])
return "<রো " + "".join(bn_row_index) + "> " + row_str
def process_table(table_content: Dict):
table_str = process_header(table_content["header"]) + " "
for i, row_example in enumerate(table_content["rows"]):
table_str += process_row(row_example, row_index=i + 1) + " "
return table_str.strip()
# load the dataset
banglatableQA = load_dataset("vaishali/banglaTabQA")
for sample in banglatableQA['train']:
question = sample['question']
input_table = pd.read_json(sample['table'], orient='split')
answer = pd.read_json(sample['answer'], orient='split')
# create the input sequence: query + linearized input table
table_content = {"header": list(input_table.columns)[1:], "rows": [list(row.values)[1:] for i, row in input_table.iterrows()]}
linearized_inp_table = process_table(table_content)
linearized_output_table = process_table({"name": None, "header": [translate_column(col) for col in list(answer.columns)],
"rows": [list(row.values) for i, row in answer.iterrows()]})
source = query + " " + linearized_inp_table
target = linearized_output_table
input = tokenizer(source,
return_tensors="pt",
padding="max_length",
truncation="longest_first",
max_length=1024,
add_special_tokens=True)
with tokenizer.as_target_tokenizer():
labels = tokenizer(target,
return_tensors="pt",
padding="max_length",
truncation="longest_first",
max_length=1024,
add_special_tokens=True).input_ids
# inference
out = model.generate(input["input_ids"].to("cuda"), num_beams=5, return_dict_in_generate=True,
output_scores=True, max_length=1024)
📚 詳細文檔
模型信息
屬性 | 詳情 |
---|---|
模型類型 | 基於 mBART - large - 50 的條件生成模型 |
訓練數據 | vaishali/banglaTabQA 數據集 |
引用信息
@inproceedings{pal-etal-2024-table,
title = "Table Question Answering for Low-resourced {I}ndic Languages",
author = "Pal, Vaishali and
Kanoulas, Evangelos and
Yates, Andrew and
de Rijke, Maarten",
editor = "Al-Onaizan, Yaser and
Bansal, Mohit and
Chen, Yun-Nung",
booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing",
month = nov,
year = "2024",
address = "Miami, Florida, USA",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.emnlp-main.5",
pages = "75--92",
abstract = "TableQA is the task of answering questions over tables of structured information, returning individual cells or tables as output. TableQA research has focused primarily on high-resource languages, leaving medium- and low-resource languages with little progress due to scarcity of annotated data and neural models. We address this gap by introducing a fully automatic large-scale tableQA data generation process for low-resource languages with limited budget. We incorporate our data generation method on two Indic languages, Bengali and Hindi, which have no tableQA datasets or models. TableQA models trained on our large-scale datasets outperform state-of-the-art LLMs. We further study the trained models on different aspects, including mathematical reasoning capabilities and zero-shot cross-lingual transfer. Our work is the first on low-resource tableQA focusing on scalable data generation and evaluation procedures. Our proposed data generation method can be applied to any low-resource language with a web presence. We release datasets, models, and code (https://github.com/kolk/Low-Resource-TableQA-Indic-languages).",
}
📄 許可證
本項目採用 MIT 許可證。
Distilbert Base Cased Distilled Squad
Apache-2.0
DistilBERT是BERT的輕量級蒸餾版本,參數量減少40%,速度提升60%,保留95%以上性能。本模型是在SQuAD v1.1數據集上微調的問答專用版本。
問答系統 英語
D
distilbert
220.76k
244
Distilbert Base Uncased Distilled Squad
Apache-2.0
DistilBERT是BERT的輕量級蒸餾版本,參數量減少40%,速度提升60%,在GLUE基準測試中保持BERT 95%以上的性能。本模型專為問答任務微調。
問答系統
Transformers 英語

D
distilbert
154.39k
115
Tapas Large Finetuned Wtq
Apache-2.0
TAPAS是基於BERT架構的表格問答模型,通過自監督方式在維基百科表格數據上預訓練,支持對錶格內容進行自然語言問答
問答系統
Transformers 英語

T
google
124.85k
141
T5 Base Question Generator
基於t5-base的問答生成模型,輸入答案和上下文,輸出相應問題
問答系統
Transformers

T
iarfmoose
122.74k
57
Bert Base Cased Qa Evaluator
基於BERT-base-cased的問答對評估模型,用於判斷問題和答案是否語義相關
問答系統
B
iarfmoose
122.54k
9
Tiny Doc Qa Vision Encoder Decoder
MIT
一個基於MIT許可證的文檔問答模型,主要用於測試目的。
問答系統
Transformers

T
fxmarty
41.08k
16
Dpr Question Encoder Single Nq Base
DPR(密集段落檢索)是用於開放領域問答研究的工具和模型。該模型是基於BERT的問題編碼器,使用自然問題(NQ)數據集訓練。
問答系統
Transformers 英語

D
facebook
32.90k
30
Mobilebert Uncased Squad V2
MIT
MobileBERT是BERT_LARGE的輕量化版本,在SQuAD2.0數據集上微調而成的問答系統模型。
問答系統
Transformers 英語

M
csarron
29.11k
7
Tapas Base Finetuned Wtq
Apache-2.0
TAPAS是一個基於Transformer的表格問答模型,通過自監督學習在維基百科表格數據上預訓練,並在WTQ等數據集上微調。
問答系統
Transformers 英語

T
google
23.03k
217
Dpr Question Encoder Multiset Base
基於BERT的密集段落檢索(DPR)問題編碼器,用於開放領域問答研究,在多個QA數據集上訓練
問答系統
Transformers 英語

D
facebook
17.51k
4
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98