Downloads · 30 days
7
28% of all-time downloads
Ak128umar/distilbert-base-uncased-finetuned-imdb-accelerate
distilbert-base-uncased-finetuned-imdb-accelerate is a machine learning model from Ak128umar. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a BERT model fine-tuned for Masked Language Modeling (MLM) using the 🤗 Accelerate library for efficient training and evaluation.
Downloads · 30 days
7
28% of all-time downloads
All-time downloads
25
Public
Parameters
67M
804 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
This repository contains a BERT model fine-tuned for Masked Language Modeling (MLM) using the 🤗 Accelerate library for efficient training and evaluation.
bert-base-uncased)AdamW from PyTorch.| Epoch | Perplexity |
|---|---|
| 0 | 12.03 |
| 1 | 11.55 |
| 2 | 11.32 |
Perplexity was calculated on the validation set after each epoch.
You can load the model for masked language modeling using transformers:
from transformers import AutoTokenizer, AutoModelForMaskedLM
model_name = "your-username/bert-finetuned-mlm-accelerate"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForMaskedLM.from_pretrained(model_name)
text = "The capital of France is [MASK]."
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
mask_token_index = (inputs["input_ids"] == tokenizer.mask_token_id).nonzero(as_tuple=True)[1]
predicted_token_id = outputs.logits[0, mask_token_index, :].argmax(axis=-1)
print(tokenizer.decode(predicted_token_id))