Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 13, 2023
1 parent 936194d commit 446cf0f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ludwig/trainers/trainer_rlhf.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import logging
import torch
from typing import Dict, List, Optional, Tuple

import torch

from ludwig.distributed.base import DistributedStrategy
from ludwig.models.llm import LLM
from ludwig.modules.loss_modules import RewardLoss
from ludwig.schema.trainer import RewardModelTrainerConfig
from ludwig.trainers.registry import register_llm_trainer
from ludwig.trainers.trainer import Trainer
from ludwig.utils.defaults import default_random_seed
from ludwig.distributed.base import DistributedStrategy

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -85,8 +86,8 @@ def train_step(
# Run forward-propagation of the chosen and rejected inputs
with self.distributed.prepare_model_update(self.dist_model, should_step=should_step):
# Obtain model predictions and loss
model_output_chosen = self.dist_model((inputs[chosen_value]))
model_output_rejected = self.dist_model((inputs[rejected_value]))
model_output_chosen = self.dist_model(inputs[chosen_value])
model_output_rejected = self.dist_model(inputs[rejected_value])
loss = self.reward_loss_function(model_output_chosen, model_output_rejected)
loss = loss / self.gradient_accumulation_steps
all_losses = loss
Expand Down

0 comments on commit 446cf0f

Please sign in to comment.