Skip to content

Conversation

@SunMarc
Copy link
Member

@SunMarc SunMarc commented Feb 19, 2025

What does this PR do?

Fixes #10822. The activations function were stored in a dict, so if we load a models with hooks that contains activation function then we load a new model without hooks, the new model still ends up with hooks on the activation layers. This is because the same activation were used. To fix the issue, we just need to make sure to instantiate from the class.

@SunMarc SunMarc requested a review from a-r-r-o-w February 19, 2025 14:44
@SunMarc SunMarc changed the title store activation cls instead of fonction store activation cls instead of function Feb 19, 2025
@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.

Copy link
Contributor

@a-r-r-o-w a-r-r-o-w left a comment

Choose a reason for hiding this comment

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

Thanks for looking into it @SunMarc!

Context for other reviewers: https://huggingface.slack.com/archives/C065E480NN9/p1739907879056729

if is_torch_npu_available():
import torch_npu

ACTIVATION_FUNCTIONS = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a safe change. I could not find anything via github search that might be impacted but I did not search too many cases

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I tried to look also, should be a safe change

@a-r-r-o-w a-r-r-o-w requested a review from yiyixuxu February 19, 2025 22:47
Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

thanks a lot @SunMarc !

@SunMarc SunMarc merged commit a4c1aac into main Feb 20, 2025
14 of 15 checks passed
@yiyixuxu yiyixuxu deleted the fix-activation-hook-issue branch February 20, 2025 20:20
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