Views
No views yet
{
"epochs": 3 (setting 10 but early stopped),
"batch_size":32,
"optimizer_class": "<keras.optimizer_v2.adam.Adam'>",
"optimizer_params": {
"lr": 5e-05
},
"min_delta": 0.01
}1from transformers import RobertaTokenizerFast, RobertaForSequenceClassification, TextClassificationPipeline
2
3# Load fine-tuned model by HuggingFace Model Hub
4HUGGINGFACE_MODEL_PATH = "bespin-global/klue-roberta-small-3i4k-intent-classification"
5loaded_tokenizer = RobertaTokenizerFast.from_pretrained(HUGGINGFACE_MODEL_PATH )
6loaded_model = RobertaForSequenceClassification.from_pretrained(HUGGINGFACE_MODEL_PATH )
7
8# using Pipeline
9text_classifier = TextClassificationPipeline(
10 tokenizer=loaded_tokenizer,
11 model=loaded_model,
12 return_all_scores=True
13)
14
15# predict
16text = "your text"
17
18preds_list = text_classifier(text)
19best_pred = preds_list[0]
20print(f"Label of Best Intentatioin: {best_pred['label']}")
21print(f"Score of Best Intentatioin: {best_pred['score']}") precision recall f1-score support
command 0.89 0.92 0.90 1296
fragment 0.98 0.96 0.97 600
intonation-depedent utterance 0.71 0.69 0.70 327
question 0.95 0.97 0.96 1786
rhetorical command 0.87 0.64 0.74 108
rhetorical question 0.61 0.63 0.62 174
statement 0.91 0.89 0.90 1830
accuracy 0.90 6121
macro avg 0.85 0.81 0.83 6121
weighted avg 0.90 0.90 0.90 6121