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

Remove seq_len arg in rotary_emb #1443

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Conversation

BMPixel
Copy link
Contributor

@BMPixel BMPixel commented Mar 26, 2024

Remove seq_len argument in self.rotary_emb() in the flash-attn and xformers patches. Solves #1423.

Description

Issue #1423 mentioned that the error TypeError: LlamaRotaryEmbedding.forward() got an unexpected keyword argument 'seq_len' occurs when training Llama with flash-attention. I found that it only happens when the version of transformers is greater than 4.38. This error occurs because in transformers version 4.39, the seq_len argument in the LlamaRotaryEmbedding.forward() function was deprecated. You can see the change at huggingface/transformers@ffe60fd#diff-06392bad3b9e97be9ade60d4ac46f73b6809388f4d507c2ba1384ab872711c51.

In the file axolotl/src/axolotl/monkeypatch/llama_attn_hijack_flash.py, line 290 calls LlamaRotaryEmbedding.forward() with the argument seq_len=kv_seq_len, which is no longer supported in the updated version of transformers.

Motivation and Context

This change solves issue #1423, allowing flash-attn to be enabled when training with Llama.

How has this been tested?

The changes are small. I re-ran my training script after removing the seq_len related arguments and observed the same behavior as when downgrading transformers to version 4.38.

@winglian winglian merged commit e07347b into axolotl-ai-cloud:main Mar 26, 2024
6 checks passed
djsaunde pushed a commit that referenced this pull request Dec 17, 2024
* remove seq_len in llama rotary_emb

* chore: lint

---------

Co-authored-by: Wing Lian <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants