Downloads · 30 days
9
1% of all-time downloads
lst-nectec/HoogBERTa-POS-lst20
HoogBERTa-POS-lst20 is a token classification model from lst-nectec. Use it when you need labels on individual words, such as names. It is set up for transformers.
This repository includes the Thai pretrained language representation (HoogBERTabase) fine-tuned for Part-of-Speech Tagging (POS) Task.
Downloads · 30 days
9
1% of all-time downloads
All-time downloads
761
Public
Parameters
143M
1.7 GB on disk
Likes
1
Public
Click a slice to open those files.
.bin572 MB · 50%
How the weights are stored.
F32143M · 100%
From the Hugging Face model README
This repository includes the Thai pretrained language representation (HoogBERTa_base) fine-tuned for Part-of-Speech Tagging (POS) Task.
Since we use subword-nmt BPE encoding, input needs to be pre-tokenize using BEST standard before inputting into HoogBERTa
pip install attacut
To initialize the model from hub, use the following commands
from transformers import RobertaTokenizerFast, RobertaForTokenClassification
from attacut import tokenize
import torch
tokenizer = RobertaTokenizerFast.from_pretrained("lst-nectec/HoogBERTa-POS-lst20")
model = RobertaForTokenClassification.from_pretrained("lst-nectec/HoogBERTa-POS-lst20")
To do POS Tagging, use the following commands
from transformers import pipeline
nlp = pipeline('token-classification', model=model, tokenizer=tokenizer, aggregation_strategy="none")
sentence = "วันที่ 12 มีนาคมนี้ ฉันจะไปเที่ยววัดพระแก้ว ที่กรุงเทพ"
all_sent = []
sentences = sentence.split(" ")
for sent in sentences:
all_sent.append(" ".join(tokenize(sent)).replace("_","[!und:]"))
sentence = " _ ".join(all_sent)
print(nlp(sentence))
For batch processing,
from transformers import pipeline
nlp = pipeline('token-classification', model=model, tokenizer=tokenizer, aggregation_strategy="none")
sentenceL = ["วันที่ 12 มีนาคมนี้","ฉันจะไปเที่ยววัดพระแก้ว ที่กรุงเทพ"]
inputList = []
for sentX in sentenceL:
sentences = sentX.split(" ")
all_sent = []
for sent in sentences:
all_sent.append(" ".join(tokenize(sent)).replace("_","[!und:]"))
sentence = " _ ".join(all_sent)
inputList.append(sentence)
print(nlp(inputList))
HoogBERTaEncoderFeature Extraction and Mask Language ModelingHoogBERTaMuliTaskTagger:Named-entity recognition (NER) based on LST20Part-of-speech tagging (POS) based on LST20Clause Boundary Classification based on LST20Please cite as:
@inproceedings{porkaew2021hoogberta,
title = {HoogBERTa: Multi-task Sequence Labeling using Thai Pretrained Language Representation},
author = {Peerachet Porkaew, Prachya Boonkwan and Thepchai Supnithi},
booktitle = {The Joint International Symposium on Artificial Intelligence and Natural Language Processing (iSAI-NLP 2021)},
year = {2021},
address={Online}
}