Edit model card

Model Card for Model ID

This model is a fine-tuned version of the Google Gemma 7B large language model, specifically optimized for Hausa language sentiment analysis. It classifies text into positive, neutral, and negative sentiments and can be used for tasks like social media monitoring, customer feedback analysis, and any sentiment-related task involving Hausa text.

Model Details

Model Description

The fine-tuned Gemma 7B model is designed for sentiment analysis in the Hausa language, which is widely spoken across West Africa. It was fine-tuned using Hausa text data with labeled sentiments to accurately classify text as positive, neutral, or negative. The fine-tuning process employed Low-Rank Adaptation (LoRA) to efficiently update the model’s parameters without requiring large amounts of computational resources.

This model is ideal for analyzing Hausa-language social media posts, reviews, and other text data to gain insights into public sentiment. It offers significant improvements over the base model, particularly for sentiment classification tasks in a low-resource language like Hausa. The model is part of an ongoing effort to create more robust natural language processing tools for underrepresented languages.

  • Developed by: Mubarak Daha Isa
  • Funded by [optional]: None
  • Shared by [optional]: None
  • Model type: Large Language Model (LLM) fine-tuned for sentiment analysis
  • Language(s) (NLP): Hausa
  • License: MIT
  • Finetuned from model [optional]: Google Gemma 7B

Model Sources [optional]

Uses

Direct Use

This model can be used for sentiment analysis of text written in the Hausa language, specifically categorizing text into positive, neutral, or negative sentiments. It is ideal for applications in social media analysis, customer feedback, or any Hausa text-based sentiment classification tasks.

Downstream Use [optional]

Adaptation to other NLP tasks such as emotion detection, text classification, and content moderation in Hausa language contexts.

Out-of-Scope Use

This model is not suitable for:

Sentiment analysis in languages other than Hausa without further fine-tuning. Use in environments where bias in sentiment classification may have critical implications (e.g., legal or medical contexts).

Bias, Risks, and Limitations

Bias: The model may reflect inherent biases in the training data, especially in its treatment of neutral and negative sentiment. Risks: Misclassification of sentiment in sensitive use cases could lead to misinterpretations of Hausa language texts. Limitations: This model was trained on a limited dataset. Performance might degrade when applied to Hausa texts outside of its training domain.

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model. The model’s outputs should be carefully reviewed in sensitive contexts.

How to Get Started with the Model

Use the code below to get started with the model.

from transformers import AutoModelForSequenceClassification, AutoTokenizer

Load the model and tokenizer

  • model = AutoModelForSequenceClassification.from_pretrained("bagwai/fine-tuned-gemma-7b-hausa")
  • tokenizer = AutoTokenizer.from_pretrained("bagwai/fine-tuned-gemma-7b-hausa")

Example usage

  • inputs = tokenizer("Ina son wannan littafin", return_tensors="pt")
  • outputs = model(**inputs)

Training Details

Training Data

The model was fine-tuned on a Hausa sentiment analysis dataset consisting of 300 samples from NaijaSenti > Hausa Dataset.

Training Procedure

Preprocessing [optional]

Preprocessing: Hausa stopwords were removed using a custom stopword list (hau_stop.csv).

Training Hyperparameters

  • Training regime: [More Information Needed]
  • Epochs: 5
  • Learning Rate: 2e-4
  • Batch Size: 8
  • Optimizer: AdamW
  • LoRA Rank: 64

Evaluation

Testing Data, Factors & Metrics

Testing Data: Evaluation was performed on a hold-out test set comprising 300 Hausa text samples. Metrics: Accuracy, Precision, Recall, F1-Score.

Results

Before Fine-Tuning: Accuracy = 37.7%, F1-Score = 31.0% After Fine-Tuning: Accuracy = 66.0%, F1-Score = 66.0%

Summary

image/png

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: GPU P100
  • Hours used: 5hrs
  • Cloud Provider: Kaggle
  • Compute Region: India
  • Carbon Emitted: Zero

Technical Specifications [optional]

Model Architecture and Objective

  • Model Type: Gemma 7B (LLM)
  • Objective: Fine-tuned for sentiment analysis in the Hausa language.

Compute Infrastructure

  • Hardware: Kaggle NVIDIA P100 GPUs
  • Software: PyTorch, Hugging Face Transformers, LoRA (Low-Rank Adaptation)

Citation [optional]

BibTeX:

@misc{mubarak2024fine, author = {Mubarak Daha Isa}, title = {Fine-tuned Gemma 7B for Hausa Sentiment Analysis}, year = {2024}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/your-username/fine-tuned-gemma-7b-hausa}}, }

APA:

Mubarak Daha Isa (2024). Fine-tuned Gemma 7B for Hausa Sentiment Analysis. Hugging Face. https://huggingface.co/bagwai/fine-tuned-gemma-7b-hausa

Model Card Authors [optional]

Mubarak Daha Isa

Model Card Contact

Downloads last month
0
Safetensors
Model size
4.78B params
Tensor type
F32
·
FP16
·
U8
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train bagwai/fine-tuned-gemma-7b-Hausa