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
| { | |
| "architectures": [ | |
| "VisionEncoderDecoderModel" | |
| ], | |
| "decoder": { | |
| "_name_or_path": "", | |
| "activation_dropout": 0.0, | |
| "activation_function": "gelu", | |
| "add_cross_attention": true, | |
| "architectures": null, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 0, | |
| "chunk_size_feed_forward": 0, | |
| "cross_attention_hidden_size": null, | |
| "d_model": 384, | |
| "decoder_attention_heads": 6, | |
| "decoder_ffn_dim": 1536, | |
| "decoder_layerdrop": 0.0, | |
| "decoder_layers": 3, | |
| "decoder_start_token_id": 2, | |
| "dropout": 0.1, | |
| "dtype": "float32", | |
| "eos_token_id": 2, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "init_std": 0.02, | |
| "is_decoder": true, | |
| "is_encoder_decoder": false, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "layernorm_embedding": true, | |
| "max_position_embeddings": 128, | |
| "model_type": "trocr", | |
| "output_attentions": false, | |
| "output_hidden_states": false, | |
| "pad_token_id": 1, | |
| "problem_type": null, | |
| "return_dict": true, | |
| "scale_embedding": false, | |
| "tie_word_embeddings": true, | |
| "use_cache": true, | |
| "use_learned_position_embeddings": true, | |
| "vocab_size": 81 | |
| }, | |
| "decoder_start_token_id": 1, | |
| "dtype": "float32", | |
| "encoder": { | |
| "_name_or_path": "", | |
| "architectures": null, | |
| "attention_probs_dropout_prob": 0.0, | |
| "chunk_size_feed_forward": 0, | |
| "dtype": "float32", | |
| "encoder_stride": 16, | |
| "hidden_act": "gelu", | |
| "hidden_dropout_prob": 0.0, | |
| "hidden_size": 384, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "image_size": [ | |
| 64, | |
| 256 | |
| ], | |
| "initializer_range": 0.02, | |
| "intermediate_size": 1536, | |
| "is_encoder_decoder": false, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "layer_norm_eps": 1e-12, | |
| "model_type": "vit", | |
| "num_attention_heads": 6, | |
| "num_channels": 3, | |
| "num_hidden_layers": 6, | |
| "output_attentions": false, | |
| "output_hidden_states": false, | |
| "patch_size": 16, | |
| "pooler_act": "tanh", | |
| "pooler_output_size": 384, | |
| "problem_type": null, | |
| "qkv_bias": true, | |
| "return_dict": true | |
| }, | |
| "eos_token_id": 2, | |
| "is_encoder_decoder": true, | |
| "model_type": "vision-encoder-decoder", | |
| "pad_token_id": 0, | |
| "tie_word_embeddings": false, | |
| "transformers_version": "5.5.4", | |
| "vocab_size": 81 | |
| } | |