Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- text-classification
|
| 4 |
+
- distilbert
|
| 5 |
+
- political-bias
|
| 6 |
+
- safetensors
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# political-bias-classifier
|
| 11 |
+
[](https://huggingface.co/models?search=distilbert)
|
| 12 |
+
[](https://www.apache.org/licenses/LICENSE-2.0)
|
| 13 |
+
|
| 14 |
+
***
|
| 15 |
+
|
| 16 |
+
## 📖 Model Description
|
| 17 |
+
|
| 18 |
+
The **political-bias-classifier** is a fine-tuned **DistilBERT** model designed for **text classification** to identify and categorize political bias within a given text.
|
| 19 |
+
|
| 20 |
+
This model is intended to analyze the political leaning expressed in textual content, such as news headlines, articles, or social media commentary.
|
| 21 |
+
|
| 22 |
+
| Detail | Value |
|
| 23 |
+
| :--- | :--- |
|
| 24 |
+
| **Base Model** | DistilBERT |
|
| 25 |
+
| **Model Type** | Text Classification (Sequence Classification) |
|
| 26 |
+
| **Weights Format**| Safetensors (`model.safetensors`) |
|
| 27 |
+
| **License** | Apache-2.0 |
|
| 28 |
+
| **File Size** | ~268 MB |
|
| 29 |
+
|
| 30 |
+
***
|
| 31 |
+
|
| 32 |
+
## 🚀 Usage
|
| 33 |
+
|
| 34 |
+
You can easily use this model for inference with the Hugging Face `transformers` library.
|
| 35 |
+
|
| 36 |
+
### Using the Pipeline
|
| 37 |
+
|
| 38 |
+
The simplest way to get a prediction is by using the `pipeline` abstraction:
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from transformers import pipeline
|
| 42 |
+
|
| 43 |
+
# Initialize the classifier pipeline
|
| 44 |
+
classifier = pipeline(
|
| 45 |
+
"text-classification",
|
| 46 |
+
model="Arstacity/political-bias-classifier"
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
# Example text for analysis
|
| 50 |
+
text_to_analyze = "The new trade bill is a crucial step towards economic growth, despite the opposition's claims of cronyism."
|
| 51 |
+
|
| 52 |
+
# Get the prediction
|
| 53 |
+
result = classifier(text_to_analyze)
|
| 54 |
+
|
| 55 |
+
print(result)
|
| 56 |
+
# Example Output Format (Actual labels and scores will vary):
|
| 57 |
+
# [{'label': 'RIGHT_LEANING', 'score': 0.9542}]
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### Direct Model Loading
|
| 61 |
+
|
| 62 |
+
For more control, you can load the tokenizer and model directly:
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 66 |
+
|
| 67 |
+
model_name = "Arstacity/political-bias-classifier"
|
| 68 |
+
|
| 69 |
+
# Load the tokenizer
|
| 70 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 71 |
+
|
| 72 |
+
# Load the model
|
| 73 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 74 |
+
|
| 75 |
+
# You are now ready to perform tokenization and inference.
|
| 76 |
+
```
|
| 77 |
+
***
|
| 78 |
+
## Files in Repository
|
| 79 |
+
|
| 80 |
+
This repository contains all the necessary files for the DistilBERT model and tokenizer:
|
| 81 |
+
|
| 82 |
+
| File Name | Description |
|
| 83 |
+
| :--- | :--- |
|
| 84 |
+
| **model.safetensors** | The main model weights file (268 MB). |
|
| 85 |
+
| **config.json** | Configuration file for the model architecture |
|
| 86 |
+
| **vocab.txt**| Vocabulary file for the tokenizer |
|
| 87 |
+
| **tokenizer.json** | The tokenizer configuration file |
|
| 88 |
+
| **tokenizer_config.json** | Tokenizer metadata |
|
| 89 |
+
| **special_tokens_map.json** | Mapping for special tokens. |
|
| 90 |
+
***
|
| 91 |
+
|
| 92 |
+
License: Apache 2.0
|
| 93 |
+
---
|