|
--- |
|
language: th |
|
task: extractive question answering |
|
datasets: xquad.th |
|
tags: |
|
- bert-base |
|
|
|
--- |
|
|
|
|
|
# Model Description |
|
|
|
This model is for Thai extractive question answering. It is based on the multilingual BERT [bert-base-multilingual-cased](https://huggingface.co/bert-base-multilingual-cased) model, and it is case-sensitive: it makes a difference between english and English |
|
|
|
# Training data |
|
|
|
We split the original [xquad](https://github.com/deepmind/xquad) dataset into the training/validation/testing set. Totally, there are 876/161/153 question-answer pairs from 34/7/7 articles in the training/validation/testing set separately. You can find the details of the dataset here [xquad_split](https://huggingface.co/datasets/zhufy/xquad_split). |
|
|
|
# How to use |
|
|
|
You can use it directly from the [🤗 Transformers](https://github.com/huggingface/transformers) library with a pipeline: |
|
|
|
``` python |
|
>>> from transformers.pipelines import pipeline |
|
>>> from transformers import AutoTokenizer, AutoModelForQuestionAnswering |
|
|
|
>>> tokenizer = AutoTokenizer.from_pretrained("zhufy/xquad-th-mbert-base") |
|
>>> model = AutoModelForQuestionAnswering.from_pretrained("zhufy/xquad-th-mbert-base") |
|
>>> nlp = pipeline("question-answering", model=model, tokenizer=tokenizer) |
|
|
|
>>> context = "ดินดอนสามเหลี่ยม ไรน์-เมิส ซึ่งเป็นภูมิภาคทางธรรมชาติที่สำคัญของเนเธอร์แลนด์เริ่มต้น |
|
ใกล้มิลลิงเงิน อาน เดอ เรน ใกล้ชายแดนเนเธอร์แลนด์ติดกับเยอรมัน |
|
โดยมีสาขาของไรน์ไหลเข้าสู่แม่น้ำวาลและเนเดอร์เรน เนื่องจากน้ำส่วนใหญ่จากแม่น้ำไรน์ |
|
คำว่า ดินดอนสามเหลี่ยมไรน์ ซึ่งสั้นกว่าจึงเป็นคำที่ใช้เรียกกันทั่วไป อย่างไรก็ดี |
|
ชื่อนี้ยังใช้เรียกดินดอนสามเหลี่ยมบริเวณแม่น้ำซึ่งแม่น้ำไรน์ไหลเข้าสู่ทะเลสาบคอนสแตนซ์อีกด้วย |
|
ดังนั้นการเรียกดินดอนสามเหลี่ยมซึ่งใหญ่กว่าว่าไรน์-เมิส หรือแม้กระทั่งดินแดนสามเหลี่ยมไรน์ |
|
-เมิส-สเกลต์จึงชัดเจนกว่า เนื่องจากแม่น้ำสเกลต์สิ้นสุดที่ดินดอนสามเหลี่ยมเดียวกัน" |
|
|
|
>>> question = "ดินดอนสามเหลี่ยมในเนเธอร์แลนด์มีชื่อว่าอะไร?" |
|
|
|
>>> inputs = {"question": question, |
|
"context":context } |
|
|
|
>>> nlp(inputs) |
|
|
|
{'score': 0.9426798224449158, |
|
'start': 17, |
|
'end': 84, |
|
'answer': 'ไรน์-เมิส ซึ่งเป็นภูมิภาคทางธรรมชาติที่สำคัญของเนเธอร์แลนด์เริ่มต้น'} |
|
|
|
``` |