Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jan 25, 2025
1 parent b7066a3 commit daaf5d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ def train(self, verbose: bool = True):
real_batch_size = seq_lens.shape[0]
outputs, _ = self.model(sequences)
stabilities = outputs[seq_lens - 1, torch.arange(real_batch_size), 0]
retentions = power_forgetting_curve(delta_ts, stabilities, -self.model.w[19])
retentions = power_forgetting_curve(
delta_ts, stabilities, -self.model.w[19]
)
loss = (self.loss_fn(retentions, labels) * weights).sum()
penalty = torch.sum(
torch.square(self.model.w - self.init_w_tensor)
Expand Down

0 comments on commit daaf5d1

Please sign in to comment.