Instructions to use nielsr/donut-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nielsr/donut-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nielsr/donut-base")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("nielsr/donut-base") model = AutoModelForMultimodalLM.from_pretrained("nielsr/donut-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nielsr/donut-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nielsr/donut-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nielsr/donut-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nielsr/donut-base
- SGLang
How to use nielsr/donut-base 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 "nielsr/donut-base" \ --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": "nielsr/donut-base", "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 "nielsr/donut-base" \ --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": "nielsr/donut-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nielsr/donut-base with Docker Model Runner:
docker model run hf.co/nielsr/donut-base
Update model
Browse files- config.json +3 -5
- pytorch_model.bin +2 -2
config.json
CHANGED
|
@@ -79,7 +79,7 @@
|
|
| 79 |
"top_p": 1.0,
|
| 80 |
"torch_dtype": null,
|
| 81 |
"torchscript": false,
|
| 82 |
-
"transformers_version": "4.
|
| 83 |
"typical_p": 1.0,
|
| 84 |
"use_bfloat16": false,
|
| 85 |
"use_cache": true,
|
|
@@ -88,7 +88,6 @@
|
|
| 88 |
"encoder": {
|
| 89 |
"_name_or_path": "",
|
| 90 |
"add_cross_attention": false,
|
| 91 |
-
"add_final_layer_norm": false,
|
| 92 |
"architectures": null,
|
| 93 |
"attention_probs_dropout_prob": 0.0,
|
| 94 |
"bad_words_ids": null,
|
|
@@ -108,7 +107,6 @@
|
|
| 108 |
"early_stopping": false,
|
| 109 |
"embed_dim": 128,
|
| 110 |
"encoder_no_repeat_ngram_size": 0,
|
| 111 |
-
"encoder_stride": 32,
|
| 112 |
"eos_token_id": null,
|
| 113 |
"exponential_decay_length_penalty": null,
|
| 114 |
"finetuning_task": null,
|
|
@@ -137,7 +135,7 @@
|
|
| 137 |
"max_length": 20,
|
| 138 |
"min_length": 0,
|
| 139 |
"mlp_ratio": 4.0,
|
| 140 |
-
"model_type": "
|
| 141 |
"no_repeat_ngram_size": 0,
|
| 142 |
"num_beam_groups": 1,
|
| 143 |
"num_beams": 1,
|
|
@@ -175,7 +173,7 @@
|
|
| 175 |
"top_p": 1.0,
|
| 176 |
"torch_dtype": null,
|
| 177 |
"torchscript": false,
|
| 178 |
-
"transformers_version": "4.
|
| 179 |
"typical_p": 1.0,
|
| 180 |
"use_absolute_embeddings": false,
|
| 181 |
"use_bfloat16": false,
|
|
|
|
| 79 |
"top_p": 1.0,
|
| 80 |
"torch_dtype": null,
|
| 81 |
"torchscript": false,
|
| 82 |
+
"transformers_version": "4.22.0.dev0",
|
| 83 |
"typical_p": 1.0,
|
| 84 |
"use_bfloat16": false,
|
| 85 |
"use_cache": true,
|
|
|
|
| 88 |
"encoder": {
|
| 89 |
"_name_or_path": "",
|
| 90 |
"add_cross_attention": false,
|
|
|
|
| 91 |
"architectures": null,
|
| 92 |
"attention_probs_dropout_prob": 0.0,
|
| 93 |
"bad_words_ids": null,
|
|
|
|
| 107 |
"early_stopping": false,
|
| 108 |
"embed_dim": 128,
|
| 109 |
"encoder_no_repeat_ngram_size": 0,
|
|
|
|
| 110 |
"eos_token_id": null,
|
| 111 |
"exponential_decay_length_penalty": null,
|
| 112 |
"finetuning_task": null,
|
|
|
|
| 135 |
"max_length": 20,
|
| 136 |
"min_length": 0,
|
| 137 |
"mlp_ratio": 4.0,
|
| 138 |
+
"model_type": "donut",
|
| 139 |
"no_repeat_ngram_size": 0,
|
| 140 |
"num_beam_groups": 1,
|
| 141 |
"num_beams": 1,
|
|
|
|
| 173 |
"top_p": 1.0,
|
| 174 |
"torch_dtype": null,
|
| 175 |
"torchscript": false,
|
| 176 |
+
"transformers_version": "4.22.0.dev0",
|
| 177 |
"typical_p": 1.0,
|
| 178 |
"use_absolute_embeddings": false,
|
| 179 |
"use_bfloat16": false,
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:749f6e487d0cdbd7362d8b6a909174b93506d8631da0d15a6108bb6512ad5f48
|
| 3 |
+
size 809168699
|