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

Making apply_rotary_pos_emb generic #36339

Open
xuzifei-dmatrix opened this issue Feb 21, 2025 · 0 comments
Open

Making apply_rotary_pos_emb generic #36339

xuzifei-dmatrix opened this issue Feb 21, 2025 · 0 comments
Labels
Feature request Request for a new feature

Comments

@xuzifei-dmatrix
Copy link
Contributor

Feature request

Is it possible to move the definition of apply_rotary_pos_emb function out of the model specific files (eg: modeling_llama.py) to a more generic file (eg: utils)? I noticed they are defined repeatedly for multiple models.

Motivation

I'm trying to apply torch.fx.wrap on the apply_rotary_pos_emb function. But since they are defined in multiple model files, I need to wrap it for multiple times (eg: I would need to wrap both transformers.models.llama.modeling_llama.apply_rotary_pos_emb and transformers.models.gemma.modeling_gemma.apply_rotary_pos_emb). And I need to be aware of what new models are using apply_rotary_pos_emb and wrap their definition of the function accordingly.

Your contribution

If you could point me to the location to place the generic apply_rotary_pos_emb. I could help to create the PR. Thanks!

@xuzifei-dmatrix xuzifei-dmatrix added the Feature request Request for a new feature label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

1 participant