Skip to content

Commit 279e361

Browse files
codemzssfilipi
authored andcommitted
Add cancellation checkpoint in ValueToKeyMappingTransfomer. (#3064)
1 parent df1c72f commit 279e361

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,11 @@ private static TermMap CreateTermMapFromData(IHostEnvironment env, IChannel ch,
500500
e.SetMetric(0, trainer.Count);
501501
});
502502
while (cursor.MoveNext() && trainer.ProcessRow())
503+
{
503504
rowCur++;
505+
env.CheckAlive();
506+
}
507+
504508
if (trainer.Count == 0)
505509
ch.Warning("Map from the term data resulted in an empty map.");
506510
pch.Checkpoint(trainer.Count, rowCur);
@@ -616,6 +620,7 @@ private static TermMap[] Train(IHostEnvironment env, IChannel ch, ColInfo[] info
616620
// We might exit early if all trainers reach their maximum.
617621
while (tmin < trainer.Length && cursor.MoveNext())
618622
{
623+
env.CheckAlive();
619624
rowCur++;
620625
for (int t = tmin; t < trainer.Length; ++t)
621626
{

0 commit comments

Comments
 (0)