Downloads · 30 days
4
12% of all-time downloads
swp-berlin/deberta-base-news-topics-kenia-china
deberta-base-news-topics-kenia-china is a text classification model from swp-berlin. Use it when you need a label for a piece of text. It is set up for transformers.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Downloads · 30 days
4
12% of all-time downloads
All-time downloads
33
Public
Parameters
184M
740 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors738 MB · 99%
From the Hugging Face model README
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
The model swp-berlin/deberta-base-news-topics-kenia-china has been trained on about 700 articles from Kenyan newspapers to detect the presence of the following topics:
This model can be directly applied to classify articles based on the above topics, making it suitable for use in media analysis, content categorization, and research on public discourse in Kenyan media.
The model swp-berlin/deberta-base-news-topics-kenia-china was trained on approximately 700 articles from Kenyan newspapers, which may introduce certain biases and limitations:
Data Bias: The model's predictions are influenced by the specific articles and sources used during training, which may reflect the perspectives, biases, and linguistic styles of those publications. This can result in an overrepresentation of certain viewpoints or underrepresentation of others, especially those outside the mainstream media.
Cultural and Regional Bias: Since the training data is centered around Kenyan newspapers, the model may perform better on content related to East African contexts and may not generalize well to other regions or cultural settings.
Topic Limitations: The model is designed to detect specific topics such as global affairs, development cooperation, and social controversies. It may not perform well on texts that fall outside these predefined categories.
Risks of Misclassification: As with any classification model, there is a risk of misclassification, especially with nuanced or ambiguous content. Users should verify model outputs where high accuracy is critical.
Ethical Considerations: Users should be mindful of how the model’s outputs are used, particularly in sensitive contexts such as media analysis or public discourse monitoring, to avoid reinforcing biases or misinformation.
To get started with the model, use the following code snippet:
from transformers import pipeline, AutoModelForSequenceClassification, AutoTokenizer
import torch
# Define model path and device
model_name = "swp-berlin/deberta-base-news-topics-kenia-china"
device = "cuda:0" if torch.cuda.is_available() else "cpu" # Use GPU if available, otherwise CPU
# Load the model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True, model_max_length=512)
# Initialize the pipeline for text classification
pipe_classifier = pipeline(
"text-classification",
model=model,
tokenizer=tokenizer,
framework="pt",
device=device,
batch_size=2
)
# Example usage
result = pipe_classifier("Example text to classify")
print(result)
The model was trained on a custom dataset comprising approximately 700 articles from Kenyan newspapers. The dataset includes a variety of topics relevant to Kenyan and international contexts, including health, politics, development, and cultural affairs. Preprocessing involved filtering irrelevant articles and balancing the dataset across the target topics.
The model was fine-tuned on a pre-trained DeBERTa-base model using the following training configuration:
DeBERTa tokenizer, with special attention given to splitting sentences and removing noise such as URLs and non-text elements.6e-582040.06 to gradually ramp up the learning rate at the start of training0.01 to regularize the model and prevent overfittingf1_macro score retained.Training was conducted on a GPU environment to optimize performance and speed. The training script utilized Hugging Face's Trainer class for efficient model management and evaluation.