ihsan31415 commited on
Commit
51e6e47
ยท
verified ยท
1 Parent(s): e966cf2

adding rreadme

Browse files
Files changed (1) hide show
  1. README.md +124 -156
README.md CHANGED
@@ -1,199 +1,167 @@
1
- ---
2
- library_name: transformers
3
- tags: []
4
- ---
5
-
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
11
-
12
- ## Model Details
13
-
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a ๐Ÿค— transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
- ## How to Get Started with the Model
 
 
71
 
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
 
125
- [More Information Needed]
126
 
127
- ### Results
 
 
128
 
129
- [More Information Needed]
 
130
 
131
- #### Summary
 
 
 
 
132
 
 
133
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
 
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
 
144
 
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
154
 
155
- ### Model Architecture and Objective
 
156
 
157
- [More Information Needed]
158
 
159
- ### Compute Infrastructure
160
 
161
- [More Information Needed]
 
 
 
 
162
 
163
- #### Hardware
164
 
165
- [More Information Needed]
 
 
 
 
166
 
167
- #### Software
168
 
169
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
 
171
- ## Citation [optional]
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
- **BibTeX:**
 
 
176
 
177
- [More Information Needed]
 
 
178
 
179
- **APA:**
 
 
 
180
 
181
- [More Information Needed]
 
182
 
183
- ## Glossary [optional]
 
 
 
 
 
 
 
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
 
 
 
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
1
+ You're absolutely right โ€” label flipping is **critical** here since the base model you fine-tuned uses a **non-standard label mapping** (`0 = Positive`, `2 = Negative`). Here's the **updated and corrected** model card with:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ * ๐Ÿ” Clear warning about label flipping
4
+ * ๐Ÿงช Updated usage code with correct interpretation
5
+ * โœ… Rewritten explanation for clarity
6
 
7
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ # ๐Ÿ‡ฎ๐Ÿ‡ฉ Fine-Tuned IndoRoBERTa for Indonesian Financial Sentiment Classification
10
 
