vccarvalho11 commited on
Commit
48fa959
·
verified ·
1 Parent(s): ec869ff

Upload gpt2 ONNX model

Browse files
Files changed (5) hide show
  1. README.md +45 -0
  2. config.json +38 -0
  3. merges.txt +0 -0
  4. model.onnx +3 -0
  5. vocab.json +0 -0
README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: onnx
3
+ tags:
4
+ - text-generation
5
+ - gpt2
6
+ - onnx
7
+ - inference4j
8
+ license: mit
9
+ pipeline_tag: text-generation
10
+ ---
11
+
12
+ # GPT-2 — ONNX
13
+
14
+ ONNX export of [GPT-2](https://huggingface.co/openai-community/gpt2) (124M parameters) with KV cache support for efficient autoregressive generation.
15
+
16
+ Converted for use with [inference4j](https://github.com/inference4j/inference4j), an inference-only AI library for Java.
17
+
18
+ ## Original Source
19
+
20
+ - **Repository:** [OpenAI](https://huggingface.co/openai-community/gpt2)
21
+ - **License:** MIT
22
+
23
+ ## Usage with inference4j
24
+
25
+ ```java
26
+ try (Gpt2TextGenerator gen = Gpt2TextGenerator.builder().build()) {
27
+ GenerationResult result = gen.generate("Once upon a time");
28
+ System.out.println(result.text());
29
+ }
30
+ ```
31
+
32
+ ## Model Details
33
+
34
+ | Property | Value |
35
+ |----------|-------|
36
+ | Architecture | GPT-2 (124M parameters, 12 layers, 768 hidden, 12 heads) |
37
+ | Task | Text generation |
38
+ | Context length | 1024 tokens |
39
+ | Vocabulary | 50257 tokens (BPE) |
40
+ | Original framework | PyTorch (transformers) |
41
+ | Export method | Hugging Face Optimum (with KV cache) |
42
+
43
+ ## License
44
+
45
+ This model is licensed under the [MIT License](https://opensource.org/licenses/MIT). Original model by [OpenAI](https://openai.com/).
config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_new",
3
+ "architectures": [
4
+ "GPT2LMHeadModel"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "bos_token_id": 50256,
8
+ "dtype": "float32",
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_epsilon": 1e-05,
13
+ "model_type": "gpt2",
14
+ "n_ctx": 1024,
15
+ "n_embd": 768,
16
+ "n_head": 12,
17
+ "n_inner": null,
18
+ "n_layer": 12,
19
+ "n_positions": 1024,
20
+ "reorder_and_upcast_attn": false,
21
+ "resid_pdrop": 0.1,
22
+ "scale_attn_by_inverse_layer_idx": false,
23
+ "scale_attn_weights": true,
24
+ "summary_activation": null,
25
+ "summary_first_dropout": 0.1,
26
+ "summary_proj_to_labels": true,
27
+ "summary_type": "cls_index",
28
+ "summary_use_proj": true,
29
+ "task_specific_params": {
30
+ "text-generation": {
31
+ "do_sample": true,
32
+ "max_length": 50
33
+ }
34
+ },
35
+ "transformers_version": "4.57.6",
36
+ "use_cache": true,
37
+ "vocab_size": 50257
38
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c65b96cc34a79614f0f4798cda459ef98a9180c159a66671a53879a0c6fac200
3
+ size 652560776
vocab.json ADDED
The diff for this file is too large to render. See raw diff