political-bias-classifier

Hugging Face Model License


πŸ“– Model Description

The political-bias-classifier is a fine-tuned DistilBERT model designed for text classification to identify and categorize political bias within a given text.

This model is intended to analyze the political leaning expressed in textual content, such as news headlines, articles, or social media commentary.

Detail Value
Base Model DistilBERT
Model Type Text Classification (Sequence Classification)
Weights Format Safetensors (model.safetensors)
License Apache-2.0
File Size ~268 MB

πŸš€ Usage

You can easily use this model for inference with the Hugging Face transformers library.

Using the Pipeline

The simplest way to get a prediction is by using the pipeline abstraction:

from transformers import pipeline

# Initialize the classifier pipeline
classifier = pipeline(
    "text-classification", 
    model="Arstacity/political-bias-classifier"
)

# Example text for analysis
text_to_analyze = "The new trade bill is a crucial step towards economic growth, despite the opposition's claims of cronyism."

# Get the prediction
result = classifier(text_to_analyze)

print(result)
# Example Output Format (Actual labels and scores will vary): 
# [{'label': 'RIGHT_LEANING', 'score': 0.9542}]

Direct Model Loading

For more control, you can load the tokenizer and model directly:

from transformers import AutoModelForSequenceClassification, AutoTokenizer

model_name = "Arstacity/political-bias-classifier"

# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Load the model
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# You are now ready to perform tokenization and inference.

Files in Repository

This repository contains all the necessary files for the DistilBERT model and tokenizer:

File Name Description
model.safetensors The main model weights file (268 MB).
config.json Configuration file for the model architecture
vocab.txt Vocabulary file for the tokenizer
tokenizer.json The tokenizer configuration file
tokenizer_config.json Tokenizer metadata
special_tokens_map.json Mapping for special tokens.

License: Apache 2.0

Downloads last month
4
Safetensors
Model size
67M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Arstacity/political-bias-classifier

Quantizations
1 model