Downloads · 30 days
40
1% of all-time downloads
lannelin/bert-imdb-1hidden
bert-imdb-1hidden is a text classification model from lannelin. Use it when you need a label for a piece of text. It is set up for transformers.
A bert-base-uncased model was restricted to 1 hidden layer and fine-tuned for sequence classification on the imdb dataset loaded using the datasets library.
Downloads · 30 days
40
1% of all-time downloads
All-time downloads
5.2K
Public
Parameters
31.5M
378 MB on disk
Likes
0
Public
Click a slice to open those files.
.bin126 MB · 33%
How the weights are stored.
F3231.5M · 100%
From the Hugging Face model README
A bert-base-uncased model was restricted to 1 hidden layer and
fine-tuned for sequence classification on the
imdb dataset loaded using the datasets library.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
pretrained = "lannelin/bert-imdb-1hidden"
tokenizer = AutoTokenizer.from_pretrained(pretrained)
model = AutoModelForSequenceClassification.from_pretrained(pretrained)
LABELS = ["negative", "positive"]
def get_sentiment(text: str):
inputs = tokenizer.encode_plus(text, return_tensors='pt')
output = model(**inputs)[0].squeeze()
return LABELS[(output.argmax())]
print(get_sentiment("What a terrible film!"))
No special consideration given to limitations and bias.
Any bias held by the imdb dataset may be reflected in the model's output.
Initialised with bert-base-uncased
Fine tuned on imdb
The model was fine-tuned for 1 epoch with a batch size of 64, a learning rate of 5e-5, and a maximum sequence length of 512.
Accuracy on imdb test set: 0.87132