Skip to content

[ML] Testing trained models in UI#128359

Merged
jgowdyelastic merged 24 commits intoelastic:mainfrom
jgowdyelastic:testing-trained-models-in-ui
Mar 29, 2022
Merged

[ML] Testing trained models in UI#128359
jgowdyelastic merged 24 commits intoelastic:mainfrom
jgowdyelastic:testing-trained-models-in-ui

Conversation

@jgowdyelastic
Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic commented Mar 23, 2022

Adds the ability to test some trained models using user specified input.
Currently supported models:

  • Lang ident - tested using a simulated ingest pipeline.
  • pytorch - tested by calling the infer trained model deployment API

This PR adds a wrapper for the es ingest pipeline simulate endpoint.
This has been added to ML because there is no simulate function shared from the ingest pipeline plugin. Also the endpoint supplied in the ingest pipeline plugin renames the docs parameter to documents making it incorrect if the user wished to copy the payload.

2022-03-31 13-17-03 2022-03-31 13_29_18


Action to open the testing flyout
image

Pytorch testing flyout
image

Lang ident testing flyout
image

@jgowdyelastic
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@jgowdyelastic
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@jgowdyelastic jgowdyelastic added :ml backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Feature:3rd Party Models ML 3rd party models ci:deploy-cloud v8.2.0 labels Mar 28, 2022
@jgowdyelastic jgowdyelastic marked this pull request as ready for review March 28, 2022 10:14
@jgowdyelastic jgowdyelastic requested a review from a team as a code owner March 28, 2022 10:14
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui (:ml)

RAW,
}

export const NerModel: FC<Props> = ({ model }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This component looks very similar to the LandIdent one. I presume we should create a reusable component instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated in 09fbbd1

entity: estypes.MlTrainedModelEntities | null;
}>;

export class NerInference {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

similar to the Lang Ident, I think it should be a Kibana endpoint

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested locally, and overall works really well! Left a few comments.

id="xpack.ml.trainedModels.testModelsFlyout.ner.output.probabilityTitle"
defaultMessage="Probability"
/>
: {entity.class_probability}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again with the exact value shown in the 'Raw output' tab. I'd consider formatting this to say 3 sigfigs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated in c843fbf

return 'Location';

default:
return 'cross';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there another term that can be displayed for the default case, like other?

image

Copy link
Copy Markdown
Member Author

@jgowdyelastic jgowdyelastic Mar 29, 2022

Choose a reason for hiding this comment

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

Updated in a012a58

MISC entities are now show like this:
image

Unknown entries will have the type Unknown and the same ? icon

} catch (e) {
setIsRunning(false);
setOutput(null);
setErrorText(extractErrorMessage(e));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it worth checking the length of text entered, as with even a few lines of text I am getting a timeout [10s] waiting for inference result error.

Copy link
Copy Markdown
Member Author

@jgowdyelastic jgowdyelastic Mar 29, 2022

Choose a reason for hiding this comment

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

I've increased the timeout to 30s dd2795f

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Increasing to 30s has helped on my setup, although with long passages of text I am finding the network request stays in a pending state and never seems to time out.

Copy link
Copy Markdown
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

LGTM

@jgowdyelastic
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1559 1574 +15

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 3.3MB 3.3MB +10.8KB
Unknown metric groups

ESLint disabled line counts

id before after diff
ml 102 103 +1

Total ESLint disabled count

id before after diff
ml 105 106 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest changes and LGTM.

As discussed, looks like the Elasticsearch side is not timing out properly when I try and pass a long string text when testing the NER model.

@jgowdyelastic jgowdyelastic merged commit f4ed8e1 into elastic:main Mar 29, 2022
@jgowdyelastic jgowdyelastic deleted the testing-trained-models-in-ui branch March 29, 2022 16:06
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:cloud-deploy Create or update a Cloud deployment Feature:3rd Party Models ML 3rd party models :ml release_note:feature Makes this part of the condensed release notes v8.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants