diff --git a/extension/src/plots/model/custom.ts b/extension/src/plots/model/custom.ts index 3f6fcb0a6e..af9747b79b 100644 --- a/extension/src/plots/model/custom.ts +++ b/extension/src/plots/model/custom.ts @@ -25,7 +25,7 @@ export const doesCustomPlotAlreadyExist = ( return value.param === param && value.metric === metric }) -const removeColumnTypeFromPath = ( +export const removeColumnTypeFromPath = ( columnPath: string, type: string, fileSep: string diff --git a/extension/src/plots/model/quickPick.test.ts b/extension/src/plots/model/quickPick.test.ts index 20f9fbf5a9..2635b5aecf 100644 --- a/extension/src/plots/model/quickPick.test.ts +++ b/extension/src/plots/model/quickPick.test.ts @@ -153,7 +153,7 @@ describe('pickMetricAndParam', () => { { hasChildren: false, label: 'accuracy', - path: 'summary.json:accuracy', + path: 'metrics:summary.json:accuracy', type: ColumnType.METRICS } ]) @@ -169,7 +169,7 @@ describe('pickMetricAndParam', () => { { hasChildren: false, label: 'accuracy', - path: 'summary.json:accuracy', + path: 'metrics:summary.json:accuracy', type: ColumnType.METRICS } ]) @@ -183,7 +183,7 @@ describe('pickMetricAndParam', () => { } const expectedParam = { label: 'epochs', - path: 'summary.json:loss-params.yaml:epochs' + path: 'params:params.yaml:epochs' } mockedQuickPickValue .mockResolvedValueOnce(expectedMetric) @@ -200,13 +200,13 @@ describe('pickMetricAndParam', () => { { hasChildren: false, label: 'accuracy', - path: 'summary.json:accuracy', + path: 'metrics:summary.json:accuracy', type: ColumnType.METRICS } ]) expect(metricAndParam).toStrictEqual({ - metric: expectedMetric.path, - param: expectedParam.path + metric: 'summary.json:loss', + param: 'params.yaml:epochs' }) }) }) @@ -232,7 +232,7 @@ describe('pickMetric', () => { { hasChildren: false, label: 'accuracy', - path: 'summary.json:accuracy', + path: 'metrics:summary.json:accuracy', type: ColumnType.METRICS } ]) @@ -250,12 +250,12 @@ describe('pickMetric', () => { { hasChildren: false, label: 'accuracy', - path: 'summary.json:accuracy', + path: 'metrics:summary.json:accuracy', type: ColumnType.METRICS } ]) - expect(metric).toStrictEqual(expectedMetric.path) + expect(metric).toStrictEqual('summary.json:loss') expect(mockedQuickPickValue).toHaveBeenCalledTimes(1) expect(mockedQuickPickValue).toHaveBeenCalledWith( [ @@ -265,9 +265,9 @@ describe('pickMetric', () => { value: { label: 'loss', path: 'metrics:summary.json:loss' } }, { - description: 'summary.json:accuracy', + description: 'metrics:summary.json:accuracy', label: 'accuracy', - value: { label: 'accuracy', path: 'summary.json:accuracy' } + value: { label: 'accuracy', path: 'metrics:summary.json:accuracy' } } ], { title: Title.SELECT_METRIC_CUSTOM_PLOT } diff --git a/extension/src/plots/model/quickPick.ts b/extension/src/plots/model/quickPick.ts index fe491679ed..e9cacd4754 100644 --- a/extension/src/plots/model/quickPick.ts +++ b/extension/src/plots/model/quickPick.ts @@ -2,7 +2,8 @@ import { getCustomPlotId } from './collect' import { getFullValuePath, CustomPlotsOrderValue, - isCheckpointValue + isCheckpointValue, + removeColumnTypeFromPath } from './custom' import { FILE_SEPARATOR, @@ -126,7 +127,19 @@ export const pickMetricAndParam = async (columns: Column[]) => { if (!param) { return } - return { metric: metric.path, param: param.path } + + return { + metric: removeColumnTypeFromPath( + metric.path, + ColumnType.METRICS, + FILE_SEPARATOR + ), + param: removeColumnTypeFromPath( + param.path, + ColumnType.PARAMS, + FILE_SEPARATOR + ) + } } export const pickMetric = async (columns: Column[]) => { @@ -144,5 +157,9 @@ export const pickMetric = async (columns: Column[]) => { return } - return metric.path + return removeColumnTypeFromPath( + metric.path, + ColumnType.METRICS, + FILE_SEPARATOR + ) }