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

Set use_cache back to True for HF checkpointer #1488

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion llmfoundry/callbacks/hf_checkpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great point, thanks!

original_model.config.use_cache = True
if hasattr(original_model.generation_config, 'use_cache'):
original_model.generation_config.use_cache = True

# Transform HF config before building 2nd model copy
new_config = self.transform_config(
original_config=original_model.config,
Expand Down
Loading