Publish model bundles
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +4 -33
- LICENSE +24 -0
- LICENSES/GPT-2-MIT.txt +24 -0
- NOTICE +10 -0
- README.md +179 -1
- config.json +16 -0
- gpt2/fp16/LICENSE +24 -0
- gpt2/fp16/NOTICE +10 -0
- gpt2/fp16/README.md +5 -0
- gpt2/fp16/macos27/h13c/checkpoint/README.md +167 -0
- gpt2/fp16/macos27/h13c/checkpoint/config.json +31 -0
- gpt2/fp16/macos27/h13c/checkpoint/generation_config.json +6 -0
- gpt2/fp16/macos27/h13c/checkpoint/merges.txt +0 -0
- gpt2/fp16/macos27/h13c/checkpoint/model.safetensors +3 -0
- gpt2/fp16/macos27/h13c/checkpoint/tokenizer.json +0 -0
- gpt2/fp16/macos27/h13c/checkpoint/tokenizer_config.json +1 -0
- gpt2/fp16/macos27/h13c/checkpoint/vocab.json +0 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/Manifest.json +5 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w1_IenFJ1GSZFXtSI-1yaeozQ_0_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w4_tmsSNgMGeI7V8itesd-A6w_1_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w64_rSxzX4fSuqdOE7KVUvQgqQ_2_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w8_iKsrfL2rNL8zQzdOUlUZ5Q_3_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c2048w4_6r0Zg1IUWQByvoxqvE5JtA_4_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c2048w64_8kfJfdrK5IyHrQXwlL11RQ_5_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c2048w8_ZEzGbu2gIh24LhJW-EvsGQ_6_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w1_3Zihyom_ORiPUtOgoKqr6A_7_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w4_6H47qaK-SzkD-kf-6d6_kQ_8_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w8_Unl5vAsQ-msc7f8s9bV1pA_10_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c4096w4_IHI5-XpuRXZz3FXRdAu_aA_11_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c4096w64_GE5SuCbSnvhoodS8qBwgeQ_12_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c4096w8_0TTYrpXDXLsLC2vUdt7lSQ_13_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w1_Ca3mWeEDniuKAzO_6YXkNQ_14_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w4_iSKMLLpUuOodEuw_60CNcw_15_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w64_MGtGd_9wfGYNW7kcppQJbg_16_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w8_vTMI_EMMSc8g_5no4A9P1w_17_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c8192w64_5JXamHMFTpqemXTAfCTWkg_18_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c8192w8_yfcfcOxpejySNt_MNan-ww_19_ANE_region_0_0.mlir.bc +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/manifest.plist +0 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/original_model_0.mpsgraph +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/resources.bin +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/specialized_model_1.mpsgraph +3 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c.mlirb +0 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main.hash +1 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/metadata.json +6 -0
- gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/stats.json +1 -0
- gpt2/fp16/macos27/h13c/model.json +234 -0
- gpt2/fp16/macos27/h13d/checkpoint/README.md +167 -0
- gpt2/fp16/macos27/h13d/checkpoint/config.json +31 -0
- gpt2/fp16/macos27/h13d/checkpoint/generation_config.json +6 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,6 @@
|
|
| 1 |
-
*
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
|
| 27 |
-
*.
|
| 28 |
-
*.
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
* text=auto
|
|
|
|
| 2 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bc filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.mpsgraph filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.metallib filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Modified MIT License
|
| 2 |
+
|
| 3 |
+
Software Copyright (c) 2019 OpenAI
|
| 4 |
+
|
| 5 |
+
We don’t claim ownership of the content you create with GPT-2, so it is yours to do with as you please.
|
| 6 |
+
We only ask that you use GPT-2 responsibly and clearly indicate your content was created using GPT-2.
|
| 7 |
+
|
| 8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
| 9 |
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
| 10 |
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 11 |
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
| 12 |
+
subject to the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be included
|
| 15 |
+
in all copies or substantial portions of the Software.
|
| 16 |
+
The above copyright notice and this permission notice need not be included
|
| 17 |
+
with content created by the Software.
|
| 18 |
+
|
| 19 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
| 20 |
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 21 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
| 22 |
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 23 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
| 24 |
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
LICENSES/GPT-2-MIT.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Modified MIT License
|
| 2 |
+
|
| 3 |
+
Software Copyright (c) 2019 OpenAI
|
| 4 |
+
|
| 5 |
+
We don’t claim ownership of the content you create with GPT-2, so it is yours to do with as you please.
|
| 6 |
+
We only ask that you use GPT-2 responsibly and clearly indicate your content was created using GPT-2.
|
| 7 |
+
|
| 8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
| 9 |
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
| 10 |
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 11 |
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
| 12 |
+
subject to the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be included
|
| 15 |
+
in all copies or substantial portions of the Software.
|
| 16 |
+
The above copyright notice and this permission notice need not be included
|
| 17 |
+
with content created by the Software.
|
| 18 |
+
|
| 19 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
| 20 |
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 21 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
| 22 |
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 23 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
| 24 |
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GPT-2 Core AI / Apple Neural Engine conversion
|
| 2 |
+
|
| 3 |
+
Original GPT-2 Software Copyright (c) 2019 OpenAI.
|
| 4 |
+
Upstream: https://github.com/openai/gpt-2
|
| 5 |
+
Checkpoints: openai-community/gpt2, gpt2-medium, gpt2-large, gpt2-xl.
|
| 6 |
+
Original Modified MIT License: LICENSE and LICENSES/GPT-2-MIT.txt.
|
| 7 |
+
Independent conversion by WeGoToMars / Tinkerbox; the models have not been retrained.
|
| 8 |
+
FP16 activations; FP16, INT8-per-channel or LUT8-group32 projection weights.
|
| 9 |
+
Tokenization, embeddings, FP32 vocabulary projection and sampling run on CPU.
|
| 10 |
+
Checkpoint revisions and converted identities are recorded in every bundle manifest.
|
README.md
CHANGED
|
@@ -1,3 +1,181 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
| 3 |
+
license: other
|
| 4 |
+
license_name: gpt-2-modified-mit
|
| 5 |
+
license_link: LICENSE
|
| 6 |
+
library_name: tinkerbox-ane
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
base_model:
|
| 9 |
+
- openai-community/gpt2
|
| 10 |
+
- openai-community/gpt2-medium
|
| 11 |
+
- openai-community/gpt2-large
|
| 12 |
+
- openai-community/gpt2-xl
|
| 13 |
+
tags:
|
| 14 |
+
- coreai
|
| 15 |
+
- apple-neural-engine
|
| 16 |
+
- apple-silicon
|
| 17 |
+
- gpt2
|
| 18 |
+
- fp16
|
| 19 |
+
- int8
|
| 20 |
+
- lut8
|
| 21 |
---
|
| 22 |
+
|
| 23 |
+
# GPT-2 on Apple Neural Engine
|
| 24 |
+
|
| 25 |
+
All four original GPT-2 sizes ported to Core AI framework. FP16, INT8 and LUT8 weights in one repository.
|
| 26 |
+
|
| 27 |
+
Requires Tinkerbox 2.3.0 or later, Apple Silicon M1+ and macOS 27 or later.
|
| 28 |
+
|
| 29 |
+
The transformer runs on ANE. Tokenization, embeddings, FP32 vocabulary projection and sampling run on CPU. Context is 1,024 tokens, with independent batches of 1, 4 or 8 and automatic selection for partial groups. Prefill width is 64. FP16 is the default; INT8 and LUT8 are optional compressed weights. These are base text-completion models with no chat template or instruction tuning.
|
| 30 |
+
|
| 31 |
+
## Choose a bundle
|
| 32 |
+
|
| 33 |
+
```text
|
| 34 |
+
<model>/<weights>/macos27/<architecture>/
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
Models: `gpt2`, `gpt2-medium`, `gpt2-large`, `gpt2-xl`. Weights: `fp16`, `int8`, `lut8`. Each directory is self-contained: `model.json`, CPU checkpoint/tokenizer files, and its compiled `.aimodelc` stages.
|
| 38 |
+
|
| 39 |
+
Download sizes below are for the M5 Pro bundle, including its CPU checkpoint:
|
| 40 |
+
|
| 41 |
+
| Model | Parameters | FP16 MiB | INT8 MiB | LUT8 MiB |
|
| 42 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 43 |
+
| Small (`gpt2`) | 124,439,808 | 253.0 | 175.6 | 198.9 |
|
| 44 |
+
| Medium (`gpt2-medium`) | 354,823,168 | 709.8 | 431.3 | 494.0 |
|
| 45 |
+
| Large (`gpt2-large`) | 774,030,080 | 1,530.6 | 873.3 | 992.4 |
|
| 46 |
+
| XL (`gpt2-xl`) | 1,557,611,200 | 3,051.5 | 1,674.7 | 1,878.0 |
|
| 47 |
+
|
| 48 |
+
## Run
|
| 49 |
+
|
| 50 |
+
Requires `tinkerbox-ane>=2.3.0` and Python 3.12 or 3.13:
|
| 51 |
+
|
| 52 |
+
```sh
|
| 53 |
+
python -m pip install "tinkerbox-ane>=2.3.0"
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Download only the chosen model, weights and chip target:
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from pathlib import Path
|
| 60 |
+
from huggingface_hub import HfApi, snapshot_download
|
| 61 |
+
import tinkerbox_ane
|
| 62 |
+
from tinkerbox_ane.host import device_architecture
|
| 63 |
+
|
| 64 |
+
repo = "wegotomars/GPT2-CoreAI-ANE"
|
| 65 |
+
revision = HfApi().model_info(repo).sha # Record this immutable revision for reuse.
|
| 66 |
+
model = "gpt2"
|
| 67 |
+
weights = "fp16" # fp16, int8 or lut8
|
| 68 |
+
folder = f"{model}/{weights}/macos27/{device_architecture()}"
|
| 69 |
+
root = snapshot_download(
|
| 70 |
+
repo_id=repo,
|
| 71 |
+
revision=revision,
|
| 72 |
+
local_dir=Path("models/GPT2-CoreAI-ANE") / revision,
|
| 73 |
+
allow_patterns=["config.json", "LICENSE", "NOTICE", f"{folder}/**"],
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
with tinkerbox_ane.load(model, Path(root) / folder) as engine:
|
| 77 |
+
reply = engine.generate("Once upon a time,", max_new_tokens=48)
|
| 78 |
+
print(reply["text"])
|
| 79 |
+
samples = engine.generate_batch(
|
| 80 |
+
["The scientist discovered", "The musician played"],
|
| 81 |
+
max_new_tokens=32, temperature=1.0, top_k=40, seed=42,
|
| 82 |
+
)
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Temperature zero selects greedy decoding. Seeded sampling preserves standalone replay. Batches accept unrelated prefixes and different lengths, and return input order. Prompt plus requested output tokens must fit the 1,024-token context.
|
| 86 |
+
|
| 87 |
+
## Performance
|
| 88 |
+
|
| 89 |
+
Measured on **Apple M5 Pro, 24 GB, macOS 27.0.1 (`h17s`)**. Median of three warm 24-token completions, four CPU threads, with CPU processing and host dispatch included. Batch 8 uses independent requests with the same 12-token prompt. The reference backend is Transformers FP16 on MPS.
|
| 90 |
+
|
| 91 |
+
| Model | Weights | Single tokens/s | Batch 8 tokens/s | MPS FP16 batch 8 tokens/s |
|
| 92 |
+
| --- | --- | ---: | ---: | ---: |
|
| 93 |
+
| Small | FP16 | 327.6 | 1,309.0 | 1,225.5 |
|
| 94 |
+
| Small | INT8 | 396.2 | 1,444.6 | 1,225.5 |
|
| 95 |
+
| Small | LUT8 | 394.4 | 1,443.6 | 1,225.5 |
|
| 96 |
+
| Medium | FP16 | 135.8 | 667.3 | 781.7 |
|
| 97 |
+
| Medium | INT8 | 178.6 | 778.0 | 781.7 |
|
| 98 |
+
| Medium | LUT8 | 177.8 | 770.4 | 781.7 |
|
| 99 |
+
| Large | FP16 | 69.9 | 395.9 | 575.3 |
|
| 100 |
+
| Large | INT8 | 98.0 | 491.4 | 575.3 |
|
| 101 |
+
| Large | LUT8 | 97.6 | 491.7 | 575.3 |
|
| 102 |
+
| XL | FP16 | 37.8 | 228.7 | 421.2 |
|
| 103 |
+
| XL | INT8 | 55.1 | 305.3 | 421.2 |
|
| 104 |
+
| XL | LUT8 | 52.0 | 299.6 | 421.2 |
|
| 105 |
+
|
| 106 |
+
## Conversion results
|
| 107 |
+
|
| 108 |
+
All 252 bundles passed full ANE placement verification. The 12 M5 Pro bundles passed **36 public API tests and 60 numerical checks** through the full context. FP32 MPS supplied the reference scores and continuations.
|
| 109 |
+
|
| 110 |
+
[WikiText-2 test](https://huggingface.co/datasets/Salesforce/wikitext): **287,363 predictions per variant**, with 1,024-token windows. Reference: FP32 MPS transformer with CPU readout. Lower perplexity/KL and higher agreement are better. **Bold** compares INT8 with LUT8.
|
| 111 |
+
|
| 112 |
+
### Small
|
| 113 |
+
|
| 114 |
+
FP32 reference perplexity: **29.941**
|
| 115 |
+
|
| 116 |
+
| Weights | Perplexity | ΔPPL | Mean KL (10⁻³ nats) | P95 KL (10⁻³ nats) | Top-1 agreement |
|
| 117 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 118 |
+
| FP16 | 29.950 | +0.009 | 0.092 | 0.239 | 99.35% |
|
| 119 |
+
| INT8 | 29.977 | +0.037 | 1.287 | 3.482 | 97.62% |
|
| 120 |
+
| LUT8 | 29.968 | +0.027 | **0.469** | **1.267** | **98.58%** |
|
| 121 |
+
|
| 122 |
+
### Medium
|
| 123 |
+
|
| 124 |
+
FP32 reference perplexity: **21.706**
|
| 125 |
+
|
| 126 |
+
| Weights | Perplexity | ΔPPL | Mean KL (10⁻³ nats) | P95 KL (10⁻³ nats) | Top-1 agreement |
|
| 127 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 128 |
+
| FP16 | 21.709 | +0.003 | 0.065 | 0.166 | 99.50% |
|
| 129 |
+
| INT8 | 21.705 | -0.001 | 0.740 | 2.042 | 98.28% |
|
| 130 |
+
| LUT8 | 21.698 | -0.008 | **0.294** | **0.784** | **98.91%** |
|
| 131 |
+
|
| 132 |
+
### Large
|
| 133 |
+
|
| 134 |
+
FP32 reference perplexity: **19.436**
|
| 135 |
+
|
| 136 |
+
| Weights | Perplexity | ΔPPL | Mean KL (10⁻³ nats) | P95 KL (10⁻³ nats) | Top-1 agreement |
|
| 137 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 138 |
+
| FP16 | 19.424 | -0.012 | 0.051 | 0.109 | 99.62% |
|
| 139 |
+
| INT8 | 19.437 | +0.001 | 0.309 | 0.880 | 98.96% |
|
| 140 |
+
| LUT8 | 19.426 | -0.010 | **0.158** | **0.453** | **99.26%** |
|
| 141 |
+
|
| 142 |
+
### XL
|
| 143 |
+
|
| 144 |
+
FP32 reference perplexity: **17.400**
|
| 145 |
+
|
| 146 |
+
| Weights | Perplexity | ΔPPL | Mean KL (10⁻³ nats) | P95 KL (10⁻³ nats) | Top-1 agreement |
|
| 147 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 148 |
+
| FP16 | 17.394 | -0.006 | 0.028 | 0.084 | 99.68% |
|
| 149 |
+
| INT8 | 17.397 | -0.003 | 0.235 | 0.719 | 99.13% |
|
| 150 |
+
| LUT8 | 17.392 | -0.008 | **0.124** | **0.374** | **99.33%** |
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
## Supported architectures
|
| 154 |
+
|
| 155 |
+
| Architecture | SoC name |
|
| 156 |
+
| --- | --- |
|
| 157 |
+
| `h13g` | Apple M1 |
|
| 158 |
+
| `h13s` | Apple M1 Pro |
|
| 159 |
+
| `h13c` | Apple M1 Max |
|
| 160 |
+
| `h13d` | Apple M1 Ultra |
|
| 161 |
+
| `h14g` | Apple M2 |
|
| 162 |
+
| `h14s` | Apple M2 Pro |
|
| 163 |
+
| `h14c` | Apple M2 Max |
|
| 164 |
+
| `h14d` | Apple M2 Ultra |
|
| 165 |
+
| `h15g` | Apple M3 |
|
| 166 |
+
| `h15s` | Apple M3 Pro |
|
| 167 |
+
| `h15m` | Apple M3 Max (14-core CPU) |
|
| 168 |
+
| `h15c` | Apple M3 Max (16-core CPU) |
|
| 169 |
+
| `h15d` | Apple M3 Ultra |
|
| 170 |
+
| `h16g` | Apple M4 |
|
| 171 |
+
| `h16s` | Apple M4 Pro |
|
| 172 |
+
| `h16c` | Apple M4 Max |
|
| 173 |
+
| `h17g` | Apple M5 |
|
| 174 |
+
| `h17s` | Apple M5 Pro |
|
| 175 |
+
| `h17c` | Apple M5 Max |
|
| 176 |
+
| `h17d` | Apple M5 Ultra |
|
| 177 |
+
| `h18g` | Apple M6 |
|
| 178 |
+
|
| 179 |
+
## License
|
| 180 |
+
|
| 181 |
+
Original GPT-2 Software Copyright © 2019 OpenAI, under the original [Modified MIT License](LICENSE). Conversion details are in [NOTICE](NOTICE).
|
config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": 2,
|
| 3 |
+
"kind": "gpt2",
|
| 4 |
+
"min_version": "2.3.0",
|
| 5 |
+
"models": [
|
| 6 |
+
"gpt2",
|
| 7 |
+
"gpt2-medium",
|
| 8 |
+
"gpt2-large",
|
| 9 |
+
"gpt2-xl"
|
| 10 |
+
],
|
| 11 |
+
"weights": [
|
| 12 |
+
"fp16",
|
| 13 |
+
"int8",
|
| 14 |
+
"lut8"
|
| 15 |
+
]
|
| 16 |
+
}
|
gpt2/fp16/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Modified MIT License
|
| 2 |
+
|
| 3 |
+
Software Copyright (c) 2019 OpenAI
|
| 4 |
+
|
| 5 |
+
We don’t claim ownership of the content you create with GPT-2, so it is yours to do with as you please.
|
| 6 |
+
We only ask that you use GPT-2 responsibly and clearly indicate your content was created using GPT-2.
|
| 7 |
+
|
| 8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
| 9 |
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
| 10 |
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 11 |
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
| 12 |
+
subject to the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be included
|
| 15 |
+
in all copies or substantial portions of the Software.
|
| 16 |
+
The above copyright notice and this permission notice need not be included
|
| 17 |
+
with content created by the Software.
|
| 18 |
+
|
| 19 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
| 20 |
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 21 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
| 22 |
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 23 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
| 24 |
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
gpt2/fp16/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GPT-2 Core AI / Apple Neural Engine conversion
|
| 2 |
+
|
| 3 |
+
Original GPT-2 Software Copyright (c) 2019 OpenAI.
|
| 4 |
+
Upstream: https://github.com/openai/gpt-2
|
| 5 |
+
Checkpoints: openai-community/gpt2, gpt2-medium, gpt2-large, gpt2-xl.
|
| 6 |
+
Original Modified MIT License: LICENSE and LICENSES/GPT-2-MIT.txt.
|
| 7 |
+
Independent conversion by WeGoToMars / Tinkerbox; the models have not been retrained.
|
| 8 |
+
FP16 activations; FP16, INT8-per-channel or LUT8-group32 projection weights.
|
| 9 |
+
Tokenization, embeddings, FP32 vocabulary projection and sampling run on CPU.
|
| 10 |
+
Checkpoint revisions and converted identities are recorded in every bundle manifest.
|
gpt2/fp16/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gpt2 / fp16
|
| 2 |
+
|
| 3 |
+
float16; context 1024; batches 1, 4, 8.
|
| 4 |
+
|
| 5 |
+
Choose `macos27/<architecture>`. See the [model card](../../README.md) for usage and results.
|
gpt2/fp16/macos27/h13c/checkpoint/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- exbert
|
| 5 |
+
|
| 6 |
+
license: mit
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# GPT-2
|
| 11 |
+
|
| 12 |
+
Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large
|
| 13 |
+
|
| 14 |
+
Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in
|
| 15 |
+
[this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
|
| 16 |
+
and first released at [this page](https://openai.com/blog/better-language-models/).
|
| 17 |
+
|
| 18 |
+
Disclaimer: The team releasing GPT-2 also wrote a
|
| 19 |
+
[model card](https://github.com/openai/gpt-2/blob/master/model_card.md) for their model. Content from this model card
|
| 20 |
+
has been written by the Hugging Face team to complete the information they provided and give specific examples of bias.
|
| 21 |
+
|
| 22 |
+
## Model description
|
| 23 |
+
|
| 24 |
+
GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This
|
| 25 |
+
means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots
|
| 26 |
+
of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely,
|
| 27 |
+
it was trained to guess the next word in sentences.
|
| 28 |
+
|
| 29 |
+
More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence,
|
| 30 |
+
shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the
|
| 31 |
+
predictions for the token `i` only uses the inputs from `1` to `i` but not the future tokens.
|
| 32 |
+
|
| 33 |
+
This way, the model learns an inner representation of the English language that can then be used to extract features
|
| 34 |
+
useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a
|
| 35 |
+
prompt.
|
| 36 |
+
|
| 37 |
+
This is the **smallest** version of GPT-2, with 124M parameters.
|
| 38 |
+
|
| 39 |
+
**Related Models:** [GPT-Large](https://huggingface.co/gpt2-large), [GPT-Medium](https://huggingface.co/gpt2-medium) and [GPT-XL](https://huggingface.co/gpt2-xl)
|
| 40 |
+
|
| 41 |
+
## Intended uses & limitations
|
| 42 |
+
|
| 43 |
+
You can use the raw model for text generation or fine-tune it to a downstream task. See the
|
| 44 |
+
[model hub](https://huggingface.co/models?filter=gpt2) to look for fine-tuned versions on a task that interests you.
|
| 45 |
+
|
| 46 |
+
### How to use
|
| 47 |
+
|
| 48 |
+
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
|
| 49 |
+
set a seed for reproducibility:
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
>>> from transformers import pipeline, set_seed
|
| 53 |
+
>>> generator = pipeline('text-generation', model='gpt2')
|
| 54 |
+
>>> set_seed(42)
|
| 55 |
+
>>> generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5)
|
| 56 |
+
|
| 57 |
+
[{'generated_text': "Hello, I'm a language model, a language for thinking, a language for expressing thoughts."},
|
| 58 |
+
{'generated_text': "Hello, I'm a language model, a compiler, a compiler library, I just want to know how I build this kind of stuff. I don"},
|
| 59 |
+
{'generated_text': "Hello, I'm a language model, and also have more than a few of your own, but I understand that they're going to need some help"},
|
| 60 |
+
{'generated_text': "Hello, I'm a language model, a system model. I want to know my language so that it might be more interesting, more user-friendly"},
|
| 61 |
+
{'generated_text': 'Hello, I\'m a language model, not a language model"\n\nThe concept of "no-tricks" comes in handy later with new'}]
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
from transformers import GPT2Tokenizer, GPT2Model
|
| 68 |
+
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 69 |
+
model = GPT2Model.from_pretrained('gpt2')
|
| 70 |
+
text = "Replace me by any text you'd like."
|
| 71 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
| 72 |
+
output = model(**encoded_input)
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
and in TensorFlow:
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from transformers import GPT2Tokenizer, TFGPT2Model
|
| 79 |
+
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 80 |
+
model = TFGPT2Model.from_pretrained('gpt2')
|
| 81 |
+
text = "Replace me by any text you'd like."
|
| 82 |
+
encoded_input = tokenizer(text, return_tensors='tf')
|
| 83 |
+
output = model(encoded_input)
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
### Limitations and bias
|
| 87 |
+
|
| 88 |
+
The training data used for this model has not been released as a dataset one can browse. We know it contains a lot of
|
| 89 |
+
unfiltered content from the internet, which is far from neutral. As the openAI team themselves point out in their
|
| 90 |
+
[model card](https://github.com/openai/gpt-2/blob/master/model_card.md#out-of-scope-use-cases):
|
| 91 |
+
|
| 92 |
+
> Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don’t support use-cases
|
| 93 |
+
> that require the generated text to be true.
|
| 94 |
+
>
|
| 95 |
+
> Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do
|
| 96 |
+
> not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a
|
| 97 |
+
> study of biases relevant to the intended use-case. We found no statistically significant difference in gender, race,
|
| 98 |
+
> and religious bias probes between 774M and 1.5B, implying all versions of GPT-2 should be approached with similar
|
| 99 |
+
> levels of caution around use cases that are sensitive to biases around human attributes.
|
| 100 |
+
|
| 101 |
+
Here's an example of how the model can have biased predictions:
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
>>> from transformers import pipeline, set_seed
|
| 105 |
+
>>> generator = pipeline('text-generation', model='gpt2')
|
| 106 |
+
>>> set_seed(42)
|
| 107 |
+
>>> generator("The White man worked as a", max_length=10, num_return_sequences=5)
|
| 108 |
+
|
| 109 |
+
[{'generated_text': 'The White man worked as a mannequin for'},
|
| 110 |
+
{'generated_text': 'The White man worked as a maniser of the'},
|
| 111 |
+
{'generated_text': 'The White man worked as a bus conductor by day'},
|
| 112 |
+
{'generated_text': 'The White man worked as a plumber at the'},
|
| 113 |
+
{'generated_text': 'The White man worked as a journalist. He had'}]
|
| 114 |
+
|
| 115 |
+
>>> set_seed(42)
|
| 116 |
+
>>> generator("The Black man worked as a", max_length=10, num_return_sequences=5)
|
| 117 |
+
|
| 118 |
+
[{'generated_text': 'The Black man worked as a man at a restaurant'},
|
| 119 |
+
{'generated_text': 'The Black man worked as a car salesman in a'},
|
| 120 |
+
{'generated_text': 'The Black man worked as a police sergeant at the'},
|
| 121 |
+
{'generated_text': 'The Black man worked as a man-eating monster'},
|
| 122 |
+
{'generated_text': 'The Black man worked as a slave, and was'}]
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
This bias will also affect all fine-tuned versions of this model.
|
| 126 |
+
|
| 127 |
+
## Training data
|
| 128 |
+
|
| 129 |
+
The OpenAI team wanted to train this model on a corpus as large as possible. To build it, they scraped all the web
|
| 130 |
+
pages from outbound links on Reddit which received at least 3 karma. Note that all Wikipedia pages were removed from
|
| 131 |
+
this dataset, so the model was not trained on any part of Wikipedia. The resulting dataset (called WebText) weights
|
| 132 |
+
40GB of texts but has not been publicly released. You can find a list of the top 1,000 domains present in WebText
|
| 133 |
+
[here](https://github.com/openai/gpt-2/blob/master/domains.txt).
|
| 134 |
+
|
| 135 |
+
## Training procedure
|
| 136 |
+
|
| 137 |
+
### Preprocessing
|
| 138 |
+
|
| 139 |
+
The texts are tokenized using a byte-level version of Byte Pair Encoding (BPE) (for unicode characters) and a
|
| 140 |
+
vocabulary size of 50,257. The inputs are sequences of 1024 consecutive tokens.
|
| 141 |
+
|
| 142 |
+
The larger model was trained on 256 cloud TPU v3 cores. The training duration was not disclosed, nor were the exact
|
| 143 |
+
details of training.
|
| 144 |
+
|
| 145 |
+
## Evaluation results
|
| 146 |
+
|
| 147 |
+
The model achieves the following results without any fine-tuning (zero-shot):
|
| 148 |
+
|
| 149 |
+
| Dataset | LAMBADA | LAMBADA | CBT-CN | CBT-NE | WikiText2 | PTB | enwiki8 | text8 | WikiText103 | 1BW |
|
| 150 |
+
|:--------:|:-------:|:-------:|:------:|:------:|:---------:|:------:|:-------:|:------:|:-----------:|:-----:|
|
| 151 |
+
| (metric) | (PPL) | (ACC) | (ACC) | (ACC) | (PPL) | (PPL) | (BPB) | (BPC) | (PPL) | (PPL) |
|
| 152 |
+
| | 35.13 | 45.99 | 87.65 | 83.4 | 29.41 | 65.85 | 1.16 | 1,17 | 37.50 | 75.20 |
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
### BibTeX entry and citation info
|
| 156 |
+
|
| 157 |
+
```bibtex
|
| 158 |
+
@article{radford2019language,
|
| 159 |
+
title={Language Models are Unsupervised Multitask Learners},
|
| 160 |
+
author={Radford, Alec and Wu, Jeff and Child, Rewon and Luan, David and Amodei, Dario and Sutskever, Ilya},
|
| 161 |
+
year={2019}
|
| 162 |
+
}
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
<a href="https://huggingface.co/exbert/?model=gpt2">
|
| 166 |
+
<img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
|
| 167 |
+
</a>
|
gpt2/fp16/macos27/h13c/checkpoint/config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GPT2LMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attn_pdrop": 0.1,
|
| 7 |
+
"bos_token_id": 50256,
|
| 8 |
+
"embd_pdrop": 0.1,
|
| 9 |
+
"eos_token_id": 50256,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"layer_norm_epsilon": 1e-05,
|
| 12 |
+
"model_type": "gpt2",
|
| 13 |
+
"n_ctx": 1024,
|
| 14 |
+
"n_embd": 768,
|
| 15 |
+
"n_head": 12,
|
| 16 |
+
"n_layer": 12,
|
| 17 |
+
"n_positions": 1024,
|
| 18 |
+
"resid_pdrop": 0.1,
|
| 19 |
+
"summary_activation": null,
|
| 20 |
+
"summary_first_dropout": 0.1,
|
| 21 |
+
"summary_proj_to_labels": true,
|
| 22 |
+
"summary_type": "cls_index",
|
| 23 |
+
"summary_use_proj": true,
|
| 24 |
+
"task_specific_params": {
|
| 25 |
+
"text-generation": {
|
| 26 |
+
"do_sample": true,
|
| 27 |
+
"max_length": 50
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"vocab_size": 50257
|
| 31 |
+
}
|
gpt2/fp16/macos27/h13c/checkpoint/generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 50256,
|
| 3 |
+
"eos_token_id": 50256,
|
| 4 |
+
"transformers_version": "4.26.0.dev0",
|
| 5 |
+
"_from_model_config": true
|
| 6 |
+
}
|
gpt2/fp16/macos27/h13c/checkpoint/merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gpt2/fp16/macos27/h13c/checkpoint/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8488bf4fdfaebb6cd9d174cee500ad21ee1046a3cbd9c7cbe2e41d61449d2ab5
|
| 3 |
+
size 78767816
|
gpt2/fp16/macos27/h13c/checkpoint/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gpt2/fp16/macos27/h13c/checkpoint/tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"model_max_length": 1024}
|
gpt2/fp16/macos27/h13c/checkpoint/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/Manifest.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"ANECompiler": "10.26.4",
|
| 3 |
+
"LLIRVersion": "0.1b",
|
| 4 |
+
"Weights": []
|
| 5 |
+
}
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w1_IenFJ1GSZFXtSI-1yaeozQ_0_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:72b1ddb17bceee949730caf0be57245d82ccaa6b6b05be7fed5ee0e2e9743fb9
|
| 3 |
+
size 467247
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w4_tmsSNgMGeI7V8itesd-A6w_1_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fab8796444f7e4f792c4a86390507623436b80a4762ab4fce9ba80f069e39bcf
|
| 3 |
+
size 517187
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w64_rSxzX4fSuqdOE7KVUvQgqQ_2_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d766f14120cf16584602c931413655fee26f6370b52e4a12891a990a955a53f9
|
| 3 |
+
size 560750
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c1024w8_iKsrfL2rNL8zQzdOUlUZ5Q_3_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c23eb7174c871a05706bad898be104a7f32afa6941ea0981c7850e1769195d90
|
| 3 |
+
size 517474
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c2048w4_6r0Zg1IUWQByvoxqvE5JtA_4_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79b9f157d61f2b9a51807637fef04c152b361a63746abc420219052f67a4d02c
|
| 3 |
+
size 524994
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c2048w64_8kfJfdrK5IyHrQXwlL11RQ_5_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:907fc52b71bc95a9b17f729f67aa0bb88d649a8a25035747284496785d7226d8
|
| 3 |
+
size 578849
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c2048w8_ZEzGbu2gIh24LhJW-EvsGQ_6_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:337e2ede50ac3675fc11a829794500497fa456964a49a4a884b0ce532ca80d72
|
| 3 |
+
size 528477
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w1_3Zihyom_ORiPUtOgoKqr6A_7_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3bcd016472283cf9b4b976bf6b67687bd821a928c19be441184c47efa35240c7
|
| 3 |
+
size 472129
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w4_6H47qaK-SzkD-kf-6d6_kQ_8_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1eb5504852efc2024f69e25351cad58b30b206f5b5df8b3bf3069996209343e1
|
| 3 |
+
size 541257
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ac800f4fa12d19fdcaaf56e6eebaba7656e8a80893a5ea80b564dbed3b3415b3
|
| 3 |
+
size 511431
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c256w8_Unl5vAsQ-msc7f8s9bV1pA_10_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:100ad5edec5f9ee5fd73f296b48d3a01669d00b0df537b7f52313ccc6817132a
|
| 3 |
+
size 550877
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c4096w4_IHI5-XpuRXZz3FXRdAu_aA_11_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1d40304be7e0397f107a5b1b2298a5ce0ef9f5bd936f554ca004535a2ab6500
|
| 3 |
+
size 521907
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c4096w64_GE5SuCbSnvhoodS8qBwgeQ_12_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a1bfbe32021261363bb8f83c8358d566519636c64fb24c8e16fe6961f44a7ad5
|
| 3 |
+
size 564017
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c4096w8_0TTYrpXDXLsLC2vUdt7lSQ_13_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a9546df35ee176f96a43050de1674b503b3982546ca77b0e45e7a55d8bc2beb7
|
| 3 |
+
size 522204
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w1_Ca3mWeEDniuKAzO_6YXkNQ_14_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd34a799031f39606ab437d6c20571269fe10435f5b53519a27c8fd009f3d97b
|
| 3 |
+
size 462930
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w4_iSKMLLpUuOodEuw_60CNcw_15_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e166c35ba97859a8267aaf2c0f642c1f6bba6d12ff462c094b8cc3b139667d3e
|
| 3 |
+
size 519016
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w64_MGtGd_9wfGYNW7kcppQJbg_16_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cda80f320499b2b1fa97b5a34b43228956eb92c1045101edba6bf6ded90fe145
|
| 3 |
+
size 546641
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c512w8_vTMI_EMMSc8g_5no4A9P1w_17_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8dbd788e2d8be4cff972ed4dfa7914bcf5a87343c2a0f1456551241acae4282
|
| 3 |
+
size 522998
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c8192w64_5JXamHMFTpqemXTAfCTWkg_18_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d5b6fe0cb760412331158bc2fd33ad3c47fc9e1089571962fdcb280912d8cee9
|
| 3 |
+
size 606269
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/binary_0.llir.bundle/gpt2_l0c256w64_0yMrxWXKCA6QYzi-5O0Rjw_9_ANE_region_0_0.bc/h13c/gpt2_l0c8192w8_yfcfcOxpejySNt_MNan-ww_19_ANE_region_0_0.mlir.bc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce4ecec3ebe3c39bdcc68dc222f36e61c037f65c6242e9774d1dfc7bed36ca0c
|
| 3 |
+
size 515340
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/manifest.plist
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/original_model_0.mpsgraph
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b644b4af34565c2e217c1b4d29fb70c537b54371e8cbcae4e12a34cad8f7e1e1
|
| 3 |
+
size 1464418
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/resources.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c3ef46813a5b75fd8454b5b58d17f509f8e7a14cb174050c062ad1c19265e04
|
| 3 |
+
size 170112728
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c-delegates/MPSGraph/mpsExecutable.mpsgraphpackage/specialized_model_1.mpsgraph
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07508161f9fb3ceb367888cddf8c7a708a826778f606d4023492486073dd9859
|
| 3 |
+
size 1365324
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main-h13c.mlirb
ADDED
|
Binary file (7.83 kB). View file
|
|
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/main.hash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
E�OC�pV�X���A�Q{kIVf�1=�
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/metadata.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assetVersion" : "2.0",
|
| 3 |
+
"creationDate" : "20261101T124042Z",
|
| 4 |
+
"producer" : "coreai-build-3600.83.1",
|
| 5 |
+
"sourceHash" : "D91F0F8EF9A3BE73EB32C90F9A614D0897C6057F8BF0447B6A08842884FA3A9B"
|
| 6 |
+
}
|
gpt2/fp16/macos27/h13c/decoder.h13c.aimodelc/stats.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"storageTypes":[{"name":"Float16","count":85056002},{"name":"UInt32","count":158},{"count":13,"name":"Int32"},{"count":2,"name":"Float32"},{"count":1,"name":"UInt64"}],"computeTypes":["Float16","Float32","Int32","UInt32","UInt64"],"operationDistribution":[{"name":"constant","count":5831},{"name":"transpose","count":1758},{"name":"add","count":1496},{"name":"broadcasting_add","count":1468},{"count":1410,"name":"reshape"},{"name":"broadcast_in_dims","count":1113},{"name":"conv2d","count":960},{"count":740,"name":"invoke"},{"name":"concat","count":500},{"count":268,"name":"broadcasting_divide"},{"name":"divide","count":268},{"name":"split","count":260},{"name":"gelu","count":240},{"count":44,"name":"cast"},{"name":"batch_matmul","count":40},{"name":"broadcasting_batch_matmul","count":40},{"count":40,"name":"mul"},{"name":"reduce","count":36},{"name":"broadcasting_mul","count":32},{"count":28,"name":"reduce_sum"},{"name":"exp","count":20},{"name":"softmax","count":20},{"name":"broadcast_to","count":16},{"count":8,"name":"broadcast_shapes"},{"count":8,"name":"gather_nd"},{"count":8,"name":"get_shape"},{"name":"reduce_mean","count":8},{"count":8,"name":"reduce_product"},{"name":"broadcasting_sub","count":4},{"name":"rsqrt","count":4},{"count":4,"name":"sub"}]}
|
gpt2/fp16/macos27/h13c/model.json
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"kind": "gpt2",
|
| 3 |
+
"version": 2,
|
| 4 |
+
"model": "gpt2",
|
| 5 |
+
"config": {
|
| 6 |
+
"hidden": 768,
|
| 7 |
+
"heads": 12,
|
| 8 |
+
"layers": 12,
|
| 9 |
+
"positions": 1024,
|
| 10 |
+
"vocab": 50257,
|
| 11 |
+
"eps": 1e-05,
|
| 12 |
+
"ffn": 3072
|
| 13 |
+
},
|
| 14 |
+
"capacities": [
|
| 15 |
+
256,
|
| 16 |
+
512,
|
| 17 |
+
1024
|
| 18 |
+
],
|
| 19 |
+
"prefill_width": 64,
|
| 20 |
+
"batch_sizes": [
|
| 21 |
+
1,
|
| 22 |
+
4,
|
| 23 |
+
8
|
| 24 |
+
],
|
| 25 |
+
"weights": "float16",
|
| 26 |
+
"assets": [
|
| 27 |
+
{
|
| 28 |
+
"asset": "decoder.h13c.aimodelc",
|
| 29 |
+
"source_hash": "d91f0f8ef9a3be73eb32c90f9a614d0897c6057f8bf0447b6a08842884fa3a9b",
|
| 30 |
+
"start": 0,
|
| 31 |
+
"end": 12,
|
| 32 |
+
"functions": [
|
| 33 |
+
"gpt2_l0c256w64",
|
| 34 |
+
"gpt2_l0c256w1",
|
| 35 |
+
"gpt2_l0c512w64",
|
| 36 |
+
"gpt2_l0c512w1",
|
| 37 |
+
"gpt2_l0c1024w64",
|
| 38 |
+
"gpt2_l0c1024w1",
|
| 39 |
+
"gpt2_l0c256w4",
|
| 40 |
+
"gpt2_l0c512w4",
|
| 41 |
+
"gpt2_l0c1024w4",
|
| 42 |
+
"gpt2_l0c2048w64",
|
| 43 |
+
"gpt2_l0c2048w4",
|
| 44 |
+
"gpt2_l0c4096w64",
|
| 45 |
+
"gpt2_l0c4096w4",
|
| 46 |
+
"gpt2_l0c256w8",
|
| 47 |
+
"gpt2_l0c512w8",
|
| 48 |
+
"gpt2_l0c1024w8",
|
| 49 |
+
"gpt2_l0c2048w8",
|
| 50 |
+
"gpt2_l0c4096w8",
|
| 51 |
+
"gpt2_l0c8192w64",
|
| 52 |
+
"gpt2_l0c8192w8"
|
| 53 |
+
],
|
| 54 |
+
"cache_functions": [
|
| 55 |
+
{
|
| 56 |
+
"name": "gpt2_l0c256w64",
|
| 57 |
+
"capacity": 256,
|
| 58 |
+
"width": 64,
|
| 59 |
+
"batch": 1
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"name": "gpt2_l0c256w1",
|
| 63 |
+
"capacity": 256,
|
| 64 |
+
"width": 1,
|
| 65 |
+
"batch": 1
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"name": "gpt2_l0c512w64",
|
| 69 |
+
"capacity": 512,
|
| 70 |
+
"width": 64,
|
| 71 |
+
"batch": 1
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "gpt2_l0c512w1",
|
| 75 |
+
"capacity": 512,
|
| 76 |
+
"width": 1,
|
| 77 |
+
"batch": 1
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"name": "gpt2_l0c1024w64",
|
| 81 |
+
"capacity": 1024,
|
| 82 |
+
"width": 64,
|
| 83 |
+
"batch": 1
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"name": "gpt2_l0c1024w1",
|
| 87 |
+
"capacity": 1024,
|
| 88 |
+
"width": 1,
|
| 89 |
+
"batch": 1
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"name": "gpt2_l0c256w64",
|
| 93 |
+
"capacity": 256,
|
| 94 |
+
"width": 64,
|
| 95 |
+
"batch": 4
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"name": "gpt2_l0c256w4",
|
| 99 |
+
"capacity": 256,
|
| 100 |
+
"width": 4,
|
| 101 |
+
"batch": 4
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"name": "gpt2_l0c512w64",
|
| 105 |
+
"capacity": 512,
|
| 106 |
+
"width": 64,
|
| 107 |
+
"batch": 4
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"name": "gpt2_l0c512w4",
|
| 111 |
+
"capacity": 512,
|
| 112 |
+
"width": 4,
|
| 113 |
+
"batch": 4
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"name": "gpt2_l0c1024w64",
|
| 117 |
+
"capacity": 1024,
|
| 118 |
+
"width": 64,
|
| 119 |
+
"batch": 4
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"name": "gpt2_l0c1024w4",
|
| 123 |
+
"capacity": 1024,
|
| 124 |
+
"width": 4,
|
| 125 |
+
"batch": 4
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"name": "gpt2_l0c2048w64",
|
| 129 |
+
"capacity": 2048,
|
| 130 |
+
"width": 64,
|
| 131 |
+
"batch": 4
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"name": "gpt2_l0c2048w4",
|
| 135 |
+
"capacity": 2048,
|
| 136 |
+
"width": 4,
|
| 137 |
+
"batch": 4
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"name": "gpt2_l0c4096w64",
|
| 141 |
+
"capacity": 4096,
|
| 142 |
+
"width": 64,
|
| 143 |
+
"batch": 4
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"name": "gpt2_l0c4096w4",
|
| 147 |
+
"capacity": 4096,
|
| 148 |
+
"width": 4,
|
| 149 |
+
"batch": 4
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"name": "gpt2_l0c256w64",
|
| 153 |
+
"capacity": 256,
|
| 154 |
+
"width": 64,
|
| 155 |
+
"batch": 8
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"name": "gpt2_l0c256w8",
|
| 159 |
+
"capacity": 256,
|
| 160 |
+
"width": 8,
|
| 161 |
+
"batch": 8
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"name": "gpt2_l0c512w64",
|
| 165 |
+
"capacity": 512,
|
| 166 |
+
"width": 64,
|
| 167 |
+
"batch": 8
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"name": "gpt2_l0c512w8",
|
| 171 |
+
"capacity": 512,
|
| 172 |
+
"width": 8,
|
| 173 |
+
"batch": 8
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"name": "gpt2_l0c1024w64",
|
| 177 |
+
"capacity": 1024,
|
| 178 |
+
"width": 64,
|
| 179 |
+
"batch": 8
|
| 180 |
+
},
|
| 181 |
+
{
|
| 182 |
+
"name": "gpt2_l0c1024w8",
|
| 183 |
+
"capacity": 1024,
|
| 184 |
+
"width": 8,
|
| 185 |
+
"batch": 8
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"name": "gpt2_l0c2048w64",
|
| 189 |
+
"capacity": 2048,
|
| 190 |
+
"width": 64,
|
| 191 |
+
"batch": 8
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"name": "gpt2_l0c2048w8",
|
| 195 |
+
"capacity": 2048,
|
| 196 |
+
"width": 8,
|
| 197 |
+
"batch": 8
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"name": "gpt2_l0c4096w64",
|
| 201 |
+
"capacity": 4096,
|
| 202 |
+
"width": 64,
|
| 203 |
+
"batch": 8
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"name": "gpt2_l0c4096w8",
|
| 207 |
+
"capacity": 4096,
|
| 208 |
+
"width": 8,
|
| 209 |
+
"batch": 8
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"name": "gpt2_l0c8192w64",
|
| 213 |
+
"capacity": 8192,
|
| 214 |
+
"width": 64,
|
| 215 |
+
"batch": 8
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"name": "gpt2_l0c8192w8",
|
| 219 |
+
"capacity": 8192,
|
| 220 |
+
"width": 8,
|
| 221 |
+
"batch": 8
|
| 222 |
+
}
|
| 223 |
+
]
|
| 224 |
+
}
|
| 225 |
+
],
|
| 226 |
+
"checkpoint_hash": "e422f60580cb6e7a458de329e2ff44690428afe1ab145e6d562a004f42aed985",
|
| 227 |
+
"source": {
|
| 228 |
+
"repo": "openai-community/gpt2",
|
| 229 |
+
"revision": "607a30d783dfa663caf39e06633721c8d4cfcd7e"
|
| 230 |
+
},
|
| 231 |
+
"architecture": "h13c",
|
| 232 |
+
"min_os": "27.0",
|
| 233 |
+
"deployment": "aot-staged"
|
| 234 |
+
}
|
gpt2/fp16/macos27/h13d/checkpoint/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- exbert
|
| 5 |
+
|
| 6 |
+
license: mit
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# GPT-2
|
| 11 |
+
|
| 12 |
+
Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large
|
| 13 |
+
|
| 14 |
+
Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in
|
| 15 |
+
[this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
|
| 16 |
+
and first released at [this page](https://openai.com/blog/better-language-models/).
|
| 17 |
+
|
| 18 |
+
Disclaimer: The team releasing GPT-2 also wrote a
|
| 19 |
+
[model card](https://github.com/openai/gpt-2/blob/master/model_card.md) for their model. Content from this model card
|
| 20 |
+
has been written by the Hugging Face team to complete the information they provided and give specific examples of bias.
|
| 21 |
+
|
| 22 |
+
## Model description
|
| 23 |
+
|
| 24 |
+
GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This
|
| 25 |
+
means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots
|
| 26 |
+
of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely,
|
| 27 |
+
it was trained to guess the next word in sentences.
|
| 28 |
+
|
| 29 |
+
More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence,
|
| 30 |
+
shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the
|
| 31 |
+
predictions for the token `i` only uses the inputs from `1` to `i` but not the future tokens.
|
| 32 |
+
|
| 33 |
+
This way, the model learns an inner representation of the English language that can then be used to extract features
|
| 34 |
+
useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a
|
| 35 |
+
prompt.
|
| 36 |
+
|
| 37 |
+
This is the **smallest** version of GPT-2, with 124M parameters.
|
| 38 |
+
|
| 39 |
+
**Related Models:** [GPT-Large](https://huggingface.co/gpt2-large), [GPT-Medium](https://huggingface.co/gpt2-medium) and [GPT-XL](https://huggingface.co/gpt2-xl)
|
| 40 |
+
|
| 41 |
+
## Intended uses & limitations
|
| 42 |
+
|
| 43 |
+
You can use the raw model for text generation or fine-tune it to a downstream task. See the
|
| 44 |
+
[model hub](https://huggingface.co/models?filter=gpt2) to look for fine-tuned versions on a task that interests you.
|
| 45 |
+
|
| 46 |
+
### How to use
|
| 47 |
+
|
| 48 |
+
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
|
| 49 |
+
set a seed for reproducibility:
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
>>> from transformers import pipeline, set_seed
|
| 53 |
+
>>> generator = pipeline('text-generation', model='gpt2')
|
| 54 |
+
>>> set_seed(42)
|
| 55 |
+
>>> generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5)
|
| 56 |
+
|
| 57 |
+
[{'generated_text': "Hello, I'm a language model, a language for thinking, a language for expressing thoughts."},
|
| 58 |
+
{'generated_text': "Hello, I'm a language model, a compiler, a compiler library, I just want to know how I build this kind of stuff. I don"},
|
| 59 |
+
{'generated_text': "Hello, I'm a language model, and also have more than a few of your own, but I understand that they're going to need some help"},
|
| 60 |
+
{'generated_text': "Hello, I'm a language model, a system model. I want to know my language so that it might be more interesting, more user-friendly"},
|
| 61 |
+
{'generated_text': 'Hello, I\'m a language model, not a language model"\n\nThe concept of "no-tricks" comes in handy later with new'}]
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
from transformers import GPT2Tokenizer, GPT2Model
|
| 68 |
+
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 69 |
+
model = GPT2Model.from_pretrained('gpt2')
|
| 70 |
+
text = "Replace me by any text you'd like."
|
| 71 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
| 72 |
+
output = model(**encoded_input)
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
and in TensorFlow:
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from transformers import GPT2Tokenizer, TFGPT2Model
|
| 79 |
+
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 80 |
+
model = TFGPT2Model.from_pretrained('gpt2')
|
| 81 |
+
text = "Replace me by any text you'd like."
|
| 82 |
+
encoded_input = tokenizer(text, return_tensors='tf')
|
| 83 |
+
output = model(encoded_input)
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
### Limitations and bias
|
| 87 |
+
|
| 88 |
+
The training data used for this model has not been released as a dataset one can browse. We know it contains a lot of
|
| 89 |
+
unfiltered content from the internet, which is far from neutral. As the openAI team themselves point out in their
|
| 90 |
+
[model card](https://github.com/openai/gpt-2/blob/master/model_card.md#out-of-scope-use-cases):
|
| 91 |
+
|
| 92 |
+
> Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don’t support use-cases
|
| 93 |
+
> that require the generated text to be true.
|
| 94 |
+
>
|
| 95 |
+
> Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do
|
| 96 |
+
> not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a
|
| 97 |
+
> study of biases relevant to the intended use-case. We found no statistically significant difference in gender, race,
|
| 98 |
+
> and religious bias probes between 774M and 1.5B, implying all versions of GPT-2 should be approached with similar
|
| 99 |
+
> levels of caution around use cases that are sensitive to biases around human attributes.
|
| 100 |
+
|
| 101 |
+
Here's an example of how the model can have biased predictions:
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
>>> from transformers import pipeline, set_seed
|
| 105 |
+
>>> generator = pipeline('text-generation', model='gpt2')
|
| 106 |
+
>>> set_seed(42)
|
| 107 |
+
>>> generator("The White man worked as a", max_length=10, num_return_sequences=5)
|
| 108 |
+
|
| 109 |
+
[{'generated_text': 'The White man worked as a mannequin for'},
|
| 110 |
+
{'generated_text': 'The White man worked as a maniser of the'},
|
| 111 |
+
{'generated_text': 'The White man worked as a bus conductor by day'},
|
| 112 |
+
{'generated_text': 'The White man worked as a plumber at the'},
|
| 113 |
+
{'generated_text': 'The White man worked as a journalist. He had'}]
|
| 114 |
+
|
| 115 |
+
>>> set_seed(42)
|
| 116 |
+
>>> generator("The Black man worked as a", max_length=10, num_return_sequences=5)
|
| 117 |
+
|
| 118 |
+
[{'generated_text': 'The Black man worked as a man at a restaurant'},
|
| 119 |
+
{'generated_text': 'The Black man worked as a car salesman in a'},
|
| 120 |
+
{'generated_text': 'The Black man worked as a police sergeant at the'},
|
| 121 |
+
{'generated_text': 'The Black man worked as a man-eating monster'},
|
| 122 |
+
{'generated_text': 'The Black man worked as a slave, and was'}]
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
This bias will also affect all fine-tuned versions of this model.
|
| 126 |
+
|
| 127 |
+
## Training data
|
| 128 |
+
|
| 129 |
+
The OpenAI team wanted to train this model on a corpus as large as possible. To build it, they scraped all the web
|
| 130 |
+
pages from outbound links on Reddit which received at least 3 karma. Note that all Wikipedia pages were removed from
|
| 131 |
+
this dataset, so the model was not trained on any part of Wikipedia. The resulting dataset (called WebText) weights
|
| 132 |
+
40GB of texts but has not been publicly released. You can find a list of the top 1,000 domains present in WebText
|
| 133 |
+
[here](https://github.com/openai/gpt-2/blob/master/domains.txt).
|
| 134 |
+
|
| 135 |
+
## Training procedure
|
| 136 |
+
|
| 137 |
+
### Preprocessing
|
| 138 |
+
|
| 139 |
+
The texts are tokenized using a byte-level version of Byte Pair Encoding (BPE) (for unicode characters) and a
|
| 140 |
+
vocabulary size of 50,257. The inputs are sequences of 1024 consecutive tokens.
|
| 141 |
+
|
| 142 |
+
The larger model was trained on 256 cloud TPU v3 cores. The training duration was not disclosed, nor were the exact
|
| 143 |
+
details of training.
|
| 144 |
+
|
| 145 |
+
## Evaluation results
|
| 146 |
+
|
| 147 |
+
The model achieves the following results without any fine-tuning (zero-shot):
|
| 148 |
+
|
| 149 |
+
| Dataset | LAMBADA | LAMBADA | CBT-CN | CBT-NE | WikiText2 | PTB | enwiki8 | text8 | WikiText103 | 1BW |
|
| 150 |
+
|:--------:|:-------:|:-------:|:------:|:------:|:---------:|:------:|:-------:|:------:|:-----------:|:-----:|
|
| 151 |
+
| (metric) | (PPL) | (ACC) | (ACC) | (ACC) | (PPL) | (PPL) | (BPB) | (BPC) | (PPL) | (PPL) |
|
| 152 |
+
| | 35.13 | 45.99 | 87.65 | 83.4 | 29.41 | 65.85 | 1.16 | 1,17 | 37.50 | 75.20 |
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
### BibTeX entry and citation info
|
| 156 |
+
|
| 157 |
+
```bibtex
|
| 158 |
+
@article{radford2019language,
|
| 159 |
+
title={Language Models are Unsupervised Multitask Learners},
|
| 160 |
+
author={Radford, Alec and Wu, Jeff and Child, Rewon and Luan, David and Amodei, Dario and Sutskever, Ilya},
|
| 161 |
+
year={2019}
|
| 162 |
+
}
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
<a href="https://huggingface.co/exbert/?model=gpt2">
|
| 166 |
+
<img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
|
| 167 |
+
</a>
|
gpt2/fp16/macos27/h13d/checkpoint/config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GPT2LMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attn_pdrop": 0.1,
|
| 7 |
+
"bos_token_id": 50256,
|
| 8 |
+
"embd_pdrop": 0.1,
|
| 9 |
+
"eos_token_id": 50256,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"layer_norm_epsilon": 1e-05,
|
| 12 |
+
"model_type": "gpt2",
|
| 13 |
+
"n_ctx": 1024,
|
| 14 |
+
"n_embd": 768,
|
| 15 |
+
"n_head": 12,
|
| 16 |
+
"n_layer": 12,
|
| 17 |
+
"n_positions": 1024,
|
| 18 |
+
"resid_pdrop": 0.1,
|
| 19 |
+
"summary_activation": null,
|
| 20 |
+
"summary_first_dropout": 0.1,
|
| 21 |
+
"summary_proj_to_labels": true,
|
| 22 |
+
"summary_type": "cls_index",
|
| 23 |
+
"summary_use_proj": true,
|
| 24 |
+
"task_specific_params": {
|
| 25 |
+
"text-generation": {
|
| 26 |
+
"do_sample": true,
|
| 27 |
+
"max_length": 50
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"vocab_size": 50257
|
| 31 |
+
}
|
gpt2/fp16/macos27/h13d/checkpoint/generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 50256,
|
| 3 |
+
"eos_token_id": 50256,
|
| 4 |
+
"transformers_version": "4.26.0.dev0",
|
| 5 |
+
"_from_model_config": true
|
| 6 |
+
}
|