Downloads · 30 days
7
21% of all-time downloads
StrangeSX/NN_19K_NERFT
NN_19K_NERFT is a token classification model from StrangeSX. Use it when you need labels on individual words, such as names. It is set up for transformers.
NN-NER-FT เป็นโมเดลสำหรับงาน Named Entity Recognition (NER) ในภาษาไทย ที่ผ่านการ fine-tune จากโมเดลพื้นฐาน โดยใช้ชุดข้อมูล NN-NER จาก Hugging Face ในการฝึก โมเดลนี้สามารถระบุ entity ต่าง ๆ เช่น BRAND, PRODUCTNAME, PRO…
Downloads · 30 days
7
21% of all-time downloads
All-time downloads
34
Public
Parameters
105M
420 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors419 MB · 99%
From the Hugging Face model README
NN-NER-FT เป็นโมเดลสำหรับงาน Named Entity Recognition (NER) ในภาษาไทย ที่ผ่านการ fine-tune จากโมเดลพื้นฐาน โดยใช้ชุดข้อมูล NN-NER จาก Hugging Face ในการฝึก
โมเดลนี้สามารถระบุ entity ต่าง ๆ เช่น BRAND, PRODUCT_NAME, PRODUCT_SIZE, SPEC, SPEC_PER_UNIT, PACKAGE, และอื่น ๆ ในข้อความภาษาไทย
eval_lossthainer_training_args = TrainingArguments(
output_dir=path.join("finetuned_models", "NN-NER-FT"),
overwrite_output_dir=True,
evaluation_strategy="steps",
eval_steps=100,
save_strategy="steps",
save_steps=100,
save_total_limit=5,
per_device_train_batch_size=16,
per_device_eval_batch_size=16,
learning_rate=3e-5,
warmup_ratio=0.1,
weight_decay=0.01,
adam_beta1=0.9,
adam_beta2=0.999,
adam_epsilon=1e-8,
num_train_epochs=3,
fp16=True,
load_best_model_at_end=True,
metric_for_best_model="eval_loss"
)
def thainer_f1_metric(eval_pred):
predictions = eval_pred.predictions.argmax(axis=2)
labels = eval_pred.label_ids
predictions = [
[thainer_id2label[p] for p, l in zip(p_row, l_row) if l != -100]
for p_row, l_row in zip(predictions, labels)
]
labels = [
[thainer_id2label[l] for l in l_row if l != -100]
for l_row in labels
]
result = seqeval_metric(y_pred=predictions, y_true=labels, output_dict=True)
tag_set = {tag[2:] for tag in thainer_id2label.values() if tag != "O"}
return {
"micro_average_f1": result["micro avg"]["f1-score"],
"macro_average_f1": result["macro avg"]["f1-score"],
"class_f1": {
tag: result[tag]["f1-score"]
for tag in result if tag in tag_set
}
}
thainer_trainer = Trainer(
model=thainer_model,
args=thainer_training_args,
train_dataset=thainer["train"],
eval_dataset=thainer["validation"],
tokenizer=tokenizer,
data_collator=thainer_data_collator,
compute_metrics=thainer_f1_metric
)