Skip to content

Support Qwen2 #149

Closed
Closed

Description

@songkq

Hi, do you have plan to support Qwen2 training acceleration?

From transformers >= 4.37.0:
https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/models/qwen2/modeling_qwen2.py

Activity

  1. danielhanchen commented on Feb 3, 2024

    @danielhanchen
    Member

    @songkq Oh it should be supported if you use Llama-Factory's llamafy script. Ie maybe try https://huggingface.co/models?search=qwen%20llama. On the other hand, if some don't exist, you can try out Llama-Factory's script to convert Qwen to a Llama arch!

  2. added
    fixed - pending confirmation
    on Feb 3, 2024
  3. songkq commented on Feb 8, 2024

    @songkq
    Author

    @danielhanchen Yeah. It works.

    But Unsloth cannot patch Attention layers with our manual autograd engine since either LoRA adapters are not enabled or a bias term (like in Qwen) is used.
    Unsloth cannot patch O projection layer with our manual autograd engine since either LoRA adapters are not enabled or a bias term (like in Qwen) is used.
    Unsloth 2024.1 patched 40 layers with 0 QKV layers, 0 O layers and 40 MLP layers.

    Do you have plan to support Qwen2 completely?

  4. danielhanchen commented on Feb 8, 2024

    @danielhanchen
    Member

    @songkq Oh wait actually on further investigation Qwen 1.5 / 2 has combined sliding window and normal attention right - I think on shorter context windows it works, but larger ones I don't think I made it work (yet). On biases in QKV - I'll see what I can do for a future release for biases!

  5. NilanEkanayake commented on Feb 10, 2024

    @NilanEkanayake

    @danielhanchen Yeah. It works.

    But Unsloth cannot patch Attention layers with our manual autograd engine since either LoRA adapters are not enabled or a bias term (like in Qwen) is used. Unsloth cannot patch O projection layer with our manual autograd engine since either LoRA adapters are not enabled or a bias term (like in Qwen) is used. Unsloth 2024.1 patched 40 layers with 0 QKV layers, 0 O layers and 40 MLP layers.

    Do you have plan to support Qwen2 completely?

    How did you convert the Qwen1.5/2 models to llama format?

  6. danielhanchen commented on Feb 11, 2024

    @danielhanchen
    Member

    @NilanEkanayake So there are some pre converted Qwen models on HuggingFace if you search for "qwen llama".

    In terms of Qwen 1.5 / 2 - if it's a top feature request, I can add it in natively into Unsloth :)

  7. Minami-su commented on Feb 14, 2024

    @Minami-su

    @NilanEkanayake So there are some pre converted Qwen models on HuggingFace if you search for "qwen llama".

    In terms of Qwen 1.5 / 2 - if it's a top feature request, I can add it in natively into Unsloth :)

    Please,add qwen1.5/2,need it.

  8. Minami-su commented on Feb 14, 2024

    @Minami-su

    @songkq Oh it should be supported if you use Llama-Factory's llamafy script. Ie maybe try https://huggingface.co/models?search=qwen%20llama. On the other hand, if some don't exist, you can try out Llama-Factory's script to convert Qwen to a Llama arch!

    First, there is no code to convert Qwen 1.5 to Llama; Only the code that changed from Qwen to Llama. Second, the lamafied model has a lot to lose.

  9. Minami-su commented on Feb 14, 2024

    @Minami-su

    @songkq Oh it should be supported if you use Llama-Factory's llamafy script. Ie maybe try https://huggingface.co/models?search=qwen%20llama. On the other hand, if some don't exist, you can try out Llama-Factory's script to convert Qwen to a Llama arch!

    First, there is no code to convert Qwen 1.5 to Llama; Only the code that changed from Qwen to Llama. Second, the lamafied model has a lot to lose.

    image

  10. added
    feature request
    and removed
    fixed - pending confirmation
    on Feb 15, 2024
  11. danielhanchen commented on Feb 15, 2024

    @danielhanchen
    Member

    @Minami-su Oh interesting llama-fying it made it worse? That's very unexpected

  12. danielhanchen commented on Feb 15, 2024

    @danielhanchen
    Member

    I'll see what I can do for Qwen 1.5/2 :))

  13. whyiug commented on Apr 19, 2024

    @whyiug

    Are you still doing the work? Hope to see any progress. @danielhanchen

  14. danielhanchen commented on Apr 21, 2024

    @danielhanchen
    Member

    @whyiug Hmmm I'm expecting most people to move over to Llama-3 - unless if Qwen is still needed by the community, I can work on it, but generally Llama-3 is SOTA for now

  15. johnmai-dev commented on Apr 27, 2024

    @johnmai-dev

    Looking forward to supporting Qwen1.5

    image

  16. songkq commented on Apr 30, 2024

    @songkq
    Author

    @whyiug Hmmm I'm expecting most people to move over to Llama-3 - unless if Qwen is still needed by the community, I can work on it, but generally Llama-3 is SOTA for now

    @danielhanchen Hi, considering that Qwen is one of the most popular SOTA LLMs that support Chinese, it's worth to support it in unsloth.

  17. danielhanchen commented on May 1, 2024

    @danielhanchen
    Member

    Can take another look at Qwen!

  18. danielhanchen commented on May 16, 2024

    @danielhanchen
    Member

    So sorry on the delay @maiqingqiang @whyiug @songkq @Minami-su

    Just added it in via a new PR by someone!

    If you're on a local machine, please update Unsloth via

    pip uninstall unsloth -y
    pip install --upgrade --force-reinstall --no-cache-dir git+https://github.com/unslothai/unsloth.git
    

    Colab and Kaggle is fine (just restart it)

  19. added
    fixed - pending confirmation
    on May 16, 2024
  20. 141forever commented on May 29, 2024

    @141forever

    So sorry on the delay @maiqingqiang @whyiug @songkq @Minami-su

    Just added it in via a new PR by someone!

    If you're on a local machine, please update Unsloth via

    pip uninstall unsloth -y
    pip install --upgrade --force-reinstall --no-cache-dir git+https://github.com/unslothai/unsloth.git
    

    Colab and Kaggle is fine (just restart it)

    So do you support Qwen1.5 or Qwen2 after the1 updating?

  21. danielhanchen commented on Oct 9, 2024

    @danielhanchen
    Member

    @141forever Oh my apologies on the horrid delay - doing some Github Issues spring cleaning - I'm assuming you saw, but Qwen 2.5 is supported for now

  22. added a commit that references this issue on Jun 8, 2025
  23. added a commit that references this issue on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestfixed - pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions