Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Fixing missing multi label checkbox and basic input validation #145357

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Nov 16, 2022

The multi_label flag for question answering models should be user configurable.
Adds a multi label switch to the zero shot classification testing UI.

image

Adds basic input validation to ensure the Test button is not enabled unless all required inputs are filled in.
For fill_mask that includes every string needing contain the [MASK] keyword.

Also fixes the Test model menu item to ensure it is disabled if PyTorch models not started.
image

Also fixes generated pipeline to ensure it's always up to date with the user's selections.

@jgowdyelastic jgowdyelastic self-assigned this Nov 17, 2022
@jgowdyelastic jgowdyelastic added non-issue Indicates to automation that a pull request should not appear in the release notes :ml release_note:skip Skip the PR/issue when compiling release notes Feature:3rd Party Models ML 3rd party models v8.6.0 v8.7.0 labels Nov 17, 2022
@jgowdyelastic jgowdyelastic changed the title [ML] Adding multi label checkbox and basic input validation [ML] Fixing missing multi label checkbox and basic input validation Nov 17, 2022
@jgowdyelastic jgowdyelastic marked this pull request as ready for review November 17, 2022 10:28
@jgowdyelastic jgowdyelastic requested a review from a team as a code owner November 17, 2022 10:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
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, left a couple of suggestions

