Instructions to use musaabkhan/trocr-ur-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use musaabkhan/trocr-ur-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="musaabkhan/trocr-ur-v2")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("musaabkhan/trocr-ur-v2") model = AutoModelForImageTextToText.from_pretrained("musaabkhan/trocr-ur-v2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use musaabkhan/trocr-ur-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "musaabkhan/trocr-ur-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "musaabkhan/trocr-ur-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/musaabkhan/trocr-ur-v2
- SGLang
How to use musaabkhan/trocr-ur-v2 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 "musaabkhan/trocr-ur-v2" \ --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": "musaabkhan/trocr-ur-v2", "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 "musaabkhan/trocr-ur-v2" \ --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": "musaabkhan/trocr-ur-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use musaabkhan/trocr-ur-v2 with Docker Model Runner:
docker model run hf.co/musaabkhan/trocr-ur-v2
TrOCR for Urdu
This model is a fine-tuned version of mohammadalihumayun/trocr-ur-v2r on an unknown dataset. It achieves the following results on the evaluation set:
- Loss: 1.1851
- Cer: 0.5466
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 5e-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: 2
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss | Cer |
|---|---|---|---|---|
| 1.4219 | 0.1518 | 1000 | 2.5109 | 0.6301 |
| 1.2491 | 0.3036 | 2000 | 2.3298 | 0.5844 |
| 1.636 | 0.4554 | 3000 | 2.1089 | 0.5860 |
| 1.5884 | 0.6072 | 4000 | 1.9481 | 0.6081 |
| 1.4926 | 0.7590 | 5000 | 1.8332 | 0.5751 |
| 1.4351 | 0.9107 | 6000 | 1.6727 | 0.5776 |
| 1.2219 | 1.0625 | 7000 | 1.5796 | 0.5832 |
| 0.9786 | 1.2143 | 8000 | 1.4937 | 0.5739 |
| 0.9635 | 1.3661 | 9000 | 1.4292 | 0.5414 |
| 0.909 | 1.5179 | 10000 | 1.3259 | 0.5747 |
| 0.8943 | 1.6697 | 11000 | 1.2704 | 0.5794 |
| 0.8486 | 1.8215 | 12000 | 1.2211 | 0.5445 |
| 0.8385 | 1.9733 | 13000 | 1.1851 | 0.5466 |
Framework versions
- Transformers 4.51.3
- Pytorch 2.5.1+cu124
- Datasets 3.5.0
- Tokenizers 0.21.0
- Downloads last month
- 18
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support