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

Refactor OPT model #36101

Merged
merged 3 commits into from
Feb 10, 2025
Merged

Refactor OPT model #36101

merged 3 commits into from
Feb 10, 2025

Conversation

jiqing-feng
Copy link
Contributor

@jiqing-feng jiqing-feng commented Feb 8, 2025

Hi @ArthurZucker @SunMarc . I removed useless codes for opt model including:

  1. Remove cros_attention because key_value_states has never been passed
  2. Remove self.is_decoder because it is fixed to True

I also checked it by RUN_SLOW=1 pytest tests/models/opt/test_modeling_opt.py and the results are the same as main branch.

After this PR is merged, I will enable static cache on opt model.

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@vasqu
Copy link
Contributor

vasqu commented Feb 8, 2025

Just fyi and as additional context: iirc it's a relic from using BART code via copied from but it deviated after some time making it inherent the unnecessary code.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Could you just link the discussion wherewe talked about this? 🤗

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup !

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ArthurZucker
Copy link
Collaborator

@ArthurZucker ArthurZucker merged commit 0baf003 into huggingface:main Feb 10, 2025
10 checks passed
@jiqing-feng jiqing-feng deleted the opt_refactor branch February 11, 2025 01:36
sbucaille pushed a commit to sbucaille/transformers that referenced this pull request Feb 16, 2025
* remove cross attention

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* remove is_decoder

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix pkv

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

---------

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
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.

5 participants