Instructions to use nbroad/donut-base-ascii with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nbroad/donut-base-ascii with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nbroad/donut-base-ascii")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("nbroad/donut-base-ascii") model = AutoModelForImageTextToText.from_pretrained("nbroad/donut-base-ascii") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use nbroad/donut-base-ascii with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nbroad/donut-base-ascii" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nbroad/donut-base-ascii", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nbroad/donut-base-ascii
- SGLang
How to use nbroad/donut-base-ascii 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 "nbroad/donut-base-ascii" \ --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": "nbroad/donut-base-ascii", "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 "nbroad/donut-base-ascii" \ --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": "nbroad/donut-base-ascii", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nbroad/donut-base-ascii with Docker Model Runner:
docker model run hf.co/nbroad/donut-base-ascii
donut-base-ascii
This is "naver-clova-ix/donut-base" but with all non-ascii tokens removed. This means the model is good for basic English use cases where the text is primarily a-zA-Z0-9 and basic punctuation.
The original model, "naver-clova-ix/donut-base", did not have a token for "1", so that has also been added. The notebook remove-donut-tokens.ipynb details the whole process.
This has not been trained any more than the original model.
I made a whole video about it: https://youtu.be/Uzr553x1gdM
I did a quick speed test for generation against the default model and using bad_words_ids. The bad_words_ids was only 12k tokens instead of the 30k that were removed and it was still noticeably slower.
Speed script here
Launched with this
| approach | time to generate 10 tokens |
|---|---|
| "naver-clova-ix/donut-base" | 205ms |
"naver-clova-ix/donut-base" + 12k bad_words_ids |
280ms |
| "donut-base-ascii" | 195ms |
- Downloads last month
- 12