Image-Text-to-Text
Transformers
Safetensors
Standard Moroccan Tamazight
Central Atlas Tamazight
Tachelhit
vision-encoder-decoder
Instructions to use Tamazight/TrOCR-Tifinagh-Small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Tamazight/TrOCR-Tifinagh-Small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Tamazight/TrOCR-Tifinagh-Small")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("Tamazight/TrOCR-Tifinagh-Small") model = AutoModelForImageTextToText.from_pretrained("Tamazight/TrOCR-Tifinagh-Small") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Tamazight/TrOCR-Tifinagh-Small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Tamazight/TrOCR-Tifinagh-Small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Tamazight/TrOCR-Tifinagh-Small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Tamazight/TrOCR-Tifinagh-Small
- SGLang
How to use Tamazight/TrOCR-Tifinagh-Small 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 "Tamazight/TrOCR-Tifinagh-Small" \ --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": "Tamazight/TrOCR-Tifinagh-Small", "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 "Tamazight/TrOCR-Tifinagh-Small" \ --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": "Tamazight/TrOCR-Tifinagh-Small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Tamazight/TrOCR-Tifinagh-Small with Docker Model Runner:
docker model run hf.co/Tamazight/TrOCR-Tifinagh-Small
Upload model
Browse files- config.json +122 -0
- generation_config.json +39 -0
- model.safetensors +3 -0
config.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"VisionEncoderDecoderModel"
|
| 4 |
+
],
|
| 5 |
+
"bos_token_id": 2,
|
| 6 |
+
"decoder": {
|
| 7 |
+
"_name_or_path": "",
|
| 8 |
+
"activation_dropout": 0.0,
|
| 9 |
+
"activation_function": "relu",
|
| 10 |
+
"add_cross_attention": true,
|
| 11 |
+
"architectures": null,
|
| 12 |
+
"attention_dropout": 0.0,
|
| 13 |
+
"bos_token_id": 0,
|
| 14 |
+
"chunk_size_feed_forward": 0,
|
| 15 |
+
"classifier_dropout": 0.0,
|
| 16 |
+
"cross_attention_hidden_size": 384,
|
| 17 |
+
"d_model": 256,
|
| 18 |
+
"decoder_attention_heads": 8,
|
| 19 |
+
"decoder_ffn_dim": 1024,
|
| 20 |
+
"decoder_layerdrop": 0.0,
|
| 21 |
+
"decoder_layers": 6,
|
| 22 |
+
"decoder_start_token_id": 2,
|
| 23 |
+
"dropout": 0.1,
|
| 24 |
+
"dtype": "float32",
|
| 25 |
+
"eos_token_id": 2,
|
| 26 |
+
"finetuning_task": null,
|
| 27 |
+
"id2label": {
|
| 28 |
+
"0": "LABEL_0",
|
| 29 |
+
"1": "LABEL_1"
|
| 30 |
+
},
|
| 31 |
+
"init_std": 0.02,
|
| 32 |
+
"is_decoder": true,
|
| 33 |
+
"is_encoder_decoder": false,
|
| 34 |
+
"label2id": {
|
| 35 |
+
"LABEL_0": 0,
|
| 36 |
+
"LABEL_1": 1
|
| 37 |
+
},
|
| 38 |
+
"layernorm_embedding": true,
|
| 39 |
+
"max_position_embeddings": 512,
|
| 40 |
+
"model_type": "trocr",
|
| 41 |
+
"output_attentions": false,
|
| 42 |
+
"output_hidden_states": false,
|
| 43 |
+
"pad_token_id": 1,
|
| 44 |
+
"prefix": null,
|
| 45 |
+
"problem_type": null,
|
| 46 |
+
"pruned_heads": {},
|
| 47 |
+
"return_dict": true,
|
| 48 |
+
"scale_embedding": true,
|
| 49 |
+
"sep_token_id": null,
|
| 50 |
+
"task_specific_params": null,
|
| 51 |
+
"tie_encoder_decoder": false,
|
| 52 |
+
"tie_word_embeddings": false,
|
| 53 |
+
"tokenizer_class": null,
|
| 54 |
+
"torchscript": false,
|
| 55 |
+
"use_bfloat16": false,
|
| 56 |
+
"use_cache": false,
|
| 57 |
+
"use_learned_position_embeddings": true,
|
| 58 |
+
"vocab_size": 82
|
| 59 |
+
},
|
| 60 |
+
"decoder_start_token_id": 2,
|
| 61 |
+
"dtype": "float32",
|
| 62 |
+
"encoder": {
|
| 63 |
+
"_name_or_path": "",
|
| 64 |
+
"add_cross_attention": false,
|
| 65 |
+
"architectures": null,
|
| 66 |
+
"attention_probs_dropout_prob": 0.0,
|
| 67 |
+
"bos_token_id": null,
|
| 68 |
+
"chunk_size_feed_forward": 0,
|
| 69 |
+
"cross_attention_hidden_size": null,
|
| 70 |
+
"decoder_start_token_id": null,
|
| 71 |
+
"dtype": "float32",
|
| 72 |
+
"encoder_stride": 16,
|
| 73 |
+
"eos_token_id": null,
|
| 74 |
+
"finetuning_task": null,
|
| 75 |
+
"hidden_act": "gelu",
|
| 76 |
+
"hidden_dropout_prob": 0.0,
|
| 77 |
+
"hidden_size": 384,
|
| 78 |
+
"id2label": {
|
| 79 |
+
"0": "LABEL_0",
|
| 80 |
+
"1": "LABEL_1"
|
| 81 |
+
},
|
| 82 |
+
"image_size": 384,
|
| 83 |
+
"initializer_range": 0.02,
|
| 84 |
+
"intermediate_size": 1536,
|
| 85 |
+
"is_decoder": false,
|
| 86 |
+
"is_encoder_decoder": false,
|
| 87 |
+
"label2id": {
|
| 88 |
+
"LABEL_0": 0,
|
| 89 |
+
"LABEL_1": 1
|
| 90 |
+
},
|
| 91 |
+
"layer_norm_eps": 1e-12,
|
| 92 |
+
"model_type": "deit",
|
| 93 |
+
"num_attention_heads": 6,
|
| 94 |
+
"num_channels": 3,
|
| 95 |
+
"num_hidden_layers": 12,
|
| 96 |
+
"output_attentions": false,
|
| 97 |
+
"output_hidden_states": false,
|
| 98 |
+
"pad_token_id": null,
|
| 99 |
+
"patch_size": 16,
|
| 100 |
+
"pooler_act": "tanh",
|
| 101 |
+
"pooler_output_size": 384,
|
| 102 |
+
"prefix": null,
|
| 103 |
+
"problem_type": null,
|
| 104 |
+
"pruned_heads": {},
|
| 105 |
+
"qkv_bias": true,
|
| 106 |
+
"return_dict": true,
|
| 107 |
+
"sep_token_id": null,
|
| 108 |
+
"task_specific_params": null,
|
| 109 |
+
"tie_encoder_decoder": false,
|
| 110 |
+
"tie_word_embeddings": true,
|
| 111 |
+
"tokenizer_class": null,
|
| 112 |
+
"torchscript": false,
|
| 113 |
+
"use_bfloat16": false
|
| 114 |
+
},
|
| 115 |
+
"eos_token_id": 3,
|
| 116 |
+
"is_encoder_decoder": true,
|
| 117 |
+
"model_type": "vision-encoder-decoder",
|
| 118 |
+
"pad_token_id": 0,
|
| 119 |
+
"tie_word_embeddings": false,
|
| 120 |
+
"transformers_version": "5.0.0",
|
| 121 |
+
"vocab_size": 82
|
| 122 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": false,
|
| 3 |
+
"assistant_confidence_threshold": 0.4,
|
| 4 |
+
"assistant_lookbehind": 10,
|
| 5 |
+
"bos_token_id": 2,
|
| 6 |
+
"decoder_start_token_id": 2,
|
| 7 |
+
"diversity_penalty": 0.0,
|
| 8 |
+
"do_sample": false,
|
| 9 |
+
"early_stopping": true,
|
| 10 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 11 |
+
"encoder_repetition_penalty": 1.0,
|
| 12 |
+
"eos_token_id": [
|
| 13 |
+
3,
|
| 14 |
+
3
|
| 15 |
+
],
|
| 16 |
+
"epsilon_cutoff": 0.0,
|
| 17 |
+
"eta_cutoff": 0.0,
|
| 18 |
+
"length_penalty": 2.0,
|
| 19 |
+
"max_length": 64,
|
| 20 |
+
"min_length": 0,
|
| 21 |
+
"no_repeat_ngram_size": 3,
|
| 22 |
+
"num_assistant_tokens": 20,
|
| 23 |
+
"num_assistant_tokens_schedule": "constant",
|
| 24 |
+
"num_beam_groups": 1,
|
| 25 |
+
"num_beams": 4,
|
| 26 |
+
"num_return_sequences": 1,
|
| 27 |
+
"output_scores": false,
|
| 28 |
+
"pad_token_id": 0,
|
| 29 |
+
"remove_invalid_values": false,
|
| 30 |
+
"repetition_penalty": 1.0,
|
| 31 |
+
"return_dict_in_generate": false,
|
| 32 |
+
"target_lookbehind": 10,
|
| 33 |
+
"temperature": 1.0,
|
| 34 |
+
"top_k": 50,
|
| 35 |
+
"top_p": 1.0,
|
| 36 |
+
"transformers_version": "5.0.0",
|
| 37 |
+
"typical_p": 1.0,
|
| 38 |
+
"use_cache": false
|
| 39 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5baa3bf6079e432500c1b216f7684ea90ba0a61d0296b8dc98cb7abcb0eb7d8a
|
| 3 |
+
size 115436056
|