Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Малахов Алексей Павлович committed Sep 30, 2024
1 parent 47351fc commit 9492902
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion turbo_alignment/trainers/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from peft import PeftModel
from torch import nn
from transformers import PreTrainedModel
from transformers.integrations.deepspeed import is_deepspeed_zero3_enabled
from transformers.trainer_pt_utils import nested_detach
from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR
from transformers.utils import logging
Expand Down Expand Up @@ -70,7 +71,7 @@ def prediction_step(
return loss, logits, labels

def _save_checkpoint(self, model, trial, metrics=None):
if isinstance(model, PeftModel) and self.accelerator.state.deepspeed_plugin.zero_stage == 3:
if isinstance(model, PeftModel) and is_deepspeed_zero3_enabled():
logger.info('Running custom _save_checkpoint')
checkpoint_folder = f'{PREFIX_CHECKPOINT_DIR}-{self.state.global_step}'
run_dir = self._get_output_dir(trial=trial)
Expand Down

0 comments on commit 9492902

Please sign in to comment.