Skip to content

Commit

Permalink
fix #2268
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed Jan 21, 2024
1 parent 3bc301b commit e0a717a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/llmtuner/model/patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def _prepare_model_for_training(
logger.warning("Current model does not support gradient checkpointing.")
else:
model.gradient_checkpointing_enable(gradient_checkpointing_kwargs={"use_reentrant": False})
model.enable_input_require_grads()
model.config.use_cache = False # turn off when gradient checkpointing is enabled
logger.info("Gradient checkpointing enabled.")

Expand Down

0 comments on commit e0a717a

Please sign in to comment.