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

idefics2 enable_input_require_grads not aligned with disable_input_re… #33194

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

sywangyi
Copy link
Contributor

…quire_grads

make peft+idefics2 checkpoints disable fail

error like
AttributeError: 'GaudiIdefics2ForConditionalGeneration' object has no attribute '_require_grads_hook'

@sywangyi sywangyi force-pushed the idefics2_fix_checkpoint branch from 4db5300 to e6b853f Compare August 29, 2024 10:04
Copy link
Collaborator

@amyeroberts amyeroberts 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 opening this PR and fixing!

For my own understanding of the changes - it seems there's two changes happening here: one which ensures proper disabling of hooks, the other which adds peft-related logic to the tests. Is the latter necessary to catch the former?

…quire_grads

make peft+idefics2 checkpoints disable fail

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
@sywangyi
Copy link
Contributor Author

Thanks for opening this PR and fixing!

For my own understanding of the changes - it seems there's two changes happening here: one which ensures proper disabling of hooks, the other which adds peft-related logic to the tests. Is the latter necessary to catch the former?

yes, the latter is used to catch the former.

@amyeroberts
Copy link
Collaborator

@sywangyi Could you explain a bit why? In the case of the test, _hf_peft_config_loaded=False seems to be testing the previous logic (and I assume passing on main). The reason I ask is that it's good we find a way to catch possible issues but the relation to PEFT isn't obvious to me -- this indicates that either the original test isn't properly capturing what we thought or there's a different behaviour in the case of peft which e might need to address.

In particular, I think that we probably want a peft-specific test to be separated out of the current test to make sure what's being tested and why is clear

@sywangyi
Copy link
Contributor Author

see logic in https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_utils.py#L2380 and https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_utils.py#L2429 this path (_hf_peft_config_loaded=True) is not tested. so I set _hf_peft_config_loaded to False and True to test both path.

@amyeroberts
Copy link
Collaborator

@sywangyi OK, I see. Hmmm -- we shouldn't really need to know about PEFT + trainer within the modeling utils but alas it's there. Could you split up the tests so that we have a separate one for the PEFT condition and resolve the failing tests? After than I think the PR will be good to go

@sywangyi
Copy link
Contributor Author

I check the failure case
FAILED examples/tensorflow/test_tensorflow_examples.py::ExamplesTests::test_run_image_classification - ValueError: Task image-classification is not compatible with this dataset! Available tasks: []
======== 1 failed, 5 passed, 3 skipped, 8 warnings in 300.61s (0:05:00) ========

this case has nothing to do with the PR

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
Copy link
Collaborator

@amyeroberts amyeroberts 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 fixing and iterating on this!

@amyeroberts amyeroberts merged commit 74026b4 into huggingface:main Sep 17, 2024
15 checks passed
Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
itazap pushed a commit to NielsRogge/transformers that referenced this pull request Sep 20, 2024
huggingface#33194)

* idefics2 enable_input_require_grads not aligned with disable_input_require_grads
make peft+idefics2 checkpoints disable fail

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* split test case

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* fix ci failure

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* refine test

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

---------

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
amyeroberts pushed a commit to amyeroberts/transformers that referenced this pull request Oct 2, 2024
huggingface#33194)

* idefics2 enable_input_require_grads not aligned with disable_input_require_grads
make peft+idefics2 checkpoints disable fail

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* split test case

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* fix ci failure

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* refine test

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

---------

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
huggingface#33194)

* idefics2 enable_input_require_grads not aligned with disable_input_require_grads
make peft+idefics2 checkpoints disable fail

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* split test case

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* fix ci failure

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* refine test

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

---------

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
huggingface#33194)

* idefics2 enable_input_require_grads not aligned with disable_input_require_grads
make peft+idefics2 checkpoints disable fail

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* split test case

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* fix ci failure

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

* refine test

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>

---------

Signed-off-by: Wang, Yi <yi.a.wang@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.

2 participants