dotnet / dotnet/machinelearning-modelbuilder

Consider improving understandability of Exceptions (consumption)

Aperta
#1,610 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Reported by: Customer Stale
Lingua principale
Dockerfile
Stelle
285
Fork
66
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Is your feature request related to a problem? Please describe.**
Consuming models may raise exceptions which may be difficult to understand and pinpoint the issue.

For example, my case I reveice "Index was outside the bounds of the array." an then "Destination is too short"

In StackTrace I can see it it related ngrams, and thus, probably string values in my data. In this case, I was not able to find the reason yet even if exception happens regularly in some cases. It might be related to calling the model from multiple threads.

```
at Microsoft.ML.Data.NgramBufferBuilder.AddNgrams(VBuffer`1& src, Int32 icol, UInt32 keyMax)
at Microsoft.ML.Transforms.Text.NgramExtractingTransformer.Mapper.<>c__DisplayClass11_0.b__2(VBuffer`1& dst)
at Microsoft.ML.Transforms.LpNormNormalizingTransformer.Mapper.<>c__DisplayClass8_0.b__5(VBuffer`1& dst)
at Microsoft.ML.Data.ColumnConcatenatingTransformer.Mapper.BoundColumn.<>c__DisplayClass20_0`1.b__0(VBuffer`1& dst)
at Microsoft.ML.Data.ColumnConcatenatingTransformer.Mapper.BoundColumn.<>c__DisplayClass20_0`1.b__0(VBuffer`1& dst)
at Microsoft.ML.Data.SchemaBindablePredictorWrapperBase.<>c__DisplayClass19_0`2.b__0(TDst& dst)
at Microsoft.ML.Data.PredictedLabelScorerBase.EnsureCachedPosition[TScore](Int64& cachedPosition, TScore& score, DataViewRow boundRow, ValueGetter`1 scoreGetter)
at Microsoft.ML.Data.MulticlassClassificationScorer.<>c__DisplayClass16_0.b__0(UInt32& dst)
at Microsoft.ML.Transforms.KeyToValueMappingTransformer.Mapper.KeyToValueMap`2.<>c__DisplayClass8_0.b__0(TValue& dst)
at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.<>c__DisplayClass9_0`2.b__0(TRow row)
at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.FillValues(TRow row)
at Microsoft.ML.Data.TypedCursorable`1.RowImplementation.FillValues(TRow row)
at Microsoft.ML.PredictionEngineBase`2.FillValues(TDst prediction)
at Microsoft.ML.PredictionEngine`2.Predict(TSrc example, TDst& prediction)
at Microsoft.ML.PredictionEngineBase`2.Predict(TSrc example)
```
```

at System.ThrowHelper.ThrowArgumentException_DestinationTooShort()
at System.Span`1.CopyTo(Span`1 destination)
at Microsoft.ML.Data.BufferBuilder`1.GetResult(VBuffer`1& buffer)
at Microsoft.ML.Data.NgramBufferBuilder.GetResult(VBuffer`1& dst)
at Microsoft.ML.Transforms.Text.NgramExtractingTransformer.Mapper.<>c__DisplayClass11_0.b__2(VBuffer`1& dst)
at Microsoft.ML.Transforms.LpNormNormalizingTransformer.Mapper.<>c__DisplayClass8_0.b__5(VBuffer`1& dst)
at Microsoft.ML.Data.ColumnConcatenatingTransformer.Mapper.BoundColumn.<>c__DisplayClass20_0`1.b__0(VBuffer`1& dst)
at Microsoft.ML.Data.ColumnConcatenatingTransformer.Mapper.BoundColumn.<>c__DisplayClass20_0`1.b__0(VBuffer`1& dst)
at Microsoft.ML.Data.SchemaBindablePredictorWrapperBase.<>c__DisplayClass19_0`2.b__0(TDst& dst)
at Microsoft.ML.Data.PredictedLabelScorerBase.EnsureCachedPosition[TScore](Int64& cachedPosition, TScore& score, DataViewRow boundRow, ValueGetter`1 scoreGetter)
at Microsoft.ML.Data.MulticlassClassificationScorer.<>c__DisplayClass16_0.b__0(UInt32& dst)
at Microsoft.ML.Transforms.KeyToValueMappingTransformer.Mapper.KeyToValueMap`2.<>c__DisplayClass8_0.b__0(TValue& dst)
at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.<>c__DisplayClass9_0`2.b__0(TRow row)
at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.FillValues(TRow row)
at Microsoft.ML.Data.TypedCursorable`1.RowImplementation.FillValues(TRow row)
at Microsoft.ML.PredictionEngineBase`2.FillValues(TDst prediction)
at Microsoft.ML.PredictionEngine`2.Predict(TSrc example, TDst& prediction)
at Microsoft.ML.PredictionEngineBase`2.Predict(TSrc example)
```

**Describe the solution you'd like**
Unsure. Maybe showing, something like "Column XXX throwed an exception" and then putting the actual Exception inside the InnerException?

Or, maybe Model Builder could include a "Create debuggable model" which would add the necessary source code the debug such issues without manual setup?

Or, a guide on how to enable debuggability manually, such as by downloading Microsoft.ML source code and referencing directly from local project?

**Describe alternatives you've considered**
I might try adding Microsoft.ML source code directly to my project and reference it from there. Are there any known issues doing this, such as version mismatch?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Le tracce dello stack del report identificano NgramBufferBuilder.AddNgrams, BufferBuilder.GetResult e PredictionEngine.Predict come punti di ingresso; iniziate tracciando il modo in cui le eccezioni si propagano attraverso queste chiamate. Per considerare il lavoro completato, sarebbe necessario concordare un metodo riproducibile per aggiungere informazioni sulla colonna o sul contesto alle eccezioni rivolte ai consumer, con la validazione dell'n-gram segnalato e degli scenari di uso concorrente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
developer-experience, machine-learning
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.