Fill-Mask
Transformers
Safetensors
PyTorch
English
distilbert
masked-language-modeling
mathematics
hendrycks-math
whole-word-masking
Instructions to use EricAI03/distilbert-base-math-finetuned-accelerate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EricAI03/distilbert-base-math-finetuned-accelerate with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="EricAI03/distilbert-base-math-finetuned-accelerate")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("EricAI03/distilbert-base-math-finetuned-accelerate") model = AutoModelForMaskedLM.from_pretrained("EricAI03/distilbert-base-math-finetuned-accelerate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from EricAI03/distilbert-base-math-finetuned-accelerate: direct link, hf CLI and curl.
- Browser
- Download file 2.32 kB
-
https://huggingface.co/EricAI03/distilbert-base-math-finetuned-accelerate/resolve/main/README.md
- Command line
-
hf download hf://EricAI03/distilbert-base-math-finetuned-accelerate/README.md
-
curl -L -o README.md https://huggingface.co/EricAI03/distilbert-base-math-finetuned-accelerate/resolve/main/README.md
2.32 kB
metadata
language:
- en
license: mit
tags:
- pytorch
- transformers
- distilbert
- masked-language-modeling
- mathematics
- hendrycks-math
- whole-word-masking
model_name: DistilBERT Base Math Fine-Tuned (Accelerate)
base_model: distilbert-base-uncased
datasets:
- nlile/hendrycks-MATH-benchmark
DistilBERT Base Math Fine-Tuned (Masked Language Modeling)
This model is a fine-tuned version of distilbert-base-uncased trained on the nlile/hendrycks-MATH-benchmark dataset. It has been adapted using whole-word masking and fixed-length chunking to understand mathematical syntax, equations, numbers, and LaTeX expressions.
Model Details
- Architecture: DistilBERT (
DistilBertForMaskedLM) - Parameters: ~66.9 Million
- Task: Masked Language Modeling (MLM) / Mathematical Syntax Pre-training
- Training Environment: Kaggle (NVIDIA T4 GPU) using Hugging Face
acceleratewith mixed-precision (fp16) - Epochs Trained: 3+
Training Procedure
Hyperparameters
- Learning Rate: $3 imes 10^{-5}$
- Batch Size: 16
- Max Sequence Length: 128 tokens
- MLM Probability: 15% with a custom Whole-Word Masking (WWM) collator to prevent partial token masking of math terms and LaTeX sequences.
Evaluation Results
Evaluated on the official Hendrycks MATH test split:
- Test Loss: [Insert your final test loss here, e.g., 1.035]
- Test Perplexity: [Insert your final perplexity here, e.g., 2.81]
Usage Example
You can load and use this model directly with the Hugging Face pipeline for masked language modeling:
from transformers import AutoModelForMaskedLM, AutoTokenizer, pipeline
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(
"EricAI03/distilbert-base-math-finetuned-accelerate"
)
model = AutoModelForMaskedLM.from_pretrained(
"EricAI03/distilbert-base-math-finetuned-accelerate"
)
# Create fill-mask pipeline
math_pipe = pipeline("fill-mask", model=model, tokenizer=tokenizer)
# Test prompt
prompt = "If a triangle has sides 3, 4, and [MASK], it is a right-angled triangle."
results = math_pipe(prompt, top_k=3)
for res in results:
print(
f"Token: '{res['token_str']}' (Score: {res['score']:.4f}) | Sentence:"
f" {res['sequence']}"
)