helpText={i18n.translate(
'xpack.ml.trainedModels.testModelsFlyout.textClassification.multiLabelHelpText',
{
defaultMessage: 'Is there a possibility of more than one correct label',
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs a ? at the end of the sentence. Or alternatively from the docs Indicates if more than one true label is possible given the input.

Any thoughts @szabosteve ?

Copy link
Contributor

@szabosteve szabosteve Nov 17, 2022

Choose a reason for hiding this comment

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

Yup, it's not trivial to explain it in one line. I leave a few suggestions:
Enable the input text to have more than one label.
Enable the input text to match more than one label.
What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to Enable the input text to match more than one label.
13a20c0

private validators$: Array<Observable<boolean>> = [];
private validatorsSubscriptions$: Subscription = new Subscription();

private pipeline = new BehaviorSubject<estypes.IngestPipeline>({});
Copy link
Contributor

Choose a reason for hiding this comment

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

I reckon we should follow the same naming convention for observables/subjects

Suggested change
private pipeline = new BehaviorSubject<estypes.IngestPipeline>({});
private pipeline$ = new BehaviorSubject<estypes.IngestPipeline>({});

)
.subscribe((v) => {
this.isValid$.next(v);
this.pipeline.next(this.generatePipeline());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should not mix validation logic with something else. Also here you generate a pipeline no matter if the input is valid or not.

If I understand it correctly, the pipeline only depends on the model id and some additional params

Copy link
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.

Latest changes LGTM

@@ -34,31 +34,35 @@ export const InferenceInputFormIndexControls: FC<Props> = ({ inferrer, data }) =
} = data;

const runningState = useObservable(inferrer.getRunningState$());
const pipeline = useObservable(inferrer.getPipeline$());
Copy link
Contributor

Choose a reason for hiding this comment

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

you also need an initial value

Suggested change
const pipeline = useObservable(inferrer.getPipeline$());
const pipeline = useObservable(inferrer.getPipeline$(), inferrer.getPipeline());

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in d70170f

);
}

private initializePipeline(additionalChanges?: Array<Observable<any>>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private initializePipeline(additionalChanges?: Array<Observable<any>>) {
private initializePipeline(additionalChanges?: Array<Observable<unknown>>) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 639f57b

}

private initializePipeline(additionalChanges?: Array<Observable<any>>) {
const formObservables$: Array<Observable<any>> = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const formObservables$: Array<Observable<any>> = [
const formObservables$: Array<Observable<unknown>> = [

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in d70170f

Copy link
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

Copy link
Contributor

@szabosteve szabosteve left a comment

Choose a reason for hiding this comment

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

UI text LGTM.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

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.4MB 3.4MB +2.9KB
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 442 448 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
securitySolution 519 525 +6
total +20

History

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

cc @jgowdyelastic

@jgowdyelastic jgowdyelastic merged commit a929099 into elastic:main Nov 18, 2022
@jgowdyelastic jgowdyelastic deleted the adding-multi-label-input-and-form-validation branch November 18, 2022 13:58
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2022
…lastic#145357)

The `multi_label` flag for question answering models should be user
configurable.
Adds a multi label switch to the zero shot classification testing UI.

![image](https://user-images.githubusercontent.com/22172091/202193314-6262247b-0fef-44f0-b0d4-c62fe14e2cba.png)

Adds basic input validation to ensure the Test button is not enabled
unless all required inputs are filled in.
For `fill_mask` that includes every string needing contain the `[MASK]`
keyword.

Also fixes the `Test model` menu item to ensure it is disabled if
`PyTorch` models not started.

![image](https://user-images.githubusercontent.com/22172091/202516808-e48e5bc0-b7b7-4864-a94b-cec2c27b7724.png)

Also fixes generated pipeline to ensure it's always up to date with the
user's selections.

(cherry picked from commit a929099)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.6

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 22, 2022
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

kibanamachine added a commit that referenced this pull request Nov 22, 2022
…tion (#145357) (#145735)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[ML] Fixing missing multi label checkbox and basic input validation
(#145357)](#145357)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"James
Gowdy","email":"jgowdy@elastic.co"},"sourceCommit":{"committedDate":"2022-11-18T13:58:32Z","message":"[ML]
Fixing missing multi label checkbox and basic input validation
(#145357)\n\nThe `multi_label` flag for question answering models should
be user\r\nconfigurable.\r\nAdds a multi label switch to the zero shot
classification testing
UI.\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/22172091/202193314-6262247b-0fef-44f0-b0d4-c62fe14e2cba.png)\r\n\r\nAdds
basic input validation to ensure the Test button is not
enabled\r\nunless all required inputs are filled in.\r\nFor `fill_mask`
that includes every string needing contain the
`[MASK]`\r\nkeyword.\r\n\r\nAlso fixes the `Test model` menu item to
ensure it is disabled if\r\n`PyTorch` models not
started.\r\n\r\n![image](https://user-images.githubusercontent.com/22172091/202516808-e48e5bc0-b7b7-4864-a94b-cec2c27b7724.png)\r\n\r\nAlso
fixes generated pipeline to ensure it's always up to date with
the\r\nuser's
selections.","sha":"a929099c9e80c9bd31bbbc34b3bf3450e016bcbc","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["non-issue",":ml","release_note:skip","Feature:3rd
Party
Models","v8.6.0","v8.7.0"],"number":145357,"url":"https://github.com/elastic/kibana/pull/145357","mergeCommit":{"message":"[ML]
Fixing missing multi label checkbox and basic input validation
(#145357)\n\nThe `multi_label` flag for question answering models should
be user\r\nconfigurable.\r\nAdds a multi label switch to the zero shot
classification testing
UI.\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/22172091/202193314-6262247b-0fef-44f0-b0d4-c62fe14e2cba.png)\r\n\r\nAdds
basic input validation to ensure the Test button is not
enabled\r\nunless all required inputs are filled in.\r\nFor `fill_mask`
that includes every string needing contain the
`[MASK]`\r\nkeyword.\r\n\r\nAlso fixes the `Test model` menu item to
ensure it is disabled if\r\n`PyTorch` models not
started.\r\n\r\n![image](https://user-images.githubusercontent.com/22172091/202516808-e48e5bc0-b7b7-4864-a94b-cec2c27b7724.png)\r\n\r\nAlso
fixes generated pipeline to ensure it's always up to date with
the\r\nuser's
selections.","sha":"a929099c9e80c9bd31bbbc34b3bf3450e016bcbc"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145357","number":145357,"mergeCommit":{"message":"[ML]
Fixing missing multi label checkbox and basic input validation
(#145357)\n\nThe `multi_label` flag for question answering models should
be user\r\nconfigurable.\r\nAdds a multi label switch to the zero shot
classification testing
UI.\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/22172091/202193314-6262247b-0fef-44f0-b0d4-c62fe14e2cba.png)\r\n\r\nAdds
basic input validation to ensure the Test button is not
enabled\r\nunless all required inputs are filled in.\r\nFor `fill_mask`
that includes every string needing contain the
`[MASK]`\r\nkeyword.\r\n\r\nAlso fixes the `Test model` menu item to
ensure it is disabled if\r\n`PyTorch` models not
started.\r\n\r\n![image](https://user-images.githubusercontent.com/22172091/202516808-e48e5bc0-b7b7-4864-a94b-cec2c27b7724.png)\r\n\r\nAlso
fixes generated pipeline to ensure it's always up to date with
the\r\nuser's
selections.","sha":"a929099c9e80c9bd31bbbc34b3bf3450e016bcbc"}}]}]
BACKPORT-->

Co-authored-by: James Gowdy <jgowdy@elastic.co>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:3rd Party Models ML 3rd party models :ml non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes v8.6.0 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants