Downloads · 30 days
136
2% of all-time downloads
ytu-ce-cosmos/turkish-tiny-bert-uncased
turkish-tiny-bert-uncased is a fill-mask model from ytu-ce-cosmos. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as mit.
This is a Turkish Tiny uncased BERT model, developed to fill the gap for small-sized BERT models for Turkish. Since this model is uncased: it does not make a difference between turkish and Turkish.
Downloads · 30 days
136
2% of all-time downloads
All-time downloads
8.4K
Public
Parameters
4.6M
146 MB on disk
Likes
8
Public
Click a slice to open those files.
.h535.2 MB · 49%
From the Hugging Face model README
This is a Turkish Tiny uncased BERT model, developed to fill the gap for small-sized BERT models for Turkish. Since this model is uncased: it does not make a difference between turkish and Turkish.
Don't use the do_lower_case = True flag with the tokenizer. Instead, convert your text to lower case as follows:
text.replace("I", "ı").lower()
This is due to a known issue with the tokenizer.
Be aware that this model may exhibit biased predictions as it was trained primarily on crawled data, which inherently can contain various biases.
Other relevant information can be found in the paper.
from transformers import AutoTokenizer, BertForMaskedLM
from transformers import pipeline
model = BertForMaskedLM.from_pretrained("ytu-ce-cosmos/turkish-tiny-bert-uncased")
# or
# model = BertForMaskedLM.from_pretrained("ytu-ce-cosmos/turkish-tiny-bert-uncased", from_tf = True)
tokenizer = AutoTokenizer.from_pretrained("ytu-ce-cosmos/turkish-tiny-bert-uncased")
unmasker = pipeline('fill-mask', model=model, tokenizer=tokenizer)
unmasker("gelirken bir litre [MASK] aldım.")
# [{'score': 0.202457457780838,
# 'token': 2417,
# 'token_str': 'su',
# 'sequence': 'gelirken bir litre su aldım.'},
# {'score': 0.09290537238121033,
# 'token': 11818,
# 'token_str': 'benzin',
# 'sequence': 'gelirken bir litre benzin aldım.'},
# {'score': 0.07785643637180328,
# 'token': 2026,
# 'token_str': '##den',
# 'sequence': 'gelirken bir litreden aldım.'},
# {'score': 0.06889808923006058,
# 'token': 2299,
# 'token_str': '##yi',
# 'sequence': 'gelirken bir litreyi aldım.'},
# {'score': 0.03152570128440857,
# 'token': 2647,
# 'token_str': '##ye',
# 'sequence': 'gelirken bir litreye aldım.'}]
@article{kesgin2023developing,
title={Developing and Evaluating Tiny to Medium-Sized Turkish BERT Models},
author={Kesgin, Himmet Toprak and Yuce, Muzaffer Kaan and Amasyali, Mehmet Fatih},
journal={arXiv preprint arXiv:2307.14134},
year={2023}
}
MIT