Skip to content

Commit ca14270

Browse files
committed
Further reduce memory consumption [release]
1 parent df473ac commit ca14270

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/trainers/train_hf_ppo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from ..datasets import OutputDatasetColumn, OutputIterableDatasetColumn
1717
from ..llms.llm import _check_temperature_and_top_p
1818
from ..utils.arg_utils import AUTO, Default, default_to
19+
from ..utils.distributed_utils import set_current_accelerator
1920
from ..utils.fs_utils import mkdir
2021
from ..utils.hf_model_utils import is_peft_model
2122
from ..utils.hf_training_utils import (
@@ -116,6 +117,7 @@ def compute_metrics(eval_pred):
116117
self.accelerator.prepare_optimizer = (
117118
lambda optimizer, *args, **kwargs: optimizer
118119
)
120+
set_current_accelerator(self.accelerator)
119121

120122
def get_train_dataloader(self) -> DataLoader:
121123
# PPOTrainer's .step() method does not allow smaller than batch size inputs

0 commit comments

Comments
 (0)