Skip to content

Commit

Permalink
🏷️ Add model tags to model trained with GRPO (#2663)
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec authored Jan 26, 2025
1 parent 55a329e commit 1123bd0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions trl/trainer/grpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class GRPOTrainer(Trainer):
PEFT configuration used to wrap the model. If `None`, the model is not wrapped.
"""

_tag_names = ["trl", "grpo"]

def __init__(
self,
model: Union[str, PreTrainedModel],
Expand Down Expand Up @@ -278,6 +280,9 @@ def data_collator(features): # No data collation is needed in GRPO
# self.model_accepts_loss_kwargs to False to enable scaling.
self.model_accepts_loss_kwargs = False

# Add tags to the model
self.model.add_model_tags(self._tag_names)

if self.ref_model is not None:
if self.is_deepspeed_enabled:
self.ref_model = prepare_deepspeed(self.ref_model, self.accelerator)
Expand Down

0 comments on commit 1123bd0

Please sign in to comment.