π§ FillMask-BERT-FineTuned
A BERT-based masked language model fine-tuned on the wikitext dataset. This model predicts missing words in a sentence using the [MASK]
token and provides the most probable replacements with confidence scores. Itβs useful for tasks like autocomplete, suggestion engines, or masked word prediction.
β¨ Model Highlights
π Based on bert-base-uncased
(by Google)
π Fine-tuned on the wikitext
dataset
π§ Predicts masked tokens using contextual understanding
πΎ Available in both full and quantized versions
π Compatible with pipeline('fill-mask')
from π€ Transformers
π§ Intended Uses
- Autocompletion systems
- Language understanding tasks
- Educational language games or language modeling research
π« Limitations
- Trained only on English
- May not handle proper nouns or rare entities well
- Long sentences (>128 tokens) are truncated during training
- Not suitable for generation tasks (e.g., summarization, translation)
ποΈββοΈ Training Details
- Base Model:
bert-base-uncased
- Dataset:
wikitext-2-raw-v1
- Framework: PyTorch with π€ Transformers
- Epochs: 5
- Batch Size: 16
- Max Length: 128 tokens
- Loss: CrossEntropyLoss (Masked LM)
- Optimizer: AdamW
- Device: Trained on NVIDIA CUDA-enabled GPU
π Evaluation Metrics (manual evaluation)
Metric | Value |
---|---|
Mask Accuracy (Top-1) | ~34% on simple examples |
Mask Accuracy (Top-5) | ~90% on simple examples |
This is illustrative. Replace with actual if you log accuracy/f1 during testing.
π€ Tokenizer
The tokenizer is based on the bert-base-uncased
vocabulary and saved with the model. Includes:
tokenizer_config.json
vocab.txt
special_tokens_map.json
π Usage
from transformers import pipeline
model = "your-username/fill-mask-bert-finetuned" # replace with actual repo ID
fill_mask = pipeline("fill-mask", model=model)
# Predict the masked word
output = fill_mask("The [MASK] is shining in the sky.")
for o in output:
print(f"{o['sequence']} | Score: {o['score']:.2f}")
βοΈ Quantization
Post-training static quantization was applied using PyTorch to reduce model size and boost inference performance. Quantized version works identically with fill-mask pipeline.
π Repository Structure
/fill-mask-bert-finetuned/
βββ config.json # Model configuration
βββ model.safetensors # Fine-tuned model weights
βββ special_tokens_map.json # Token mapping
βββ tokenizer_config.json # Tokenizer settings
βββ vocab.txt # Tokenizer vocabulary
βββ README.md # This model card
π Contributing Contributions are welcome! If you have suggestions, improvements, or issues, feel free to open an issue or submit a pull request.
- Downloads last month
- 3