IamJustPucca commited on
Commit
89a890d
·
verified ·
1 Parent(s): b4648cf

Adding ONNX file of this model

Browse files

Beep boop I am the [ONNX export bot 🤖🏎️](https://huggingface.co/spaces/onnx/export). On behalf of [IamJustPucca](https://huggingface.co/IamJustPucca), I would like to add to this repository the model converted to ONNX.

What is ONNX? It stands for "Open Neural Network Exchange", and is the most commonly used open standard for machine learning interoperability. You can find out more at [onnx.ai](https://onnx.ai/)!

The exported ONNX model can be then be consumed by various backends as TensorRT or TVM, or simply be used in a few lines with 🤗 Optimum through ONNX Runtime, check out how [here](https://huggingface.co/docs/optimum/main/en/onnxruntime/usage_guides/models)!

README.md CHANGED
@@ -2,6 +2,7 @@
2
  tags:
3
  - trocr
4
  - image-to-text
 
5
  widget:
6
  - src: https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg
7
  example_title: Note 1
 
2
  tags:
3
  - trocr
4
  - image-to-text
5
+ - onnx
6
  widget:
7
  - src: https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg
8
  example_title: Note 1
onnx/config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": true,
3
+ "architectures": [
4
+ "VisionEncoderDecoderModel"
5
+ ],
6
+ "decoder": {
7
+ "activation_dropout": 0.0,
8
+ "activation_function": "relu",
9
+ "add_cross_attention": true,
10
+ "attention_dropout": 0.0,
11
+ "classifier_dropout": 0.0,
12
+ "cross_attention_hidden_size": 384,
13
+ "d_model": 256,
14
+ "decoder_attention_heads": 8,
15
+ "decoder_ffn_dim": 1024,
16
+ "decoder_layerdrop": 0.0,
17
+ "decoder_layers": 6,
18
+ "dropout": 0.1,
19
+ "init_std": 0.02,
20
+ "is_decoder": true,
21
+ "layernorm_embedding": true,
22
+ "max_position_embeddings": 512,
23
+ "model_type": "trocr",
24
+ "scale_embedding": true,
25
+ "tie_word_embeddings": false,
26
+ "torch_dtype": "float32",
27
+ "use_cache": false,
28
+ "use_learned_position_embeddings": true,
29
+ "vocab_size": 64044
30
+ },
31
+ "encoder": {
32
+ "attention_probs_dropout_prob": 0.0,
33
+ "encoder_stride": 16,
34
+ "hidden_act": "gelu",
35
+ "hidden_dropout_prob": 0.0,
36
+ "hidden_size": 384,
37
+ "image_size": 384,
38
+ "initializer_range": 0.02,
39
+ "intermediate_size": 1536,
40
+ "layer_norm_eps": 1e-12,
41
+ "model_type": "deit",
42
+ "num_attention_heads": 6,
43
+ "num_channels": 3,
44
+ "num_hidden_layers": 12,
45
+ "patch_size": 16,
46
+ "pooler_act": "tanh",
47
+ "pooler_output_size": 384,
48
+ "qkv_bias": true,
49
+ "torch_dtype": "float32"
50
+ },
51
+ "eos_token_id": 2,
52
+ "is_encoder_decoder": true,
53
+ "model_type": "vision-encoder-decoder",
54
+ "tie_word_embeddings": false,
55
+ "torch_dtype": "float32",
56
+ "transformers_version": "4.51.3",
57
+ "use_cache": true
58
+ }
onnx/decoder_model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b05607490320b869d46b95572cba46538817fe71ec60f981fcb8e47a4b20bd7d
3
+ size 158834142
onnx/decoder_model_merged.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6921f06c9f6a477862cab9d6e13e4089782bcf024213f95c1096ae0727163f12
3
+ size 159079076
onnx/decoder_with_past_model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dc26ea989ce6ec1f26d25d79c18344a5009b4daad7bb2daba6b456d0d6d634b
3
+ size 154052951
onnx/encoder_model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5fbd4029d62fd1aedde53bf4ce4a5da67cf3cead6822a587fdc5ae48a5d8806c
3
+ size 87510770
onnx/generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "decoder_start_token_id": 2,
5
+ "eos_token_id": 2,
6
+ "pad_token_id": 1,
7
+ "transformers_version": "4.51.3",
8
+ "use_cache": false
9
+ }
onnx/preprocessor_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": {
3
+ "height": 224,
4
+ "width": 224
5
+ },
6
+ "do_center_crop": false,
7
+ "do_normalize": true,
8
+ "do_rescale": true,
9
+ "do_resize": true,
10
+ "image_mean": [
11
+ 0.5,
12
+ 0.5,
13
+ 0.5
14
+ ],
15
+ "image_processor_type": "DeiTImageProcessor",
16
+ "image_std": [
17
+ 0.5,
18
+ 0.5,
19
+ 0.5
20
+ ],
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "size": {
24
+ "height": 384,
25
+ "width": 384
26
+ }
27
+ }