Skip to content
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

Have problems with export.py with a lot of models. #550

Open
mikechambers84 opened this issue Feb 23, 2025 · 0 comments
Open

Have problems with export.py with a lot of models. #550

mikechambers84 opened this issue Feb 23, 2025 · 0 comments

Comments

@mikechambers84
Copy link

mikechambers84 commented Feb 23, 2025

Here's an example. It's this 50k TinyStories model from HF.

https://huggingface.co/delphi-suite/stories-llama2-50k

C:\git\llama2.c>export.py stories-llama2-50k.bin --version 2 --hf stories-llama2-50k
Traceback (most recent call last):
  File "C:\git\llama2.c\export.py", line 561, in <module>
    model = load_hf_model(args.hf)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\git\llama2.c\export.py", line 475, in load_hf_model
    layer.attention.wk.weight = nn.Parameter(permute_reverse(hf_dict[f'model.layers.{i}.self_attn.k_proj.weight']))
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\git\llama2.c\export.py", line 469, in permute_reverse
    return w.view(n_heads, 2, dim1 // n_heads // 2, dim2).transpose(1, 2).reshape(dim1, dim2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: shape '[3, 2, 1, 6]' is invalid for input of size 12

I've also converted some other models, apparently successfully, but they either don't work properly (like outputting garbage tokens) in llama2.c, or even outright crash it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant