kmack commited on
Commit
9a7af52
·
verified ·
1 Parent(s): c012251

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -0
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - Aditya1010/17k-hotel-reviews-dataset
5
+ metrics:
6
+ - accuracy
7
+ base_model:
8
+ - distilbert/distilbert-base-uncased
9
+ pipeline_tag: text-classification
10
+ library_name: transformers
11
+ tags:
12
+ - Sentiment Analysis
13
+ - DistilBERT
14
+ - Text Classification
15
+ - Hotel Reviews
16
+ ---
17
+ # Hotel Review Classifier
18
+
19
+ 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](https://huggingface.co/distilbert/distilbert-base-uncased) from Hugging Face, and trained on the [17k Hotel Reviews Dataset](https://huggingface.co/datasets/Aditya1010/17k-hotel-reviews-dataset).
20
+
21
+ ## Model Details
22
+ - **Model Type**: DistilBERT-based model for sequence classification
23
+ - **Model Architecture**: `distilbert-base-uncased`
24
+ - **Number of Parameters**: Approximately 66M parameters
25
+ - **Training Dataset**: The model was trained on the `17k-hotel-reviews-dataset`, which contains 17,000 hotel reviews with labels for sentiment (positive/negative).
26
+ - **Fine-Tuning Task**: Sentiment analysis for hotel reviews (positive or negative sentiment)
27
+
28
+ ## Training Data
29
+ - **Dataset**: [17k Hotel Reviews Dataset](https://huggingface.co/datasets/Aditya1010/17k-hotel-reviews-dataset)
30
+ - **Data Description**: The dataset consists of 17,000 hotel reviews, each labeled with a sentiment (positive/negative).
31
+ - **Preprocessing**: The dataset was preprocessed by cleaning the reviews to remove unwanted characters and URLs.
32
+
33
+ ## Training Details
34
+ - **Training Framework**: Hugging Face Transformers and PyTorch
35
+ - **Learning Rate**: 2e-5
36
+ - **Epochs**: 3
37
+ - **Batch Size**: 16
38
+ - **Optimizer**: AdamW
39
+ - **Training Time**: Approximately 2 hours on a GPU
40
+
41
+ ## Usage
42
+ To use the model for inference, you can use the following code:
43
+
44
+ ```python
45
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
46
+ import torch
47
+
48
+ # Load the fine-tuned model and tokenizer
49
+ model = AutoModelForSequenceClassification.from_pretrained("kmack/HotelReviewClassifier")
50
+ tokenizer = AutoTokenizer.from_pretrained("kmack/HotelReviewClassifier")
51
+
52
+ # Example review for prediction
53
+ review = "This is the best hotel I've ever stayed in!"
54
+
55
+ # Tokenize the input text
56
+ inputs = tokenizer(review, return_tensors="pt", padding=True, truncation=True)
57
+
58
+ # Get predictions
59
+ with torch.no_grad():
60
+ outputs = model(**inputs)
61
+
62
+ # Get the predicted label (0 for negative, 1 for positive)
63
+ prediction = torch.argmax(outputs.logits, dim=-1)
64
+ print(f"Predicted sentiment: {'Positive' if prediction == 1 else 'Negative'}")
65
+ ```
66
+
67
+ ## Citation
68
+
69
+ If you use this model in your research, please cite the following:
70
+
71
+ ```@misc{hotel_review_classifier,
72
+ author = {Kmack},
73
+ title = {Hotel Review Classifier},
74
+ year = {2024},
75
+ url = {https://huggingface.co/kmack/HotelReviewClassifier}
76
+ }
77
+ ```