This model is a sentiment classification model for hotel reviews, trained to predict whether a review is positive or negative. The model was fine-tuned using the distilbert-base-uncased model architecture, based on the DistilBERT model from Hugging Face, and trained on the 17k Hotel Reviews Dataset.
Model Details
Model Type: DistilBERT-based model for sequence classification
Model Architecture: distilbert-base-uncased
Number of Parameters: Approximately 66M parameters
Training Dataset: The model was trained on the 17k-hotel-reviews-dataset, which contains 17,000 hotel reviews with labels for sentiment (positive/negative).
Fine-Tuning Task: Sentiment analysis for hotel reviews (positive or negative sentiment)
Data Description: The dataset consists of 17,000 hotel reviews, each labeled with a sentiment (positive/negative).
Preprocessing: The dataset was preprocessed by cleaning the reviews to remove unwanted characters and URLs.
Training Details
Training Framework: Hugging Face Transformers and PyTorch
Learning Rate: 2e-5
Epochs: 3
Batch Size: 16
Optimizer: AdamW
Training Time: Approximately 2 hours on a GPU
Usage
To use the model for inference, you can use the following code:
python
1from transformers import AutoModelForSequenceClassification, AutoTokenizer
2import torch
34# Load the fine-tuned model and tokenizer5model = AutoModelForSequenceClassification.from_pretrained("kmack/HotelReviewClassifier")6tokenizer = AutoTokenizer.from_pretrained("kmack/HotelReviewClassifier")78# Example review for prediction9review ="This is the best hotel I've ever stayed in!"1011# Tokenize the input text12inputs = tokenizer(review, return_tensors="pt", padding=True, truncation=True)1314# Get predictions15with torch.no_grad():16 outputs = model(**inputs)1718# Get the predicted label (0 for negative, 1 for positive)19prediction = torch.argmax(outputs.logits, dim=-1)20print(f"Predicted sentiment: {'Positive'if prediction ==1else'Negative'}")
Citation
If you use this model in your research, please cite the following:
@misc{hotel_review_classifier,
1 author = {Kmack},
2 title = {Hotel Review Classifier},
3 year = {2024},
4 url = {https://huggingface.co/kmack/HotelReviewClassifier}
5}