imdb-sentiment-model
This model is a fine-tuned version of distilbert-base-uncased on the imdb dataset. It achieves the following results on the evaluation set:
- Loss: 0.3340
- Accuracy: 0.896
Model description
This model takes the distilbert-base-uncased model and performs fine-tuning on it using the imdb dataset.
Intended uses & limitations
Mostly to be used to perform sentiment analysis on movie reviews.
How to use
Here is an example of using the model to predict movie review sentiment in PyTorch:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
checkpoint = "thundarain018/imdb-sentiment-model"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
input_text = "I didn't enjoy this movie at all!"
encoded_input = tokenizer(input_text, return_tensors='pt')
output = model(**encoded_input)
predictions = torch.nn.functional.softmax(output.logits, dim=-1)
print(f"Positive score: {predictions[0][1].item():.2%}")
print(f"Negative score: {predictions[0][0].item():.2%}")
Positive score: 2.48%
Negative score: 97.52%
Alternatively you can use this model with a pipeline directly as well.
Training data
The fine tuning dataset used was the Stanford imdb dataset
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 3
Training results
Training Loss | Epoch | Step | Validation Loss | Accuracy |
---|---|---|---|---|
No log | 1.0 | 313 | 0.3541 | 0.858 |
0.2952 | 2.0 | 626 | 0.3340 | 0.896 |
0.2952 | 3.0 | 939 | 0.3544 | 0.905 |
Framework versions
- Transformers 4.50.2
- Pytorch 2.6.0+cu124
- Datasets 3.5.0
- Tokenizers 0.21.1
- Downloads last month
- 19
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for thundarain018/imdb-sentiment-model
Base model
distilbert/distilbert-base-uncased