Browse Source
* Add backend of MLflow Moldes component * Add front end of MLflow Moldes component * [DOC] update mlflow document * revert unnecessary * fix doc image url * Update docs/docs/en/guide/task/mlflow.md Discard the lr abbreviation Co-authored-by: Jiajie Zhong <zhongjiajie955@gmail.com> Co-authored-by: Jiajie Zhong <zhongjiajie955@gmail.com>3.1.0-release
JieguangZhou
2 years ago
committed by
GitHub
19 changed files with 846 additions and 321 deletions
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1,80 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
import { useI18n } from 'vue-i18n' |
||||
import type { IJsonItem } from '../types' |
||||
import { watch, ref } from 'vue' |
||||
|
||||
export function useMlflowModels(model: { [field: string]: any }): IJsonItem[] { |
||||
const { t } = useI18n() |
||||
const deployTypeSpan = ref(0) |
||||
const deployModelKeySpan = ref(0) |
||||
const deployPortSpan = ref(0) |
||||
|
||||
const setFlag = () => { |
||||
model.isModels = model.mlflowTaskType === 'MLflow Models' ? true : false |
||||
} |
||||
|
||||
const resetSpan = () => { |
||||
deployTypeSpan.value = model.isModels ? 12 : 0 |
||||
deployModelKeySpan.value = model.isModels ? 24 : 0 |
||||
deployPortSpan.value = model.isModels ? 12 : 0 |
||||
} |
||||
|
||||
watch( |
||||
() => [model.mlflowTaskType, model.registerModel], |
||||
() => { |
||||
setFlag() |
||||
resetSpan() |
||||
} |
||||
) |
||||
|
||||
setFlag() |
||||
resetSpan() |
||||
|
||||
return [ |
||||
{ |
||||
type: 'select', |
||||
field: 'deployType', |
||||
name: t('project.node.mlflow_deployType'), |
||||
span: deployTypeSpan, |
||||
options: DEPLOY_TYPE |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'deployModelKey', |
||||
name: t('project.node.mlflow_deployModelKey'), |
||||
span: deployModelKeySpan |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'deployPort', |
||||
name: t('project.node.mlflow_deployPort'), |
||||
span: deployPortSpan |
||||
} |
||||
] |
||||
} |
||||
|
||||
const DEPLOY_TYPE = [ |
||||
{ |
||||
label: 'MLFLOW', |
||||
value: 'MLFLOW' |
||||
}, |
||||
{ |
||||
label: 'DOCKER', |
||||
value: 'DOCKER' |
||||
} |
||||
] |
@ -0,0 +1,255 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
import { useI18n } from 'vue-i18n' |
||||
import type { IJsonItem } from '../types' |
||||
import { watch, ref } from 'vue' |
||||
|
||||
export function useMlflowProjects(model: { |
||||
[field: string]: any |
||||
}): IJsonItem[] { |
||||
const { t } = useI18n() |
||||
|
||||
const experimentNameSpan = ref(0) |
||||
const registerModelSpan = ref(0) |
||||
const modelNameSpan = ref(0) |
||||
const mlflowJobTypeSpan = ref(0) |
||||
const dataPathSpan = ref(0) |
||||
const paramsSpan = ref(0) |
||||
|
||||
const setFlag = () => { |
||||
model.isProjects = model.mlflowTaskType === 'MLflow Projects' ? true : false |
||||
} |
||||
|
||||
const resetSpan = () => { |
||||
experimentNameSpan.value = model.isProjects ? 12 : 0 |
||||
registerModelSpan.value = model.isProjects ? 6 : 0 |
||||
mlflowJobTypeSpan.value = model.isProjects ? 12 : 0 |
||||
paramsSpan.value = model.isProjects ? 24 : 0 |
||||
dataPathSpan.value = model.isProjects ? 24 : 0 |
||||
} |
||||
|
||||
watch( |
||||
() => [model.mlflowTaskType, model.registerModel], |
||||
() => { |
||||
setFlag() |
||||
resetSpan() |
||||
} |
||||
) |
||||
|
||||
watch( |
||||
() => [model.registerModel], |
||||
() => { |
||||
modelNameSpan.value = model.isProjects && model.registerModel ? 6 : 0 |
||||
} |
||||
) |
||||
|
||||
setFlag() |
||||
resetSpan() |
||||
|
||||
return [ |
||||
{ |
||||
type: 'select', |
||||
field: 'mlflowJobType', |
||||
name: t('project.node.mlflow_jobType'), |
||||
span: mlflowJobTypeSpan, |
||||
options: MLFLOW_JOB_TYPE |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'experimentName', |
||||
name: t('project.node.mlflow_experimentName'), |
||||
span: experimentNameSpan, |
||||
props: { |
||||
placeholder: t('project.node.mlflow_experimentName_tips') |
||||
}, |
||||
validate: { |
||||
trigger: ['input', 'blur'], |
||||
required: false |
||||
} |
||||
}, |
||||
{ |
||||
type: 'switch', |
||||
field: 'registerModel', |
||||
name: t('project.node.mlflow_registerModel'), |
||||
span: registerModelSpan |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'modelName', |
||||
name: t('project.node.mlflow_modelName'), |
||||
span: modelNameSpan, |
||||
props: { |
||||
placeholder: t('project.node.mlflow_modelName_tips') |
||||
}, |
||||
validate: { |
||||
trigger: ['input', 'blur'], |
||||
required: false |
||||
} |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'dataPath', |
||||
name: t('project.node.mlflow_dataPath'), |
||||
span: dataPathSpan, |
||||
props: { |
||||
placeholder: t('project.node.mlflow_dataPath_tips') |
||||
} |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'params', |
||||
name: t('project.node.mlflow_params'), |
||||
span: paramsSpan, |
||||
props: { |
||||
placeholder: t('project.node.mlflow_params_tips') |
||||
}, |
||||
validate: { |
||||
trigger: ['input', 'blur'], |
||||
required: false |
||||
} |
||||
}, |
||||
...useBasicAlgorithm(model), |
||||
...useAutoML(model) |
||||
] |
||||
} |
||||
|
||||
export function useBasicAlgorithm(model: { |
||||
[field: string]: any |
||||
}): IJsonItem[] { |
||||
const { t } = useI18n() |
||||
|
||||
const algorithmSpan = ref(0) |
||||
const searchParamsSpan = ref(0) |
||||
|
||||
const setFlag = () => { |
||||
model.isBasicAlgorithm = |
||||
model.mlflowJobType === 'BasicAlgorithm' && |
||||
model.mlflowTaskType === 'MLflow Projects' |
||||
? true |
||||
: false |
||||
} |
||||
|
||||
const resetSpan = () => { |
||||
algorithmSpan.value = model.isBasicAlgorithm ? 12 : 0 |
||||
searchParamsSpan.value = model.isBasicAlgorithm ? 24 : 0 |
||||
} |
||||
|
||||
watch( |
||||
() => [model.mlflowTaskType, model.mlflowJobType], |
||||
() => { |
||||
setFlag() |
||||
resetSpan() |
||||
} |
||||
) |
||||
|
||||
return [ |
||||
{ |
||||
type: 'select', |
||||
field: 'algorithm', |
||||
name: t('project.node.mlflow_algorithm'), |
||||
span: algorithmSpan, |
||||
options: ALGORITHM |
||||
}, |
||||
{ |
||||
type: 'input', |
||||
field: 'searchParams', |
||||
name: t('project.node.mlflow_searchParams'), |
||||
props: { |
||||
placeholder: t('project.node.mlflow_searchParams_tips') |
||||
}, |
||||
span: searchParamsSpan, |
||||
validate: { |
||||
trigger: ['input', 'blur'], |
||||
required: false |
||||
} |
||||
} |
||||
] |
||||
} |
||||
|
||||
export function useAutoML(model: { [field: string]: any }): IJsonItem[] { |
||||
const { t } = useI18n() |
||||
|
||||
const automlToolSpan = ref(0) |
||||
|
||||
const setFlag = () => { |
||||
model.isAutoML = |
||||
model.mlflowJobType === 'AutoML' && |
||||
model.mlflowTaskType === 'MLflow Projects' |
||||
? true |
||||
: false |
||||
} |
||||
|
||||
const resetSpan = () => { |
||||
automlToolSpan.value = model.isAutoML ? 12 : 0 |
||||
} |
||||
|
||||
watch( |
||||
() => [model.mlflowTaskType, model.mlflowJobType], |
||||
() => { |
||||
setFlag() |
||||
resetSpan() |
||||
} |
||||
) |
||||
return [ |
||||
{ |
||||
type: 'select', |
||||
field: 'automlTool', |
||||
name: t('project.node.mlflow_automlTool'), |
||||
span: automlToolSpan, |
||||
options: AutoMLTOOL |
||||
} |
||||
] |
||||
} |
||||
|
||||
export const MLFLOW_JOB_TYPE = [ |
||||
{ |
||||
label: 'BasicAlgorithm', |
||||
value: 'BasicAlgorithm' |
||||
}, |
||||
{ |
||||
label: 'AutoML', |
||||
value: 'AutoML' |
||||
} |
||||
] |
||||
export const ALGORITHM = [ |
||||
{ |
||||
label: 'svm', |
||||
value: 'svm' |
||||
}, |
||||
{ |
||||
label: 'lr', |
||||
value: 'lr' |
||||
}, |
||||
{ |
||||
label: 'lightgbm', |
||||
value: 'lightgbm' |
||||
}, |
||||
{ |
||||
label: 'xgboost', |
||||
value: 'xgboost' |
||||
} |
||||
] |
||||
export const AutoMLTOOL = [ |
||||
{ |
||||
label: 'autosklearn', |
||||
value: 'autosklearn' |
||||
}, |
||||
{ |
||||
label: 'flaml', |
||||
value: 'flaml' |
||||
} |
||||
] |
Loading…
Reference in new issue