Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions src/Microsoft.ML.AutoML/AutoMLExperiment/AutoMLExperiment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ void handler(object o, EventArgs e)
}
}
}
catch (OperationCanceledException ex) when (aggregateTrainingStopManager.IsStopTrainingRequested() == false)
catch (Exception ex) when (aggregateTrainingStopManager.IsStopTrainingRequested() == false)
{
logger.Trace($"trial cancelled - {JsonSerializer.Serialize(trialSettings)}, continue training");
logger.Trace($"catch exception when training trial {trialSettings.TrialId} - {JsonSerializer.Serialize(trialSettings)}, continue training");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception thrown during Trial {trialSettings.TrialId} with configuration {JsonSerializer.Serialize(trialSettings)}

Exception Details: ex.Message

Abandoning Trial {trialSettings.TrialId} and continue training.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LittleLittleCloud is there a way to localization for these strings? Do we do it anywhere else in this repo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luisquintanilla thoughts on strings here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeRadMSFT I don't think strings are localized anywhere in mlnet, aren't they? @michaelgsharp

trialSettings.EndedAtUtc = DateTime.UtcNow;
monitor?.ReportFailTrial(trialSettings, ex);
var trialResult = new TrialResult
Expand All @@ -296,22 +296,8 @@ void handler(object o, EventArgs e)
tuner.Update(trialResult);
trialResultManager?.AddOrUpdateTrialResult(trialResult);
aggregateTrainingStopManager.Update(trialResult);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update tuner/trialresultmanager/trainningStopManager even when a trial fails for any reasons as long as the experiment still continues

continue;
}
catch (OperationCanceledException) when (aggregateTrainingStopManager.IsStopTrainingRequested())
{
logger.Trace($"trial cancelled - {JsonSerializer.Serialize(trialSettings)}, stop training");

break;
}
catch (Exception ex)
{
logger.Trace($"trial failed - {JsonSerializer.Serialize(trialSettings)}, stop training");

trialSettings.EndedAtUtc = DateTime.UtcNow;
monitor?.ReportFailTrial(trialSettings, ex);

if (!aggregateTrainingStopManager.IsStopTrainingRequested() && _bestTrialResult == null)
if (ex is not OperationCanceledException && _bestTrialResult == null)
{
logger.Trace($"trial fatal error - {JsonSerializer.Serialize(trialSettings)}, stop training");

Expand All @@ -321,6 +307,13 @@ void handler(object o, EventArgs e)
// when error is fatal (like schema mismatch).
throw;
}
continue;
}
catch (Exception) when (aggregateTrainingStopManager.IsStopTrainingRequested())
{
logger.Trace($"trial cancelled - {JsonSerializer.Serialize(trialSettings)}, stop training");

break;
}
finally
{
Expand Down