Downloads · 30 days
18
14% of all-time downloads
Testys/cnn_sent_yor
cnn_sent_yor is a machine learning model from Testys. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a PyTorch model for sentiment analysis of Yoruba text. The model utilizes a Convolutional Neural Network (CNN) architecture on top of a pre-trained Afriberta model, specifically "Davlan/naija-…
Downloads · 30 days
18
14% of all-time downloads
All-time downloads
128
Public
Repo size
509 MB
Likes
0
Public
Click a slice to open those files.
.bin507 MB · 99%
From the Hugging Face model README
This repository contains a PyTorch model for sentiment analysis of Yoruba text. The model utilizes a Convolutional Neural Network (CNN) architecture on top of a pre-trained Afriberta model, specifically "Davlan/naija-twitter-sentiment-afriberta-large".
The model consists of the following components:
This model is designed for sentiment analysis of Yoruba text and can be applied to various use cases, such as:
Limitations:
The model was trained on a dataset of Yoruba tweets annotated with sentiment labels. The dataset was split into training, validation, and test sets.
The model was trained using the following steps:
The model achieved the following performance on the test set:
Install Dependencies: Ensure you have PyTorch and Transformers installed:
pip install torch transformers
Load the Model: You can load the model using the Hugging Face transformers library:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_name = "Testys/cnn_sent_yor"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
Make Predictions: Use the tokenizer to prepare your input text and the model to get predictions:
def predict(text):
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
outputs = model(**inputs)
return torch.softmax(outputs.logits, dim=1).items()
sample_text = "Your Yoruba text here"
prediction = predict(sample_text)
print("Sentiment:", prediction)
If you use this model in your research, please cite it using the following format:
@misc{your_model_name,
author = {Your Name},
title = {Yoruba Sentiment Analysis with CNN and Afriberta},
year = {2024},
publisher = {Hugging Face's Model Hub},
journal = {Hugging Face's Model Hub},
howpublished = {\\url{https://huggingface.co/your_model_name}}
}
This model is open-sourced under the MIT license. The license allows commercial use, modification, distribution, and private use.
For any queries regarding the model, feel free to reach out via GitHub or direct email: