[ML] Update external URLs for E5 models (#172796)

## Summary

Adds external URLs for each version of the E5 model.

<img width="1024" alt="image"
src="785eaddd-f081-4be2-b775-1a79cf74e6b8">


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
This commit is contained in:
Dima Arnautov 2023-12-08 17:27:59 +01:00 committed by GitHub
parent ee194d32a2
commit 4c0299b578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 32 deletions

View file

@ -105,6 +105,7 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
defaultMessage: 'E5 (EmbEddings from bidirEctional Encoder rEpresentations)',
}),
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small',
type: ['pytorch', 'text_embedding'],
},
'.multilingual-e5-small_linux-x86_64': {
@ -122,6 +123,7 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
'E5 (EmbEddings from bidirEctional Encoder rEpresentations), optimized for linux-x86_64',
}),
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small_linux-x86_64',
type: ['pytorch', 'text_embedding'],
},
} as const);
@ -142,9 +144,13 @@ export interface ModelDefinition {
os?: string;
arch?: string;
default?: boolean;
/** Indicates if model version is recommended for deployment based on the cluster configuration */
recommended?: boolean;
hidden?: boolean;
/** Software license of a model, e.g. MIT */
license?: string;
/** Link to the external license/documentation page */
licenseUrl?: string;
type?: readonly string[];
}

View file

@ -226,18 +226,6 @@ const ClickToDownloadTabContent: FC<ClickToDownloadTabContentProps> = ({
/>
</EuiLink>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge
color="hollow"
target={'_blank'}
href={'https://huggingface.co/elastic/multilingual-e5-small-optimized'}
>
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.mitLicenseLabel"
defaultMessage="License: MIT"
/>
</EuiBadge>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size={'l'} />
</div>
@ -286,25 +274,45 @@ const ClickToDownloadTabContent: FC<ClickToDownloadTabContentProps> = ({
{model.model_id}
</EuiText>
</EuiFlexItem>
{model.recommended ? (
<EuiFlexItem grow={false}>
<EuiToolTip
content={
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadContent"
defaultMessage="Recommended ELSER model version for your cluster's hardware configuration"
/>
}
>
<EuiBadge color="hollow">
<FormattedMessage
id="xpack.ml.trainedModels.addModelFlyout.recommendedDownloadLabel"
defaultMessage="Recommended"
/>
</EuiBadge>
</EuiToolTip>
</EuiFlexItem>
) : null}
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize={'s'} alignItems={'center'}>
{model.recommended ? (
<EuiFlexItem grow={false}>
<EuiToolTip
content={
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadContent"
defaultMessage="Recommended model version for your cluster's hardware configuration"
/>
}
>
<EuiBadge color="hollow">
<FormattedMessage
id="xpack.ml.trainedModels.addModelFlyout.recommendedDownloadLabel"
defaultMessage="Recommended"
/>
</EuiBadge>
</EuiToolTip>
</EuiFlexItem>
) : null}
{model.licenseUrl && model.softwareLicense ? (
<EuiFlexItem grow={false}>
<EuiBadge
color="hollow"
target={'_blank'}
href={model.licenseUrl}
>
{model.softwareLicense === 'MIT' ? (
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.mitLicenseLabel"
defaultMessage="License: MIT"
/>
) : null}
</EuiBadge>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
}
name={model.model_id}

View file

@ -91,6 +91,8 @@ export type ModelItem = TrainedModelConfigResponse & {
modelName?: string;
os?: string;
arch?: string;
softwareLicense?: string;
licenseUrl?: string;
};
export type ModelItemFull = Required<ModelItem>;
@ -280,6 +282,8 @@ export const ModelsList: FC<Props> = ({
modelName: modelDefinition.modelName,
os: modelDefinition.os,
arch: modelDefinition.arch,
softwareLicense: modelDefinition.license,
licenseUrl: modelDefinition.licenseUrl,
} as ModelItem;
});
resultItems = [...resultItems, ...notDownloaded];
@ -534,7 +538,7 @@ export const ModelsList: FC<Props> = ({
content={
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadContent"
defaultMessage="Recommended ELSER model version for your cluster's hardware configuration"
defaultMessage="Recommended model version for your cluster's hardware configuration"
/>
}
>

View file

@ -87,6 +87,7 @@ describe('modelsProvider', () => {
version: 1,
modelName: 'e5',
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small',
type: ['pytorch', 'text_embedding'],
},
{
@ -100,6 +101,7 @@ describe('modelsProvider', () => {
version: 1,
modelName: 'e5',
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small_linux-x86_64',
type: ['pytorch', 'text_embedding'],
},
]);
@ -167,6 +169,7 @@ describe('modelsProvider', () => {
modelName: 'e5',
type: ['pytorch', 'text_embedding'],
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small',
},
{
arch: 'amd64',
@ -179,6 +182,7 @@ describe('modelsProvider', () => {
modelName: 'e5',
type: ['pytorch', 'text_embedding'],
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small_linux-x86_64',
},
]);
});