Instructions to use basaadi/tifinagh-ocr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use basaadi/tifinagh-ocr with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="basaadi/tifinagh-ocr")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("basaadi/tifinagh-ocr") model = AutoModelForImageTextToText.from_pretrained("basaadi/tifinagh-ocr") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use basaadi/tifinagh-ocr with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "basaadi/tifinagh-ocr" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "basaadi/tifinagh-ocr", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/basaadi/tifinagh-ocr
- SGLang
How to use basaadi/tifinagh-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 "basaadi/tifinagh-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": "basaadi/tifinagh-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 "basaadi/tifinagh-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": "basaadi/tifinagh-ocr", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use basaadi/tifinagh-ocr with Docker Model Runner:
docker model run hf.co/basaadi/tifinagh-ocr
| { | |
| "version": "1.0", | |
| "truncation": null, | |
| "padding": null, | |
| "added_tokens": [ | |
| { | |
| "id": 0, | |
| "content": "<pad>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| { | |
| "id": 1, | |
| "content": "<s>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| { | |
| "id": 2, | |
| "content": "</s>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| { | |
| "id": 3, | |
| "content": "<unk>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| } | |
| ], | |
| "normalizer": null, | |
| "pre_tokenizer": { | |
| "type": "Split", | |
| "pattern": { | |
| "Regex": "ⴳⵯ|ⴽⵯ|." | |
| }, | |
| "behavior": "Isolated", | |
| "invert": false | |
| }, | |
| "post_processor": { | |
| "type": "TemplateProcessing", | |
| "single": [ | |
| { | |
| "SpecialToken": { | |
| "id": "<s>", | |
| "type_id": 0 | |
| } | |
| }, | |
| { | |
| "Sequence": { | |
| "id": "A", | |
| "type_id": 0 | |
| } | |
| }, | |
| { | |
| "SpecialToken": { | |
| "id": "</s>", | |
| "type_id": 0 | |
| } | |
| } | |
| ], | |
| "pair": [ | |
| { | |
| "Sequence": { | |
| "id": "A", | |
| "type_id": 0 | |
| } | |
| }, | |
| { | |
| "Sequence": { | |
| "id": "B", | |
| "type_id": 1 | |
| } | |
| } | |
| ], | |
| "special_tokens": { | |
| "</s>": { | |
| "id": "</s>", | |
| "ids": [ | |
| 2 | |
| ], | |
| "tokens": [ | |
| "</s>" | |
| ] | |
| }, | |
| "<s>": { | |
| "id": "<s>", | |
| "ids": [ | |
| 1 | |
| ], | |
| "tokens": [ | |
| "<s>" | |
| ] | |
| } | |
| } | |
| }, | |
| "decoder": null, | |
| "model": { | |
| "type": "WordLevel", | |
| "vocab": { | |
| "<pad>": 0, | |
| "<s>": 1, | |
| "</s>": 2, | |
| "<unk>": 3, | |
| "ⴳⵯ": 4, | |
| "ⴽⵯ": 5, | |
| "ⴰ": 6, | |
| "ⴱ": 7, | |
| "ⴳ": 8, | |
| "ⴷ": 9, | |
| "ⴹ": 10, | |
| "ⴻ": 11, | |
| "ⴼ": 12, | |
| "ⴽ": 13, | |
| "ⵀ": 14, | |
| "ⵃ": 15, | |
| "ⵄ": 16, | |
| "ⵅ": 17, | |
| "ⵇ": 18, | |
| "ⵉ": 19, | |
| "ⵊ": 20, | |
| "ⵍ": 21, | |
| "ⵎ": 22, | |
| "ⵏ": 23, | |
| "ⵓ": 24, | |
| "ⵔ": 25, | |
| "ⵕ": 26, | |
| "ⵖ": 27, | |
| "ⵙ": 28, | |
| "ⵚ": 29, | |
| "ⵛ": 30, | |
| "ⵜ": 31, | |
| "ⵟ": 32, | |
| "ⵡ": 33, | |
| "ⵢ": 34, | |
| "ⵣ": 35, | |
| "ⵥ": 36, | |
| "0": 37, | |
| "1": 38, | |
| "2": 39, | |
| "3": 40, | |
| "4": 41, | |
| "5": 42, | |
| "6": 43, | |
| "7": 44, | |
| "8": 45, | |
| "9": 46, | |
| " ": 47, | |
| ".": 48, | |
| ",": 49, | |
| ";": 50, | |
| ":": 51, | |
| "!": 52, | |
| "?": 53, | |
| "-": 54, | |
| "'": 55, | |
| "\"": 56, | |
| "(": 57, | |
| ")": 58, | |
| "[": 59, | |
| "]": 60, | |
| "{": 61, | |
| "}": 62, | |
| "@": 63, | |
| "#": 64, | |
| "%": 65, | |
| "&": 66, | |
| "*": 67, | |
| "+": 68, | |
| "=": 69, | |
| "/": 70, | |
| "<": 71, | |
| ">": 72, | |
| "\\": 73, | |
| "|": 74, | |
| "~": 75, | |
| "`": 76, | |
| "^": 77, | |
| "_": 78, | |
| "\n": 79, | |
| "\t": 80 | |
| }, | |
| "unk_token": "<unk>" | |
| } | |
| } |