-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GPT-2] Convert h5 to ggml #35
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From what I saw the model uses names the variables differently from the original model:
|
It worked mapping the tensors correctly :D result:
|
Cool! |
Done 👍 |
ggerganov
approved these changes
Mar 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I adapted the GPT-J example script to convert a Portuguese fine-tuned GPT2 model in h5 format to ggml.
full conversion log:
Some weights of the model checkpoint at /Volumes/Documentos/Models/gpt2-small-portuguese were not used when initializing GPT2Model: ['lm_head.weight']
Processing variable: wte.weight with shape: (50257, 768)
Processing variable: wpe.weight with shape: (1024, 768)
Processing variable: h.0.ln_1.weight with shape: (768,)
Processing variable: h.0.ln_1.bias with shape: (768,)
Processing variable: h.0.attn.bias with shape: (1024, 1024)
Skipping variable: h.0.attn.bias
Processing variable: h.0.attn.masked_bias with shape: ()
Skipping variable: h.0.attn.masked_bias
Processing variable: h.0.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.0.attn.c_attn.bias with shape: (2304,)
Processing variable: h.0.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.0.attn.c_proj.bias with shape: (768,)
Processing variable: h.0.ln_2.weight with shape: (768,)
Processing variable: h.0.ln_2.bias with shape: (768,)
Processing variable: h.0.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.0.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.0.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.0.mlp.c_proj.bias with shape: (768,)
Processing variable: h.1.ln_1.weight with shape: (768,)
Processing variable: h.1.ln_1.bias with shape: (768,)
Processing variable: h.1.attn.bias with shape: (1024, 1024)
Skipping variable: h.1.attn.bias
Processing variable: h.1.attn.masked_bias with shape: ()
Skipping variable: h.1.attn.masked_bias
Processing variable: h.1.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.1.attn.c_attn.bias with shape: (2304,)
Processing variable: h.1.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.1.attn.c_proj.bias with shape: (768,)
Processing variable: h.1.ln_2.weight with shape: (768,)
Processing variable: h.1.ln_2.bias with shape: (768,)
Processing variable: h.1.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.1.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.1.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.1.mlp.c_proj.bias with shape: (768,)
Processing variable: h.2.ln_1.weight with shape: (768,)
Processing variable: h.2.ln_1.bias with shape: (768,)
Processing variable: h.2.attn.bias with shape: (1024, 1024)
Skipping variable: h.2.attn.bias
Processing variable: h.2.attn.masked_bias with shape: ()
Skipping variable: h.2.attn.masked_bias
Processing variable: h.2.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.2.attn.c_attn.bias with shape: (2304,)
Processing variable: h.2.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.2.attn.c_proj.bias with shape: (768,)
Processing variable: h.2.ln_2.weight with shape: (768,)
Processing variable: h.2.ln_2.bias with shape: (768,)
Processing variable: h.2.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.2.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.2.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.2.mlp.c_proj.bias with shape: (768,)
Processing variable: h.3.ln_1.weight with shape: (768,)
Processing variable: h.3.ln_1.bias with shape: (768,)
Processing variable: h.3.attn.bias with shape: (1024, 1024)
Skipping variable: h.3.attn.bias
Processing variable: h.3.attn.masked_bias with shape: ()
Skipping variable: h.3.attn.masked_bias
Processing variable: h.3.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.3.attn.c_attn.bias with shape: (2304,)
Processing variable: h.3.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.3.attn.c_proj.bias with shape: (768,)
Processing variable: h.3.ln_2.weight with shape: (768,)
Processing variable: h.3.ln_2.bias with shape: (768,)
Processing variable: h.3.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.3.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.3.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.3.mlp.c_proj.bias with shape: (768,)
Processing variable: h.4.ln_1.weight with shape: (768,)
Processing variable: h.4.ln_1.bias with shape: (768,)
Processing variable: h.4.attn.bias with shape: (1024, 1024)
Skipping variable: h.4.attn.bias
Processing variable: h.4.attn.masked_bias with shape: ()
Skipping variable: h.4.attn.masked_bias
Processing variable: h.4.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.4.attn.c_attn.bias with shape: (2304,)
Processing variable: h.4.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.4.attn.c_proj.bias with shape: (768,)
Processing variable: h.4.ln_2.weight with shape: (768,)
Processing variable: h.4.ln_2.bias with shape: (768,)
Processing variable: h.4.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.4.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.4.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.4.mlp.c_proj.bias with shape: (768,)
Processing variable: h.5.ln_1.weight with shape: (768,)
Processing variable: h.5.ln_1.bias with shape: (768,)
Processing variable: h.5.attn.bias with shape: (1024, 1024)
Skipping variable: h.5.attn.bias
Processing variable: h.5.attn.masked_bias with shape: ()
Skipping variable: h.5.attn.masked_bias
Processing variable: h.5.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.5.attn.c_attn.bias with shape: (2304,)
Processing variable: h.5.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.5.attn.c_proj.bias with shape: (768,)
Processing variable: h.5.ln_2.weight with shape: (768,)
Processing variable: h.5.ln_2.bias with shape: (768,)
Processing variable: h.5.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.5.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.5.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.5.mlp.c_proj.bias with shape: (768,)
Processing variable: h.6.ln_1.weight with shape: (768,)
Processing variable: h.6.ln_1.bias with shape: (768,)
Processing variable: h.6.attn.bias with shape: (1024, 1024)
Skipping variable: h.6.attn.bias
Processing variable: h.6.attn.masked_bias with shape: ()
Skipping variable: h.6.attn.masked_bias
Processing variable: h.6.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.6.attn.c_attn.bias with shape: (2304,)
Processing variable: h.6.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.6.attn.c_proj.bias with shape: (768,)
Processing variable: h.6.ln_2.weight with shape: (768,)
Processing variable: h.6.ln_2.bias with shape: (768,)
Processing variable: h.6.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.6.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.6.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.6.mlp.c_proj.bias with shape: (768,)
Processing variable: h.7.ln_1.weight with shape: (768,)
Processing variable: h.7.ln_1.bias with shape: (768,)
Processing variable: h.7.attn.bias with shape: (1024, 1024)
Skipping variable: h.7.attn.bias
Processing variable: h.7.attn.masked_bias with shape: ()
Skipping variable: h.7.attn.masked_bias
Processing variable: h.7.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.7.attn.c_attn.bias with shape: (2304,)
Processing variable: h.7.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.7.attn.c_proj.bias with shape: (768,)
Processing variable: h.7.ln_2.weight with shape: (768,)
Processing variable: h.7.ln_2.bias with shape: (768,)
Processing variable: h.7.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.7.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.7.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.7.mlp.c_proj.bias with shape: (768,)
Processing variable: h.8.ln_1.weight with shape: (768,)
Processing variable: h.8.ln_1.bias with shape: (768,)
Processing variable: h.8.attn.bias with shape: (1024, 1024)
Skipping variable: h.8.attn.bias
Processing variable: h.8.attn.masked_bias with shape: ()
Skipping variable: h.8.attn.masked_bias
Processing variable: h.8.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.8.attn.c_attn.bias with shape: (2304,)
Processing variable: h.8.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.8.attn.c_proj.bias with shape: (768,)
Processing variable: h.8.ln_2.weight with shape: (768,)
Processing variable: h.8.ln_2.bias with shape: (768,)
Processing variable: h.8.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.8.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.8.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.8.mlp.c_proj.bias with shape: (768,)
Processing variable: h.9.ln_1.weight with shape: (768,)
Processing variable: h.9.ln_1.bias with shape: (768,)
Processing variable: h.9.attn.bias with shape: (1024, 1024)
Skipping variable: h.9.attn.bias
Processing variable: h.9.attn.masked_bias with shape: ()
Skipping variable: h.9.attn.masked_bias
Processing variable: h.9.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.9.attn.c_attn.bias with shape: (2304,)
Processing variable: h.9.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.9.attn.c_proj.bias with shape: (768,)
Processing variable: h.9.ln_2.weight with shape: (768,)
Processing variable: h.9.ln_2.bias with shape: (768,)
Processing variable: h.9.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.9.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.9.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.9.mlp.c_proj.bias with shape: (768,)
Processing variable: h.10.ln_1.weight with shape: (768,)
Processing variable: h.10.ln_1.bias with shape: (768,)
Processing variable: h.10.attn.bias with shape: (1024, 1024)
Skipping variable: h.10.attn.bias
Processing variable: h.10.attn.masked_bias with shape: ()
Skipping variable: h.10.attn.masked_bias
Processing variable: h.10.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.10.attn.c_attn.bias with shape: (2304,)
Processing variable: h.10.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.10.attn.c_proj.bias with shape: (768,)
Processing variable: h.10.ln_2.weight with shape: (768,)
Processing variable: h.10.ln_2.bias with shape: (768,)
Processing variable: h.10.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.10.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.10.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.10.mlp.c_proj.bias with shape: (768,)
Processing variable: h.11.ln_1.weight with shape: (768,)
Processing variable: h.11.ln_1.bias with shape: (768,)
Processing variable: h.11.attn.bias with shape: (1024, 1024)
Skipping variable: h.11.attn.bias
Processing variable: h.11.attn.masked_bias with shape: ()
Skipping variable: h.11.attn.masked_bias
Processing variable: h.11.attn.c_attn.weight with shape: (768, 2304)
Processing variable: h.11.attn.c_attn.bias with shape: (2304,)
Processing variable: h.11.attn.c_proj.weight with shape: (768, 768)
Processing variable: h.11.attn.c_proj.bias with shape: (768,)
Processing variable: h.11.ln_2.weight with shape: (768,)
Processing variable: h.11.ln_2.bias with shape: (768,)
Processing variable: h.11.mlp.c_fc.weight with shape: (768, 3072)
Processing variable: h.11.mlp.c_fc.bias with shape: (3072,)
Processing variable: h.11.mlp.c_proj.weight with shape: (3072, 768)
Processing variable: h.11.mlp.c_proj.bias with shape: (768,)
Processing variable: ln_f.weight with shape: (768,)
Processing variable: ln_f.bias with shape: (768,)
Done. Output file: /Volumes/Documentos/Models/gpt2-small-portuguese/ggml-model-f32.bin```
At this time this is not done, when I try inference using converted model I get this error:
gpt2_model_load: unknown tensor 'wte.weight' in model file