11
+ This is a fine-tuned version of [`w11wo/indonesian-roberta-base-sentiment-classifier`](https://huggingface.co/w11wo/indonesian-roberta-base-sentiment-classifier), specialized for **Indonesian financial news sentiment classification**.
12
 
13
+ ---
14
 
15
+ ## ๐Ÿง  Model Objective
16
 
17
+ This model classifies Indonesian financial news articles into:
18
 
19
+ * `0` โ†’ **Positive**
20
+ * `1` โ†’ **Neutral**
21
+ * `2` โ†’ **Negative**
22
 
23
+ โš ๏ธ **Important: Label Mapping is Flipped**
24
+ This label order follows the base model's unexpected configuration. During training and evaluation, the dataset was relabeled accordingly.
25
 
26
+ > โš ๏ธ Always interpret model output using this mapping:
27
+ >
28
+ > * `0`: Positive
29
+ > * `1`: Neutral
30
+ > * `2`: Negative
31
 
32
+ ---
33
 
34
+ ## ๐Ÿ“Š Dataset & Preprocessing Pipeline
35
 
36
+ ### ๐Ÿ”น Source Dataset
37
 
38
+ * [`intanm/indonesian-financial-sentiment-analysis`](https://huggingface.co/datasets/intanm/indonesian-financial-sentiment-analysis)
39
+ * Labeled financial news (imbalanced and limited)
40
 
41
+ ### ๐Ÿ“ˆ Data Augmentation & Balancing
42
 
43
+ #### 1. ๐Ÿงช Gemini Synthetic Generation
44
 
45
+ * Generated structured financial news samples using `gemini-2.0-flash-lite`
46
+ * Targeted generation for underrepresented classes
47
 
48
+ #### 2. โœ๏ธ GPT-2 Prompt Completion
49
 
50
+ * Used [`indonesian-nlp/gpt2-medium-indonesian`](https://huggingface.co/indonesian-nlp/gpt2-medium-indonesian)
51
+ * Prompt templates varied and strictly separated between train/test sets
 
 
 
52
 
53
+ #### 3. ๐Ÿงฉ Roberta-Based Masked Augmentation
54
 
55
+ * Strategic masking/filling while protecting key financial terms
56
+ * Iterative masking to increase diversity and context coverage
57
 
58
+ #### ๐Ÿ“Š Final Label Distribution
59
 
60
+ **Train Set**:
61
 
62
+ ```
63
+ 2 (Negative): 22906
64
+ 1 (Neutral): 23374
65
+ 0 (Positive): 23423
66
+ ```
67
 
68
+ **Test Set**:
69
 
70
+ ```
71
+ 2 (Negative): 9817
72
+ 1 (Neutral): 10018
73
+ 0 (Positive): 10039
74
+ ```
75
 
76
+ ---
77
 
78
+ ## ๐Ÿ‹๏ธ Training Details
79
+
80
+ ### ๐Ÿ” Label Flipping
81
+
82
+ > The base model uses **non-standard labels**:
83
+ >
84
+ > * `0`: Positive
85
+ > * `1`: Neutral
86
+ > * `2`: Negative
87
+ >
88
+ > Training data was relabeled accordingly.
89
+
90
+ ### ๐Ÿ”ง TrainingArguments
91
+
92
+ ```python
93
+ TrainingArguments(
94
+ output_dir="./results-roberta",
95
+ eval_strategy="epoch",
96
+ save_strategy="epoch",
97
+ logging_strategy="epoch",
98
+ per_device_train_batch_size=256,
99
+ per_device_eval_batch_size=256,
100
+ num_train_epochs=15,
101
+ learning_rate=2e-5,
102
+ weight_decay=0.01,
103
+ load_best_model_at_end=True,
104
+ metric_for_best_model="accuracy",
105
+ save_total_limit=4,
106
+ )
107
+ ```
108
+
109
+ * Early stopping (`patience=2`)
110
+ * Training completed at **epoch 5**, best model from **epoch 3**
111
+
112
+ ### โœ… Evaluation Results
113
+
114
+ ```
115
+ eval_accuracy = 0.9749
116
+ eval_precision = 0.9749
117
+ eval_recall = 0.9749
118
+ eval_f1 = 0.9749
119
+ ```
120
 
121
+ ---
122
 
123
+ ## ๐Ÿ”Ž Usage
124
 
125
+ ```python
126
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
127
+ import torch
128
 
129
+ # Load model and tokenizer
130
+ model = AutoModelForSequenceClassification.from_pretrained("ihsan31415/finetuned-indo-roBERTa-financial-sentiment")
131
+ tokenizer = AutoTokenizer.from_pretrained("ihsan31415/finetuned-indo-roBERTa-financial-sentiment")
132
 
133
+ # Example input
134
+ text = "IHSG diprediksi melemah karena sentimen global negatif"
135
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
136
+ outputs = model(**inputs)
137
 
138
+ # Get predicted class
139
+ predicted_label = torch.argmax(outputs.logits, dim=1).item()
140
 
141
+ # Interpret using flipped label mapping
142
+ label_map = {
143
+ 0: "Positive",
144
+ 1: "Neutral",
145
+ 2: "Negative"
146
+ }
147
+ print(f"Predicted sentiment: {label_map[predicted_label]}")
148
+ ```
149
 
150
+ ---
151
 
152
+ ## ๐Ÿ“Œ Citation
153
 
154
+ If you use this model in your research or application, please cite or link to this model card.
155
 
156
+ ---
157
 
158
+ ## ๐Ÿ“ฌ Contact
159
 
160
+ Created by
161
+ [`ihsan31415`](https://huggingface.co/ihsan31415)
162
+ [`ihsan31415`](https://github.com/ihsan31415)
163
+ [`Khoirul Ihsan`](https://www.linkedin.com/in/khoirul-ihsan-387115288/)
164
 
165
+ For collaborations or questions, feel free to reach out via Hugging Face or GitHub.
166
 
167
+ ---