Upload flan-t5-small ONNX model
Browse files- README.md +51 -0
- config.json +61 -0
- decoder_model.onnx +3 -0
- decoder_with_past_model.onnx +3 -0
- encoder_model.onnx +3 -0
- tokenizer.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: onnx
|
| 3 |
+
tags:
|
| 4 |
+
- text2text-generation
|
| 5 |
+
- t5
|
| 6 |
+
- flan-t5
|
| 7 |
+
- encoder-decoder
|
| 8 |
+
- onnx
|
| 9 |
+
- inference4j
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
pipeline_tag: text2text-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Flan-T5 Small — ONNX
|
| 15 |
+
|
| 16 |
+
ONNX export of [Flan-T5 Small](https://huggingface.co/google/flan-t5-small) (77M parameters) with encoder-decoder architecture and KV cache support.
|
| 17 |
+
|
| 18 |
+
Converted for use with [inference4j](https://github.com/inference4j/inference4j), an inference-only AI library for Java.
|
| 19 |
+
|
| 20 |
+
## Original Source
|
| 21 |
+
|
| 22 |
+
- **Repository:** [google/flan-t5-small](https://huggingface.co/google/flan-t5-small)
|
| 23 |
+
- **License:** Apache 2.0
|
| 24 |
+
|
| 25 |
+
## Usage with inference4j
|
| 26 |
+
|
| 27 |
+
```java
|
| 28 |
+
// Summarization
|
| 29 |
+
try (var gen = FlanT5TextGenerator.flanT5Small().build()) {
|
| 30 |
+
System.out.println(gen.summarize("Long article text..."));
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
// Translation
|
| 34 |
+
try (var gen = FlanT5TextGenerator.flanT5Small().build()) {
|
| 35 |
+
System.out.println(gen.translate("Hello!", Language.EN, Language.FR));
|
| 36 |
+
}
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Model Details
|
| 40 |
+
|
| 41 |
+
| Property | Value |
|
| 42 |
+
|----------|-------|
|
| 43 |
+
| Architecture | T5 encoder-decoder (77M parameters) |
|
| 44 |
+
| Tasks | Summarization, translation, grammar correction, text-to-SQL |
|
| 45 |
+
| Tokenizer | SentencePiece (32,128 tokens) |
|
| 46 |
+
| Original framework | PyTorch (transformers) |
|
| 47 |
+
| Export method | Hugging Face Optimum (encoder-decoder with KV cache) |
|
| 48 |
+
|
| 49 |
+
## License
|
| 50 |
+
|
| 51 |
+
This model is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). Original model by [Google](https://huggingface.co/google).
|
config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"T5ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"classifier_dropout": 0.0,
|
| 6 |
+
"d_ff": 1024,
|
| 7 |
+
"d_kv": 64,
|
| 8 |
+
"d_model": 512,
|
| 9 |
+
"decoder_start_token_id": 0,
|
| 10 |
+
"dense_act_fn": "gelu_new",
|
| 11 |
+
"dropout_rate": 0.1,
|
| 12 |
+
"dtype": "float32",
|
| 13 |
+
"eos_token_id": 1,
|
| 14 |
+
"feed_forward_proj": "gated-gelu",
|
| 15 |
+
"initializer_factor": 1.0,
|
| 16 |
+
"is_encoder_decoder": true,
|
| 17 |
+
"is_gated_act": true,
|
| 18 |
+
"layer_norm_epsilon": 1e-06,
|
| 19 |
+
"model_type": "t5",
|
| 20 |
+
"n_positions": 512,
|
| 21 |
+
"num_decoder_layers": 8,
|
| 22 |
+
"num_heads": 6,
|
| 23 |
+
"num_layers": 8,
|
| 24 |
+
"output_past": true,
|
| 25 |
+
"pad_token_id": 0,
|
| 26 |
+
"relative_attention_max_distance": 128,
|
| 27 |
+
"relative_attention_num_buckets": 32,
|
| 28 |
+
"task_specific_params": {
|
| 29 |
+
"summarization": {
|
| 30 |
+
"early_stopping": true,
|
| 31 |
+
"length_penalty": 2.0,
|
| 32 |
+
"max_length": 200,
|
| 33 |
+
"min_length": 30,
|
| 34 |
+
"no_repeat_ngram_size": 3,
|
| 35 |
+
"num_beams": 4,
|
| 36 |
+
"prefix": "summarize: "
|
| 37 |
+
},
|
| 38 |
+
"translation_en_to_de": {
|
| 39 |
+
"early_stopping": true,
|
| 40 |
+
"max_length": 300,
|
| 41 |
+
"num_beams": 4,
|
| 42 |
+
"prefix": "translate English to German: "
|
| 43 |
+
},
|
| 44 |
+
"translation_en_to_fr": {
|
| 45 |
+
"early_stopping": true,
|
| 46 |
+
"max_length": 300,
|
| 47 |
+
"num_beams": 4,
|
| 48 |
+
"prefix": "translate English to French: "
|
| 49 |
+
},
|
| 50 |
+
"translation_en_to_ro": {
|
| 51 |
+
"early_stopping": true,
|
| 52 |
+
"max_length": 300,
|
| 53 |
+
"num_beams": 4,
|
| 54 |
+
"prefix": "translate English to Romanian: "
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
"tie_word_embeddings": false,
|
| 58 |
+
"transformers_version": "4.57.6",
|
| 59 |
+
"use_cache": true,
|
| 60 |
+
"vocab_size": 32128
|
| 61 |
+
}
|
decoder_model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f65e029938345ee2cfa2c059a3532c9b2f165cbd22d256b66206feb132d92f2
|
| 3 |
+
size 232577642
|
decoder_with_past_model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2696cf3978727ccf37aaca27cc88c0f2ee017b4c79072ba9b51eb1c71c7e2bb
|
| 3 |
+
size 219971365
|
encoder_model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8e01244ad371cb9405baa37f4c126e40c6b601637dcdddb8058d639ea638d21
|
| 3 |
+
size 141463091
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|