bayrameker
commited on
Commit
•
0ebed11
1
Parent(s):
ee2c8f0
Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,150 @@
|
|
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 |
-
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
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 |
-
|
29 |
|
30 |
-
|
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 |
-
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
|
46 |
-
### Downstream Use
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
61 |
|
62 |
-
|
|
|
63 |
|
64 |
-
###
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
|
68 |
-
|
|
|
69 |
|
70 |
-
|
71 |
|
72 |
-
|
|
|
73 |
|
74 |
-
|
75 |
|
76 |
-
##
|
77 |
|
78 |
-
|
79 |
|
80 |
-
|
|
|
81 |
|
82 |
-
|
|
|
83 |
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
|
|
|
92 |
|
93 |
-
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
98 |
|
99 |
-
|
|
|
|
|
|
|
|
|
100 |
|
101 |
-
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
|
113 |
-
|
114 |
|
115 |
-
|
116 |
|
117 |
-
|
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 |
-
|
130 |
-
|
131 |
-
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
135 |
-
## Model Examination
|
136 |
|
137 |
-
|
138 |
|
139 |
-
|
140 |
|
141 |
## Environmental Impact
|
142 |
|
143 |
-
|
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 |
-
|
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 |
-
##
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
|
|
|
|
194 |
|
195 |
-
|
196 |
|
197 |
-
|
198 |
|
199 |
-
[
|
|
|
1 |
+
### Model Card for Defense BERT Classifier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
---
|
4 |
|
5 |
+
# Model Details
|
6 |
|
7 |
### Model Description
|
8 |
|
9 |
+
This is a fine-tuned version of the `bert-base-uncased` model for a binary text classification task. The model predicts whether a given text is related to defense topics (`LABEL_1`) or not (`LABEL_0`).
|
10 |
|
11 |
+
- **Developed by:** Bayram Eker
|
12 |
+
- **Funded by:** Self-initiated project
|
13 |
+
- **Model type:** BERT-based binary classifier
|
14 |
+
- **Language(s):** English
|
15 |
+
- **License:** Apache 2.0
|
16 |
+
- **Fine-tuned from:** `bert-base-uncased`
|
17 |
|
18 |
+
### Model Sources
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
- **Repository:** [Hugging Face Model Page](https://huggingface.co/bayrameker/defense-bert-classifier)
|
21 |
|
22 |
+
---
|
|
|
|
|
|
|
|
|
23 |
|
24 |
## Uses
|
25 |
|
|
|
|
|
26 |
### Direct Use
|
27 |
|
28 |
+
The model can be directly used for binary classification tasks, especially for categorizing text as defense-related or not.
|
|
|
|
|
29 |
|
30 |
+
### Downstream Use
|
31 |
|
32 |
+
The model can be fine-tuned further for related tasks or used as-is for applications involving text categorization in the defense domain.
|
|
|
|
|
33 |
|
34 |
### Out-of-Scope Use
|
35 |
|
36 |
+
The model may not perform well on tasks outside its training scope, such as multi-class classification, domain-specific subcategories, or other unrelated text analysis.
|
37 |
|
38 |
+
---
|
39 |
|
40 |
## Bias, Risks, and Limitations
|
41 |
|
42 |
+
### Risks
|
43 |
|
44 |
+
- The model was trained on a small and simple dataset, which may not generalize well to all defense-related contexts.
|
45 |
+
- Imbalanced classes in the dataset may lead to biased predictions, favoring the dominant label.
|
46 |
|
47 |
+
### Limitations
|
|
|
|
|
48 |
|
49 |
+
- The training dataset includes only basic examples and may not cover nuanced or complex defense-related topics.
|
50 |
+
- Misclassifications may occur for texts with ambiguous contexts or overlapping themes (e.g., cybersecurity, geopolitics).
|
51 |
|
52 |
+
### Recommendations
|
53 |
|
54 |
+
- It is recommended to fine-tune the model on a larger, balanced, and more diverse dataset for improved performance.
|
55 |
+
- Use additional preprocessing steps to ensure input data quality for better predictions.
|
56 |
|
57 |
+
---
|
58 |
|
59 |
+
## How to Get Started with the Model
|
60 |
|
61 |
+
You can load and test the model using the following code:
|
62 |
|
63 |
+
```python
|
64 |
+
from transformers import pipeline
|
65 |
|
66 |
+
# Load the model
|
67 |
+
classifier = pipeline("text-classification", model="bayrameker/defense-bert-classifier")
|
68 |
|
69 |
+
# Example texts
|
70 |
+
texts = [
|
71 |
+
"The military conducted joint exercises to enhance readiness.",
|
72 |
+
"The government approved increased spending on national security.",
|
73 |
+
"A new bakery opened downtown, offering a variety of pastries.",
|
74 |
+
"The movie was a thrilling adventure set in space."
|
75 |
+
]
|
76 |
|
77 |
+
# Predictions
|
78 |
+
for text in texts:
|
79 |
+
result = classifier(text)
|
80 |
+
print(f"Text: {text}")
|
81 |
+
print(f"Prediction: {result}")
|
82 |
+
print("-" * 50)
|
83 |
+
```
|
84 |
|
85 |
+
---
|
86 |
|
87 |
+
## Training Details
|
88 |
|
89 |
+
### Training Data
|
90 |
|
91 |
+
The model was fine-tuned on a small, simple dataset containing sentences labeled as defense-related or not based on their context. The dataset was synthetically generated and not domain-specific.
|
92 |
|
93 |
+
### Training Procedure
|
94 |
|
95 |
+
The model was trained for 5 epochs using the following settings:
|
96 |
|
97 |
+
- **Optimizer:** AdamW
|
98 |
+
- **Learning rate:** `2e-5`
|
99 |
+
- **Batch size:** 4 (train), 8 (validation)
|
100 |
+
- **Evaluation strategy:** Epoch-based
|
101 |
+
- **Weight Decay:** 0.01
|
102 |
|
103 |
+
---
|
104 |
|
105 |
## Evaluation
|
106 |
|
107 |
+
### Testing Data
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
The testing dataset consisted of examples from the training data's domain and context. The accuracy was approximately **83%**, indicating acceptable but improvable performance.
|
110 |
|
111 |
+
### Metrics
|
112 |
|
113 |
+
The evaluation was conducted using standard binary classification metrics such as precision, recall, F1-score, and accuracy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
### Results
|
116 |
|
117 |
+
Example predictions from the model:
|
118 |
+
- **"The military conducted joint exercises to enhance readiness.":** Predicted `LABEL_0` (Not Defense) with 95.2% confidence.
|
119 |
+
- **"The government approved increased spending on national security.":** Predicted `LABEL_1` (Defense) with 66.6% confidence.
|
120 |
+
- **"A new bakery opened downtown, offering a variety of pastries.":** Predicted `LABEL_1` (Defense) with 55.9% confidence.
|
121 |
|
122 |
+
These results indicate areas where the model can be improved, particularly in distinguishing nuanced cases.
|
123 |
|
124 |
+
---
|
125 |
|
126 |
+
## Model Examination
|
127 |
|
128 |
+
The model shows high confidence for certain classes but struggles with borderline or ambiguous cases. This behavior can be addressed by improving the training dataset's quality and diversity.
|
129 |
|
130 |
+
---
|
131 |
|
132 |
## Environmental Impact
|
133 |
|
134 |
+
Training the model on a simple dataset required minimal computational resources, resulting in negligible environmental impact. However, larger-scale training would require significant hardware and energy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
+
## Citation
|
139 |
|
140 |
+
If you use this model, please cite it as:
|
141 |
|
142 |
+
```plaintext
|
143 |
+
Bayram Eker, Defense BERT Classifier, 2024. Available at https://huggingface.co/bayrameker/defense-bert-classifier.
|
144 |
+
```
|
145 |
|
146 |
+
---
|
147 |
|
148 |
+
### Contact
|
149 |
|
150 |
+
For questions or further details, please contact: [Bayram Eker](https://huggingface.co/bayrameker).
|