Image-Text-to-Text
Transformers
Safetensors
vision-encoder-decoder
document-understanding
ocr
prescription
medical-ocr
donut
Instructions to use ajmaclin/prescription-donut-ocr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ajmaclin/prescription-donut-ocr with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ajmaclin/prescription-donut-ocr")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("ajmaclin/prescription-donut-ocr") model = AutoModelForMultimodalLM.from_pretrained("ajmaclin/prescription-donut-ocr", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ajmaclin/prescription-donut-ocr with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ajmaclin/prescription-donut-ocr" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ajmaclin/prescription-donut-ocr", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ajmaclin/prescription-donut-ocr
- SGLang
How to use ajmaclin/prescription-donut-ocr 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 "ajmaclin/prescription-donut-ocr" \ --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": "ajmaclin/prescription-donut-ocr", "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 "ajmaclin/prescription-donut-ocr" \ --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": "ajmaclin/prescription-donut-ocr", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ajmaclin/prescription-donut-ocr with Docker Model Runner:
docker model run hf.co/ajmaclin/prescription-donut-ocr
| { | |
| "best_metric": 6.029897689819336, | |
| "best_model_checkpoint": "/content/donut_finetuned/checkpoint-10", | |
| "epoch": 2.0, | |
| "eval_steps": 500, | |
| "global_step": 10, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 1.0, | |
| "eval_loss": 9.464871406555176, | |
| "eval_runtime": 4.0077, | |
| "eval_samples_per_second": 3.743, | |
| "eval_steps_per_second": 1.996, | |
| "step": 5 | |
| }, | |
| { | |
| "epoch": 2.0, | |
| "grad_norm": 46.585044860839844, | |
| "learning_rate": 2.4e-05, | |
| "loss": 10.4972, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 2.0, | |
| "eval_loss": 6.029897689819336, | |
| "eval_runtime": 3.4276, | |
| "eval_samples_per_second": 4.376, | |
| "eval_steps_per_second": 2.334, | |
| "step": 10 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 100, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 20, | |
| "save_steps": 500, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": false | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 5.00305864163328e+17, | |
| "train_batch_size": 2, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |