Views
No views yet
| Property | Details |
|---|---|
| Model Type | BERT for Sequence Classification |
| Base Model | indobenchmark/indobert-base-p1 |
| Language | Indonesian (id) |
| Task | Sentiment Analysis (Text Classification) |
| Labels | POSITIVE, NEGATIVE, NEUTRAL |
| Max Token Length | 512 |
| License | Apache 2.0 |
1learning_rate: 2e-5
2num_train_epochs: 5
3per_device_train_batch_size: 16
4per_device_eval_batch_size: 32
5warmup_steps: 500
6weight_decay: 0.01
7max_seq_length: 512
8optimizer: AdamW
9scheduler: linear_with_warmup| Metric | Score |
|---|---|
| Accuracy | 0.8921 |
| F1 Score (Macro) | 0.8847 |
| Precision (Macro) | 0.8803 |
| Recall (Macro) | 0.8893 |
1from transformers import pipeline
2
3sentiment = pipeline(
4 "text-classification",
5 model="Hadisawara/indonesian-tax-sentiment-bert"
6)
7
8result = sentiment("Pelayanan pajak online sudah sangat membantu wajib pajak")
9print(result)
10# [{'label': 'POSITIVE', 'score': 0.9734}]1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3import torch.nn.functional as F
4
5model_name = "Hadisawara/indonesian-tax-sentiment-bert"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9def predict_sentiment(text: str) -> dict:
10 inputs = tokenizer(
11 text,
12 return_tensors="pt",
13 truncation=True,
14 max_length=512,
15 padding=True
16 )
17 with torch.no_grad():
18 outputs = model(**inputs)
19 probs = F.softmax(outputs.logits, dim=-1)
20 labels = ["NEGATIVE", "NEUTRAL", "POSITIVE"]
21 return {
22 label: round(prob.item(), 4)
23 for label, prob in zip(labels, probs[0])
24 }
25
26texts = [
27 "Proses pelaporan SPT tahunan sangat mudah dan cepat.",
28 "Denda pajak yang dikenakan tidak masuk akal.",
29 "Sistem e-filing sudah diperbarui bulan ini."
30]
31
32for text in texts:
33 result = predict_sentiment(text)
34 print(f"Text: {text}")
35 print(f"Sentiment: {result}\n")1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2from torch.utils.data import DataLoader, Dataset
3import torch
4
5class TaxTextDataset(Dataset):
6 def __init__(self, texts, tokenizer, max_length=512):
7 self.encodings = tokenizer(
8 texts, truncation=True,
9 padding=True, max_length=max_length,
10 return_tensors="pt"
11 )
12
13 def __len__(self):
14 return len(self.encodings['input_ids'])
15
16 def __getitem__(self, idx):
17 return {k: v[idx] for k, v in self.encodings.items()}
18
19model_name = "Hadisawara/indonesian-tax-sentiment-bert"
20tokenizer = AutoTokenizer.from_pretrained(model_name)
21model = AutoModelForSequenceClassification.from_pretrained(model_name)
22model.eval()
23
24texts = ["teks 1", "teks 2", "teks 3"]
25dataset = TaxTextDataset(texts, tokenizer)
26loader = DataLoader(dataset, batch_size=8)
27
28all_predictions = []
29for batch in loader:
30 with torch.no_grad():
31 outputs = model(**batch)
32 preds = torch.argmax(outputs.logits, dim=-1)
33 all_predictions.extend(preds.tolist())
34
35id2label = {0: "NEGATIVE", 1: "NEUTRAL", 2: "POSITIVE"}
36results = [id2label[p] for p in all_predictions]
37print(results)1@misc{hadisawara2026indonesian,
2 title={Indonesian Tax Sentiment BERT: A Fine-tuned BERT Model for Indonesian Tax Sentiment Analysis},
3 author={Hadisawara},
4 year={2026},
5 publisher={Hugging Face},
6 url={https://huggingface.co/Hadisawara/indonesian-tax-sentiment-bert}
7}