Skip to content

Commit

Permalink
Removed cancellation token passing after line 99.
Browse files Browse the repository at this point in the history
Opted to explicitly pass CancellationToken.None rather than leaving default for consistency with other code and added clarity.

Fixes Cancellation token - inconsistent SMT training state #62

--ECL
  • Loading branch information
Enkidu93 committed Sep 5, 2023
1 parent 609a24e commit 4bc911a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ CancellationToken cancellationToken
await using (await rwLock.WriterLockAsync(cancellationToken: cancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
await smtModelTrainer.SaveAsync(cancellationToken);
await truecaseTrainer.SaveAsync(cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
await smtModelTrainer.SaveAsync(CancellationToken.None);
await truecaseTrainer.SaveAsync(CancellationToken.None);
ITruecaser truecaser = await _truecaserFactory.CreateAsync(engineId);
IReadOnlyList<TrainSegmentPair> segmentPairs = await _trainSegmentPairs.GetAllAsync(
p => p.TranslationEngineRef == engine!.Id,
cancellationToken
CancellationToken.None
);
using (
IInteractiveTranslationModel smtModel = _smtModelFactory.Create(
Expand All @@ -119,9 +118,8 @@ CancellationToken cancellationToken
await smtModel.TrainSegmentAsync(
segmentPair.Source,
segmentPair.Target,
cancellationToken: cancellationToken
cancellationToken: CancellationToken.None
);
cancellationToken.ThrowIfCancellationRequested();
}
}

Expand Down

0 comments on commit 4bc911a

Please sign in to comment.