Text Generation
Transformers
PyTorch
Safetensors
Turkish
mt5
text2text-generation
question-generation
answer-extraction
question-answering
Instructions to use obss/mt5-base-3task-highlight-tquad2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use obss/mt5-base-3task-highlight-tquad2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="obss/mt5-base-3task-highlight-tquad2")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("obss/mt5-base-3task-highlight-tquad2") model = AutoModelForSeq2SeqLM.from_pretrained("obss/mt5-base-3task-highlight-tquad2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use obss/mt5-base-3task-highlight-tquad2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "obss/mt5-base-3task-highlight-tquad2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "obss/mt5-base-3task-highlight-tquad2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/obss/mt5-base-3task-highlight-tquad2
- SGLang
How to use obss/mt5-base-3task-highlight-tquad2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "obss/mt5-base-3task-highlight-tquad2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "obss/mt5-base-3task-highlight-tquad2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "obss/mt5-base-3task-highlight-tquad2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "obss/mt5-base-3task-highlight-tquad2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use obss/mt5-base-3task-highlight-tquad2 with Docker Model Runner:
docker model run hf.co/obss/mt5-base-3task-highlight-tquad2
metadata
language: tr
datasets:
- tquad1
- tquad2
- xquad
tags:
- text2text-generation
- question-generation
- answer-extraction
- question-answering
- text-generation
pipeline_tag: text2text-generation
widget:
- text: >-
generate question: Legendary Entertainment, 2016 yılında bilimkurgu romanı
Dune'un <hl> film ve TV haklarını <hl> satın aldı. Geliştirme kısa bir
süre sonra başladı. Villeneuve projeye olan ilgisini dile getirdi ve resmi
olarak yönetmen olarak imza attı. Roth ve Spaihts ile birlikte çalışarak
senaryoyu iki bölüme ayırdı ve 1965 romanının 21. yüzyıla güncellenmiş bir
uyarlamasını ekledi.
example_title: Question Generation (Movie)
- text: >-
generate question: Fatih Sultan Mehmet, Cenevizlilerin önemli üslerinden
Amasra’yı aldı. 1479’da <hl> bir antlaşma yaparak <hl> Venedik'le 16
yıllık savaşa son verdi.
example_title: Question Generation (History)
- text: >-
generate question: Cenevizlilerin önemli üslerinden Amasra’yı aldı.
1479’da bir antlaşma yaparak <hl> Venedik'le <hl> 16 yıllık savaşa sona
verdi.
example_title: Question Generation (History 2)
- text: >-
extract answers: Cenevizlilerin önemli üslerinden Amasra’yı aldı. <hl>
1479’da bir antlaşma yaparak Venedik'le 16 yıllık savaşa sona verdi. <hl>
example_title: Answer Extraction (History)
- text: >-
question: Sunulan yöntemle ne yapılabilir? context: Çalışmada sunulan
yöntemle, Türkçe metinlerden otomatik olarak soru ve cevap üretilebilir.
Bu proje ile paylaşılan kaynak kodu ile Türkçe Soru Üretme / Soru
Cevaplama konularında yeni akademik çalışmalar yapılabilir. Projenin
detaylarına paylaşılan Github ve Arxiv linklerinden ulaşılabilir.
license: cc-by-4.0
mt5-base for Turkish Question Generation
Automated question generation and question answering using text-to-text transformers by OBSS AI.
from core.api import GenerationAPI
generation_api = GenerationAPI('mt5-base-3task-highlight-tquad2')
Citation 📜
@article{akyon2022questgen,
author = {Akyon, Fatih Cagatay and Cavusoglu, Ali Devrim Ekin and Cengiz, Cemil and Altinuc, Sinan Onur and Temizel, Alptekin},
doi = {10.3906/elk-1300-0632.3914},
journal = {Turkish Journal of Electrical Engineering and Computer Sciences},
title = {{Automated question generation and question answering from Turkish texts}},
url = {https://journals.tubitak.gov.tr/elektrik/vol30/iss5/17/},
year = {2022}
}
Overview ✔️
Language model: mt5-base
Language: Turkish
Downstream-task: Extractive QA/QG, Answer Extraction
Training data: TQuADv2-train
Code: https://github.com/obss/turkish-question-generation
Paper: https://journals.tubitak.gov.tr/elektrik/vol30/iss5/17/
Hyperparameters
batch_size = 256
n_epochs = 15
base_LM_model = "mt5-base"
max_source_length = 512
max_target_length = 64
learning_rate = 1.0e-3
task_lisst = ["qa", "qg", "ans_ext"]
qg_format = "highlight"
Performance
Refer to paper.
Usage 🔥
from core.api import GenerationAPI
generation_api = GenerationAPI('mt5-base-3task-highlight-tquad2')
context = """
Bu modelin eğitiminde, Türkçe soru cevap verileri kullanılmıştır.
Çalışmada sunulan yöntemle, Türkçe metinlerden otomatik olarak soru ve cevap
üretilebilir. Bu proje ile paylaşılan kaynak kodu ile Türkçe Soru Üretme
/ Soru Cevaplama konularında yeni akademik çalışmalar yapılabilir.
Projenin detaylarına paylaşılan Github ve Arxiv linklerinden ulaşılabilir.
"""
# a) Fully Automated Question Generation
generation_api(task='question-generation', context=context)
# b) Question Answering
question = "Bu model ne işe yarar?"
generation_api(task='question-answering', context=context, question=question)
# b) Answer Extraction
generation_api(task='answer-extraction', context=context)