🚀 GreekBART: The First Pretrained Greek Sequence-to-Sequence Model
GreekBART is the first pre - trained Greek sequence - to - sequence model. It addresses the need for high - quality generative language processing in Greek, offering capabilities like abstractive summarization and sentiment classification.
🚀 Quick Start
GreekBART is a Greek sequence to sequence pretrained model based on BART. It is pretrained by learning to reconstruct a corrupted input sentence, using a 76.9GB corpus of Greek raw text. Unlike existing BERT - based Greek language models (GreekBERT), GreekBART is well - suited for generative tasks as both its encoder and decoder are pretrained. Besides the base GreekBART, it is also fine - tuned on three tasks: greekbart - news24 - abstract
for generating abstracts from Greek news articles, greekbart - news24 - title
for generating titles from Greek news articles, and greekbart - sentiment - classification
for binary sentiment classification.
Paper: https://arxiv.org/pdf/2304.00869
GitHub: https://github.com/iakovosevdaimon/GreekBART
✨ Features
- Generative Capabilities: Well - suited for generative tasks such as abstractive summarization, thanks to the pretrained decoder.
- Multiple Fine - Tuned Models: Available in fine - tuned versions for news abstract generation, news title generation, and sentiment classification.
💻 Usage Examples
📋 Basic Usage
Mask Prediction
from transformers import pipeline
greekbart_fill_mask = pipeline("fill-mask", model="dascim/greekbart", tokenizer="dascim/greekbart")
results = greekbart_fill_mask("Η πρωτεύουσα της Ελλάδας είναι η <mask>")
results[0]
Abstract Generation
text_sentence = 'Στην κατάθεση νοσηλεύτριας του Καραμανδάνειου Νοσοκομείου Πάτρας Παναγιώτας Τσεντούρου, η οποία εργαζόταν όταν εισήχθη στις 8 Απριλίου 2021 η Τζωρτζίνα, προχώρησε η διαδικασία ενώπιον του ΜΟΔ που δικάζει τη Ρούλα Πισπιρίγκου. Η νοσηλεύτρια κατέθεσε πως κατά την εισαγωγή του παιδιού "μου ανέφεραν πως είναι ένα παιδάκι που έχει χάσει τα αδελφάκια του και ότι είναι ιδιαίτερη περίπτωση" και εξιστόρησε τα γεγονότα της ημέρας εισαγωγής και της επομένης που η ίδια είχε βάρδια στην παιδιατρική κλινική.'
from transformers import (
AutoTokenizer,
AutoModelForSeq2SeqLM
)
tokenizer = AutoTokenizer.from_pretrained("dascim/greekbart-news24-abstract")
model = AutoModelForSeq2SeqLM.from_pretrained("dascim/greekbart-news24-abstract")
input_ids = tokenizer.encode(text_sentence, add_special_tokens=True, return_tensors='pt')
model.eval()
predict = model.generate(input_ids, max_length=100)[0]
tokenizer.decode(predict, skip_special_tokens=True)
Title Generation
text_sentence = 'Στην κατάθεση νοσηλεύτριας του Καραμανδάνειου Νοσοκομείου Πάτρας Παναγιώτας Τσεντούρου, η οποία εργαζόταν όταν εισήχθη στις 8 Απριλίου 2021 η Τζωρτζίνα, προχώρησε η διαδικασία ενώπιον του ΜΟΔ που δικάζει τη Ρούλα Πισπιρίγκου. Η νοσηλεύτρια κατέθεσε πως κατά την εισαγωγή του παιδιού "μου ανέφεραν πως είναι ένα παιδάκι που έχει χάσει τα αδελφάκια του και ότι είναι ιδιαίτερη περίπτωση" και εξιστόρησε τα γεγονότα της ημέρας εισαγωγής και της επομένης που η ίδια είχε βάρδια στην παιδιατρική κλινική.'
from transformers import (
AutoTokenizer,
AutoModelForSeq2SeqLM
)
tokenizer = AutoTokenizer.from_pretrained("dascim/greekbart-news24-title")
model = AutoModelForSeq2SeqLM.from_pretrained("dascim/greekbart-news24-title")
input_ids = tokenizer.encode(text_sentence, add_special_tokens=True, return_tensors='pt')
model.eval()
predict = model.generate(input_ids, max_length=100)[0]
tokenizer.decode(predict, skip_special_tokens=True)
Sentiment Prediction
text_sentence = "Ο ελληνικός πολιτισμός είναι ένας από τους πιο πλούσιους και αναγνωρισμένους πολιτισμούς."
from transformers import (
AutoTokenizer,
AutoModelForSequenceClassification
)
tokenizer = AutoTokenizer.from_pretrained("dascim/greekbart-sentiment-classification")
model = AutoModelForSequenceClassification.from_pretrained("dascim/greekbart-sentiment-classification")
input_ids = tokenizer.encode(text_sentence, add_special_tokens=True, return_tensors='pt')
model.eval()
predict = model(input_ids)[0]
print("negative" if predict.argmax(dim=-1).item()==1 else "positive")
📄 License
This project is licensed under the MIT license.
📚 Documentation
Authors
GreekBART was trained and evaluated at École Polytechnique by Iakovos Evdaimon, Hadi Abdine, Christos Xypolopoulos, Stamatis Outsios, Michalis Vazirgiannis and Giorgos Stamou.
Citation
If you use our work, please cite:
@inproceedings{evdaimon-etal-2024-greekbart,
title = "{G}reek{BART}: The First Pretrained {G}reek Sequence-to-Sequence Model",
author = "Evdaimon, Iakovos and
Abdine, Hadi and
Xypolopoulos, Christos and
Outsios, Stamatis and
Vazirgiannis, Michalis and
Stamou, Giorgos",
editor = "Calzolari, Nicoletta and
Kan, Min-Yen and
Hoste, Veronique and
Lenci, Alessandro and
Sakti, Sakriani and
Xue, Nianwen",
booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)",
month = may,
year = "2024",
address = "Torino, Italia",
publisher = "ELRA and ICCL",
url = "https://aclanthology.org/2024.lrec-main.700",
pages = "7949--7962",
}