Skip to content

Commit

Permalink
[8.17] [ML] Trained Models: Add a tech preview lable for rerank model (
Browse files Browse the repository at this point in the history
…elastic#203587) (elastic#203704)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[ML] Trained Models: Add a tech preview lable for rerank model
(elastic#203587)](elastic#203587)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Dima
Arnautov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-10T23:06:26Z","message":"[ML]
Trained Models: Add a tech preview lable for rerank model
(elastic#203587)\n\n## Summary\r\n\r\nAdds a tech preview lable for
the`.rerank-v1` model \r\n\r\n<img width=\"1365\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/dd179f4b-f482-4b1d-beac-74ac3d374446\">","sha":"e3ec4771d14d3f53dccef696a408072b833f5421","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","v9.0.0","Feature:3rd
Party
Models","Team:ML","backport:version","v8.18.0","v8.17.1"],"title":"[ML]
Trained Models: Add a tech preview lable for rerank model
","number":203587,"url":"https://github.com/elastic/kibana/pull/203587","mergeCommit":{"message":"[ML]
Trained Models: Add a tech preview lable for rerank model
(elastic#203587)\n\n## Summary\r\n\r\nAdds a tech preview lable for
the`.rerank-v1` model \r\n\r\n<img width=\"1365\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/dd179f4b-f482-4b1d-beac-74ac3d374446\">","sha":"e3ec4771d14d3f53dccef696a408072b833f5421"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203587","number":203587,"mergeCommit":{"message":"[ML]
Trained Models: Add a tech preview lable for rerank model
(elastic#203587)\n\n## Summary\r\n\r\nAdds a tech preview lable for
the`.rerank-v1` model \r\n\r\n<img width=\"1365\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/dd179f4b-f482-4b1d-beac-74ac3d374446\">","sha":"e3ec4771d14d3f53dccef696a408072b833f5421"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <[email protected]>
  • Loading branch information
kibanamachine and darnautov authored Dec 11, 2024
1 parent a3d7c06 commit 25e15bf
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const ELSER_MODEL_ID = '.elser_model_2';
export const ELSER_LINUX_OPTIMIZED_MODEL_ID = '.elser_model_2_linux-x86_64';
export const E5_MODEL_ID = '.multilingual-e5-small';
export const E5_LINUX_OPTIMIZED_MODEL_ID = '.multilingual-e5-small_linux-x86_64';
export const RERANK_MODEL_ID = '.rerank-v1';
export const LANG_IDENT_MODEL_ID = 'lang_ident_model_1';
export const ELSER_ID_V1 = '.elser_model_1' as const;
export const LATEST_ELSER_VERSION: ElserVersion = 2;
Expand Down Expand Up @@ -148,9 +149,25 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<
'This E5 model, as defined, hosted, integrated and used in conjunction with our other Elastic Software is covered by our standard warranty.',
}),
},
[RERANK_MODEL_ID]: {
techPreview: true,
default: true,
hidden: true,
modelName: 'rerank',
version: 1,
config: {
input: {
field_names: ['input', 'query'],
},
},
description: i18n.translate('xpack.ml.trainedModels.modelsList.rerankDescription', {
defaultMessage: 'Elastic Rerank v1',
}),
type: ['pytorch', 'text_similarity'],
},
} as const);

export type ElasticCuratedModelName = 'elser' | 'e5';
export type ElasticCuratedModelName = 'elser' | 'e5' | 'rerank';

export interface ModelDefinition {
/**
Expand All @@ -177,6 +194,8 @@ export interface ModelDefinition {
licenseUrl?: string;
type?: readonly string[];
disclaimer?: string;
/** Indicates if model is in tech preview */
techPreview?: boolean;
}

export type ModelDefinitionResponse = ModelDefinition & {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/common/types/trained_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ interface BaseNLPModelItem extends BaseModelItem {
supported?: boolean;
state: ModelState | undefined;
downloadState?: ModelDownloadState;
techPreview?: boolean;
}

/** Model available for download */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const TechnicalPreviewBadge: FC<{ compressed?: boolean }> = ({ compressed
'This functionality is in technical preview and may be changed or removed completely in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.',
})}
tooltipPosition={'right'}
css={{ verticalAlign: 'middle' }}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ export const ModelsList: FC<Props> = ({
render: (item: TrainedModelUIItem) => {
const { description, model_id: modelId, type } = item;

const isTechPreview = description?.includes('(Tech Preview)');
const isTechPreview =
description?.includes('(Tech Preview)') || (isNLPModelItem(item) && item.techPreview);

let descriptionText = description?.replace('(Tech Preview)', '');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ describe('modelsProvider', () => {
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small_linux-x86_64',
type: ['pytorch', 'text_embedding'],
},
{
model_id: '.rerank-v1',
techPreview: true,
recommended: true,
supported: true,
hidden: true,
modelName: 'rerank',
version: 1,
config: {
input: {
field_names: ['input', 'query'],
},
},
description: 'Elastic Rerank v1',
type: ['pytorch', 'text_similarity'],
},
]);
});

Expand Down Expand Up @@ -215,6 +231,22 @@ describe('modelsProvider', () => {
license: 'MIT',
licenseUrl: 'https://huggingface.co/elastic/multilingual-e5-small_linux-x86_64',
},
{
model_id: '.rerank-v1',
techPreview: true,
recommended: true,
supported: true,
hidden: true,
modelName: 'rerank',
version: 1,
config: {
input: {
field_names: ['input', 'query'],
},
},
description: 'Elastic Rerank v1',
type: ['pytorch', 'text_similarity'],
},
]);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,15 @@ export class ModelsProvider {
const forDownload = await this.getModelDownloads();

const notDownloaded: TrainedModelUIItem[] = forDownload
.filter(({ model_id: modelId, hidden, recommended, supported, disclaimer }) => {
.filter(({ model_id: modelId, hidden, recommended, supported, disclaimer, techPreview }) => {
if (idMap.has(modelId)) {
const model = idMap.get(modelId)! as NLPModelItem;
if (recommended) {
model.recommended = true;
}
if (techPreview) {
model.techPreview = true;
}
model.supported = supported;
model.disclaimer = disclaimer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default ({ getService }: FtrProviderContext) => {
.set(getCommonRequestHeader('1'));
ml.api.assertResponseStatusCode(200, status, body);

expect(body.length).to.eql(5);
expect(body.length).to.eql(6);

expect(body).to.eql([
{
Expand Down Expand Up @@ -129,6 +129,22 @@ export default ({ getService }: FtrProviderContext) => {
model_id: '.multilingual-e5-small_linux-x86_64',
...(isIntelBased ? { recommended: true, supported: true } : { supported: false }),
},
{
model_id: '.rerank-v1',
techPreview: true,
recommended: true,
supported: true,
hidden: true,
modelName: 'rerank',
version: 1,
config: {
input: {
field_names: ['input', 'query'],
},
},
description: 'Elastic Rerank v1',
type: ['pytorch', 'text_similarity'],
},
]);
});

Expand Down

0 comments on commit 25e15bf

Please sign in to comment.