Instructions to use antalvdb/bart-base-spelling-nl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use antalvdb/bart-base-spelling-nl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="antalvdb/bart-base-spelling-nl")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("antalvdb/bart-base-spelling-nl") model = AutoModelForSeq2SeqLM.from_pretrained("antalvdb/bart-base-spelling-nl") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use antalvdb/bart-base-spelling-nl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "antalvdb/bart-base-spelling-nl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "antalvdb/bart-base-spelling-nl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/antalvdb/bart-base-spelling-nl
- SGLang
How to use antalvdb/bart-base-spelling-nl with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "antalvdb/bart-base-spelling-nl" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "antalvdb/bart-base-spelling-nl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "antalvdb/bart-base-spelling-nl" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "antalvdb/bart-base-spelling-nl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use antalvdb/bart-base-spelling-nl with Docker Model Runner:
docker model run hf.co/antalvdb/bart-base-spelling-nl
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
bart-base-spelling-nl
This model is a Dutch fine-tuned version of facebook/bart-base.
It achieves the following results on an external evaluation set of human-corrected spelling errors of Dutch snippets of internet text (errors and corrections, run spell.py)
- CER - 0.024
- WER - 0.088
- BLEU - 0.840
- METEOR - 0.932
Note that it is very hard for any spelling corrector to clean more actual spelling errors than introducing new errors. In other words, most spelling correctors cannot be run automatically and must be used interactively.
These are the upper-bound scores when correcting nothing. In other words, this is the actual distance between the errors and their corrections in the evaluation set:
- CER - 0.010
- WER - 0.053
- BLEU - 0.900
- METEOR - 0.954
We are not there yet, clearly.
Model description
This is a fine-tuned version of facebook/bart-base trained on spelling correction. It leans on the excellent work by Oliver Guhr (github, huggingface). Training was performed on an AWS EC2 instance (g5.xlarge) on a single GPU, and took about two days.
Intended uses & limitations
The intended use for this model is to be a component of the Valkuil.net context-sensitive spelling checker.
Training and evaluation data
The model was trained on a Dutch dataset composed of 12,351,203 lines of text, containing a total of 123,131,153 words, from three public Dutch sources, downloaded from the Opus corpus:
- nl-europarlv7.txt (2,387,000 lines)
- nl-opensubtitles2016.9m.txt (9,000,000 lines)
- nl-wikipedia.txt (964,203 lines)
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0003
- train_batch_size: 2
- eval_batch_size: 4
- seed: 42
- gradient_accumulation_steps: 16
- total_train_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 2.0
Framework versions
- Transformers 4.27.3
- Pytorch 2.0.0+cu117
- Datasets 2.10.1
- Tokenizers 0.13.2
- Downloads last month
- 886