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

Llama 3.1 support please? #1745

Closed
BBC-Esq opened this issue Jul 24, 2024 · 2 comments · Fixed by #1751
Closed

Llama 3.1 support please? #1745

BBC-Esq opened this issue Jul 24, 2024 · 2 comments · Fixed by #1751
Labels
enhancement New feature or request

Comments

@BBC-Esq
Copy link

BBC-Esq commented Jul 24, 2024

Hello again, if you plan on supporting LLama3.1 please note that it requires a new category of ROPE scaling. Thanks!

https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct/blob/main/config.json

@avan06
Copy link

avan06 commented Jul 24, 2024

I noticed that Llama-3.1 has a rope_scaling parameter set in config.json, and it has also changed the field name for type to rope_type. Moreover, the rope_scaling parameter in the previous Llama-3 was null.

  "rope_scaling": {
    "factor": 8.0,
    "low_freq_factor": 1.0,
    "high_freq_factor": 4.0,
    "original_max_position_embeddings": 8192,
    "rope_type": "llama3"
  },

This causes an error in the conversion process of "ctranslate2\converters\transformers.py" whenever it reads rope_scaling["type"]. However, this can be easily fixed by writing the code as follows:

rope_type = rope_scaling["rope_type"] if "rope_type" in rope_scaling else rope_scaling["type"]
rotary_scaling_type = _SUPPORTED_ROPE_SCALING.get(rope_type)

But this is not entirely sufficient because the RoPE scaling for Llama-3 has not been implemented. Thus, during the conversion, the following error occurs:

NotImplementedError: RoPE scaling type 'llama3' is not yet implemented. The following RoPE scaling types are currently supported: linear, su

I don't know how to implement it, but for those who are interested, you can refer to the implementation in transformers:
https://github.com/huggingface/transformers/blob/1c122a46dc3c4448901f8d2f3018d9d58b846ba5/src/transformers/modeling_rope_utils.py#L298

@minhthuc2502 minhthuc2502 added the enhancement New feature or request label Jul 26, 2024
@BBC-Esq
Copy link
Author

BBC-Esq commented Jul 27, 2024

Also, here's the proposed (WIP) implementation with llamacpp if it also helps:

ggerganov/llama.cpp@b5e9546

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

Successfully merging a pull request may close this issue.

3 participants