đ Model Card for BERT-Amazon-Sentiment
A fine - tuned BERT - base - uncased model for sentiment analysis on Amazon reviews, classifying reviews as positive or negative.
đ Quick Start
Use the code below to get started with the model.
from transformers import pipeline
sentiment_pipeline = pipeline("text-classification", model="Asteroid-Destroyer/bert-amazon-sentiment")
review = "The product quality is amazing, and I love using it!"
result = sentiment_pipeline(review)
print(result)
⨠Features
- This model can directly classify English Amazon product reviews into positive or negative sentiment without additional fine - tuning.
- It is based on a fine - tuned BERT - base - uncased architecture, leveraging the power of the Transformer for text classification.
đĻ Installation
Since the model uses the transformers
library, you can install it via the following command:
pip install transformers
đ Documentation
Model Details
Model Description
This is the model card for BERT - Amazon - Sentiment, a fine - tuned BERT - base - uncased model trained for binary sentiment classification on Amazon reviews. The model was fine - tuned using a subset of the Amazon Polarity dataset (10K training samples, 5K test samples) and can classify reviews as either positive or negative.
- Developed by: Usman Ahmad
- Funded by: Self - funded
- Shared by: Usman Ahmad
- Model type: Transformer - based BERT model for text classification
- Language(s) (NLP): English
- License: MIT License
- Fine - tuned from model: bert - base - uncased
Model Sources
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
This model can be used directly for sentiment analysis on English text, particularly for Amazon product reviews. It classifies text into positive or negative sentiment without any additional fine - tuning.
Out - of - Scope Use
This model is not suitable for:
- Non - English text â It was trained only on English Amazon reviews.
- Neutral sentiment detection â The model only classifies reviews as positive or negative.
- Sarcasm and complex sentiment â May struggle with sarcastic or mixed - tone reviews.
- Legal or medical advice â Not designed for professional or sensitive domains.
- Hate speech detection â Not fine - tuned for offensive or harmful content moderation.
Misuse of this model for tasks outside its intended scope may lead to inaccurate results.
Training Details
Training Data
The model was fine - tuned on a 10K subset of the Amazon Polarity dataset for training and a 5K subset for testing. The dataset consists of Amazon product reviews labeled as positive (1) or negative (0).
- Dataset Source: Amazon Polarity https://huggingface.co/datasets/fancyzhx/amazon_polarity on Hugging Face
- Preprocessing:
- Tokenized using BERT tokenizer (bert - base - uncased).
- Max sequence length: 512 (truncated if longer).
- Padding: Applied to match model input size.
Training Procedure
The model was fine - tuned using bert - base - uncased on a 10K subset of the Amazon Polarity dataset with the following setup:
- Optimizer: AdamW
- Learning Rate Scheduler: Linear decay with warm - up
- Loss Function: CrossEntropyLoss
- Batch Size: 16
- Max Sequence Length: 512
- Epochs: 3
- Hardware Used: Google Colab with T4 GPU
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
đ§ Technical Details
Model Training Setup
The model is fine - tuned from bert - base - uncased
on the Amazon Polarity dataset. The training process uses the AdamW optimizer, a linear decay learning rate scheduler with warm - up, and the CrossEntropyLoss function. With a batch size of 16, a max sequence length of 512, and 3 epochs of training on a Google Colab with T4 GPU, it aims to achieve accurate sentiment classification for Amazon reviews.
Data Preprocessing
The data preprocessing involves tokenizing the text using the BERT tokenizer (bert - base - uncased
), truncating sequences longer than 512 tokens, and applying padding to match the model's input size.
đ License
This model is released under the MIT License.