--- library_name: transformers license: apache-2.0 base_model: answerdotai/ModernBERT-base tags: - generated_from_trainer model-index: - name: ModernBERT-base-mask-finetuned-shakespeare results: [] datasets: - 2nji/Shakespeare_Corpus language: - en --- # ModernBERT-base-mask-finetuned-shakespeare This model is a fine-tuned version of [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) on an unknown dataset. It achieves the following results on the evaluation set: - Loss: 2.2340 ## How to use You can use this model directly with a pipeline for text generation. This example generates a different sequence each time it's run: ```python import torch from transformers import pipeline from pprint import pprint pipe = pipeline( "fill-mask", model="2nji/ModernBERT-base-mask-finetuned-shakespeare", torch_dtype=torch.bfloat16, ) input_text = "Thou [MASK] on [MASK]." results = pipe(input_text) pprint(results) ``` ## Training and evaluation data This model was finetuned using the the [Shakespare_corpus](https://huggingface.co/datasets/2nji/Shakespeare_Corpus) Dataset ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 8 - eval_batch_size: 8 - 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.0 ### Training results | Training Loss | Epoch | Step | Validation Loss | |:-------------:|:-----:|:----:|:---------------:| | No log | 1.0 | 197 | 2.3128 | | No log | 2.0 | 394 | 2.2150 | | 2.3002 | 3.0 | 591 | 2.2395 | ### Framework versions - Transformers 4.48.3 - Pytorch 2.5.1+cu124 - Datasets 3.3.2 - Tokenizers 0.21.0