-
Notifications
You must be signed in to change notification settings - Fork 526
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
Set use_cache back to True for HF checkpointer #1488
base: main
Are you sure you want to change the base?
Conversation
@@ -500,7 +500,12 @@ def tensor_hook( | |||
|
|||
if dist.get_global_rank() == 0: | |||
log.debug('Saving Hugging Face checkpoint in global rank 0') | |||
|
|||
|
|||
if hasattr(original_model.config, 'use_cache'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be set on the original model/config because you might continue training after this function is run. I'd be fine setting it for the new model/config that are getting saved out though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great point, thanks!
@dakinggg seems like some tests are failing now, and if I am reading this correctly, it is because MPT models, by default, have What is the reason behind this choice for MPT models? I haven't been able to find another model in HF-hub that disables the usage of cache in As for the fix for the tests, I assume we can add a patch which checks if the model is MPT, and if yes, don't set |
@eldarkurtic Its fine to have it be True since we explicitly set |
@dakinggg okay, got it. So it is safe to leave these tests red? |
@eldarkurtic well, no. We can't merge with failing tests, but you can update the test so that it passes |
Most HF models have
use_cache
set toTrue
by default, which is manually changed toFalse
in llm-foundry (most likely due to huggingface/transformers#28056). This PR setsuse_cache
back to True before saving the model with the HF checkpointer.This makes it a bit more convenient to use models trained with llm-foundry, without having to manually edit
config.json
andgeneration_config.json
to setuse_cache
.