bert base turkish squad
savasyIntroduction
The BERT-Base Turkish SQuAD model is a fine-tuned version of the BERT model specifically adapted for Question Answering tasks in Turkish using the TQuAD dataset. This model enables users to extract answers from Turkish texts by processing questions and providing relevant answers.
Architecture
The model is based on the BERT architecture, utilizing the bert-base-turkish-uncased
variant provided by Hugging Face. It has been fine-tuned using the TQuAD dataset, which is a Turkish adaptation of the SQuAD dataset, designed for natural language processing tasks in Turkish.
Training
Training was conducted with the following parameters:
- Model Type: BERT
- Model Path:
dbmdz/bert-base-turkish-uncased
- Training File:
trainQ.json
- Evaluation File:
dev1.json
- Batch Size: 12 per GPU
- Learning Rate: 3e-5
- Number of Training Epochs: 5.0
- Maximum Sequence Length: 384
- Document Stride: 128
- Output Directory:
./model
Training was performed using a Python script run_squad.py
.
Guide: Running Locally
- Install Dependencies: Ensure you have Python and PyTorch installed. Use
pip install transformers
to install the Hugging Face Transformers library. - Load the Model:
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline tokenizer = AutoTokenizer.from_pretrained("savasy/bert-base-turkish-squad") model = AutoModelForQuestionAnswering.from_pretrained("savasy/bert-base-turkish-squad") nlp = pipeline("question-answering", model=model, tokenizer=tokenizer)
- Run the Model:
- Define a context in Turkish.
- Use the
nlp
object to ask questions and receive answers.
print(nlp(question="Ne zaman avare bir hayata başladı?", context=sait)) print(nlp(question="Sait Faik hangi Lisede orta öğrenimini tamamladı?", context=sait))
For optimal performance and faster processing, consider running the model on cloud-based GPUs such as those offered by AWS, Google Cloud, or Azure.
License
Please refer to the Hugging Face model card for details on the model's licensing terms. If you use this model in your work, consider citing the relevant papers by Savas Yildirim.