feat: add parameter format and common parameters to backend configuration
This commit is contained in:
@@ -23,6 +23,13 @@ export default {
|
||||
'backend.form.defaultExecuteCommand': 'Default Execution Command',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' and '{{'model_name'}}' are placeholders that will be substituted with the actual values during deployment.`,
|
||||
'backend.form.defaultBackendParameters': 'Default Backend Parameters',
|
||||
'backend.form.parameterFormat': 'Parameter Format',
|
||||
'backend.form.parameterFormat.default': 'Backend Default',
|
||||
'backend.form.parameterFormat.space': 'Space (--key value)',
|
||||
'backend.form.parameterFormat.equal': 'Equal (--key=value)',
|
||||
'backend.form.commonParameters': 'Common Parameters',
|
||||
'backend.form.commonParameters.tips':
|
||||
'Shown as suggestions in the backend parameters input during deployment.',
|
||||
'backend.form.versionConfig': 'Versions Config',
|
||||
'backend.form.addParameter': 'Add Parameter',
|
||||
'backend.form.noVersion': 'No versions added',
|
||||
|
||||
@@ -23,6 +23,13 @@ export default {
|
||||
'backend.form.defaultExecuteCommand': 'Default Execution Command',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' and '{{'model_name'}}' are placeholders that will be substituted with the actual values during deployment.`,
|
||||
'backend.form.defaultBackendParameters': 'Default Backend Parameters',
|
||||
'backend.form.parameterFormat': 'パラメータ形式',
|
||||
'backend.form.parameterFormat.default': 'バックエンドのデフォルト',
|
||||
'backend.form.parameterFormat.space': 'スペース区切り (--key value)',
|
||||
'backend.form.parameterFormat.equal': 'イコール連結 (--key=value)',
|
||||
'backend.form.commonParameters': 'よく使うパラメータ',
|
||||
'backend.form.commonParameters.tips':
|
||||
'モデルのデプロイ時にバックエンドパラメータ入力欄の候補として表示されます。',
|
||||
'backend.form.versionConfig': 'Versions Config',
|
||||
'backend.form.addParameter': 'Add Parameter',
|
||||
'backend.form.noVersion': 'No versions added',
|
||||
|
||||
@@ -23,6 +23,13 @@ export default {
|
||||
'backend.form.defaultExecuteCommand': 'Команда выполнения по умолчанию',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' и '{{'model_name'}}' заполняются реальными значениями во время запуска`,
|
||||
'backend.form.defaultBackendParameters': 'Параметры бэкенда по умолчанию',
|
||||
'backend.form.parameterFormat': 'Формат параметров',
|
||||
'backend.form.parameterFormat.default': 'По умолчанию бэкенда',
|
||||
'backend.form.parameterFormat.space': 'Пробел (--key value)',
|
||||
'backend.form.parameterFormat.equal': 'Знак равенства (--key=value)',
|
||||
'backend.form.commonParameters': 'Часто используемые параметры',
|
||||
'backend.form.commonParameters.tips':
|
||||
'Отображаются как подсказки в поле параметров бэкенда при развёртывании.',
|
||||
'backend.form.versionConfig': 'Конфигурация версий',
|
||||
'backend.form.addParameter': 'Добавить параметр',
|
||||
'backend.form.noVersion': 'Версии не добавлены',
|
||||
|
||||
@@ -23,6 +23,13 @@ export default {
|
||||
'backend.form.defaultExecuteCommand': 'Varsayılan Çalıştırma Komutu',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' ve '{{'model_name'}}' dağıtım sırasında gerçek değerlerle değiştirilecek yer tutuculardır.`,
|
||||
'backend.form.defaultBackendParameters': 'Varsayılan Altyapı Parametreleri',
|
||||
'backend.form.parameterFormat': 'Parametre Biçimi',
|
||||
'backend.form.parameterFormat.default': 'Varsayılan',
|
||||
'backend.form.parameterFormat.space': 'Boşluk (--key value)',
|
||||
'backend.form.parameterFormat.equal': 'Eşittir (--key=value)',
|
||||
'backend.form.commonParameters': 'Yaygın Parametreler',
|
||||
'backend.form.commonParameters.tips':
|
||||
'Dağıtım sırasında altyapı parametreleri girişinde öneri olarak gösterilir.',
|
||||
'backend.form.versionConfig': 'Sürüm Yapılandırması',
|
||||
'backend.form.addParameter': 'Parametre Ekle',
|
||||
'backend.form.noVersion': 'Sürüm eklenmedi',
|
||||
|
||||
@@ -23,6 +23,12 @@ export default {
|
||||
'backend.form.defaultExecuteCommand': '默认执行命令',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}'、'{{'port'}}'、'{{'worker_ip'}}' 和 '{{'model_name'}}' 都是占位符,在部署过程中会被替换为实际的值。`,
|
||||
'backend.form.defaultBackendParameters': '默认后端参数',
|
||||
'backend.form.parameterFormat': '参数输出格式',
|
||||
'backend.form.parameterFormat.default': '后端默认',
|
||||
'backend.form.parameterFormat.space': '空格分隔 (--key value)',
|
||||
'backend.form.parameterFormat.equal': '等号连接 (--key=value)',
|
||||
'backend.form.commonParameters': '常用参数',
|
||||
'backend.form.commonParameters.tips': '部署模型时作为后端参数候选项展示。',
|
||||
'backend.form.versionConfig': '版本配置',
|
||||
'backend.form.addParameter': '添加参数',
|
||||
'backend.form.noVersion': '未添加版本',
|
||||
|
||||
@@ -119,6 +119,10 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
||||
|
||||
onSubmit({
|
||||
...values,
|
||||
parameter_format:
|
||||
values.parameter_format === 'auto' || !values.parameter_format
|
||||
? null
|
||||
: values.parameter_format,
|
||||
default_version: defaultVersion?.version_no || '',
|
||||
// @ts-ignore
|
||||
version_configs: versionConfigs
|
||||
@@ -155,6 +159,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
||||
return {
|
||||
...values,
|
||||
backend_name: values.backend_name.replace(/-custom$/, ''),
|
||||
parameter_format: values.parameter_format ?? 'auto',
|
||||
version_configs: versionConfigs,
|
||||
built_in_version_configs: builtInVersions
|
||||
};
|
||||
|
||||
@@ -198,6 +198,8 @@ export const customBackendFields = [
|
||||
'default_run_command',
|
||||
'version_configs',
|
||||
'default_backend_param',
|
||||
'parameter_format',
|
||||
'common_parameters',
|
||||
'default_env'
|
||||
];
|
||||
|
||||
@@ -208,6 +210,8 @@ export const builtInBackendFields = [
|
||||
'description',
|
||||
'version_configs',
|
||||
'default_backend_param',
|
||||
'parameter_format',
|
||||
'common_parameters',
|
||||
'default_env'
|
||||
];
|
||||
|
||||
@@ -293,6 +297,10 @@ default_version: v0.11.0
|
||||
health_check_path: /v1/models
|
||||
default_backend_param:
|
||||
- --host
|
||||
parameter_format: space
|
||||
common_parameters:
|
||||
- --max-model-len
|
||||
- --gpu-memory-utilization
|
||||
default_run_command: "{{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}"
|
||||
default_env:
|
||||
version_configs:
|
||||
|
||||
@@ -26,6 +26,18 @@
|
||||
},
|
||||
"description": "default backend parameter"
|
||||
},
|
||||
"parameter_format": {
|
||||
"type": ["string", "null"],
|
||||
"enum": ["space", "equal", null],
|
||||
"description": "parameter output format: 'space' -> --key value, 'equal' -> --key=value"
|
||||
},
|
||||
"common_parameters": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "commonly used parameters shown as hints in deployment UI"
|
||||
},
|
||||
"default_run_command": {
|
||||
"type": ["string", "null"],
|
||||
"description": "default start command"
|
||||
|
||||
@@ -12,6 +12,18 @@
|
||||
},
|
||||
"description": "default backend parameter"
|
||||
},
|
||||
"parameter_format": {
|
||||
"type": ["string", "null"],
|
||||
"enum": ["space", "equal", null],
|
||||
"description": "parameter output format: 'space' -> --key value, 'equal' -> --key=value"
|
||||
},
|
||||
"common_parameters": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "commonly used parameters shown as hints in deployment UI"
|
||||
},
|
||||
"default_run_command": {
|
||||
"type": ["string", "null"],
|
||||
"description": "default start command"
|
||||
|
||||
@@ -16,6 +16,18 @@
|
||||
},
|
||||
"description": "default backend parameter"
|
||||
},
|
||||
"parameter_format": {
|
||||
"type": ["string", "null"],
|
||||
"enum": ["space", "equal", null],
|
||||
"description": "parameter output format: 'space' -> --key value, 'equal' -> --key=value"
|
||||
},
|
||||
"common_parameters": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "commonly used parameters shown as hints in deployment UI"
|
||||
},
|
||||
"default_run_command": {
|
||||
"type": ["string", "null"],
|
||||
"description": "default start command"
|
||||
|
||||
@@ -28,6 +28,8 @@ export interface FormData {
|
||||
enabled?: boolean;
|
||||
backend_source?: string;
|
||||
default_env?: Record<string, any>;
|
||||
parameter_format?: 'space' | 'equal' | 'auto' | null;
|
||||
common_parameters?: string[];
|
||||
}
|
||||
|
||||
export interface ListItem extends FormData {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Input as CInput,
|
||||
LabelSelector,
|
||||
ListInput,
|
||||
Select as SealSelect,
|
||||
Textarea as SealTextArea,
|
||||
useAppUtils
|
||||
} from '@gpustack/core-ui';
|
||||
@@ -148,6 +149,46 @@ const BasicForm = () => {
|
||||
})}
|
||||
></ListInput>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData>
|
||||
name="parameter_format"
|
||||
initialValue="auto"
|
||||
rules={[{ required: false }]}
|
||||
>
|
||||
<SealSelect
|
||||
label={intl.formatMessage({ id: 'backend.form.parameterFormat' })}
|
||||
options={[
|
||||
{
|
||||
label: intl.formatMessage({
|
||||
id: 'backend.form.parameterFormat.default'
|
||||
}),
|
||||
value: 'auto'
|
||||
},
|
||||
{
|
||||
label: intl.formatMessage({
|
||||
id: 'backend.form.parameterFormat.space'
|
||||
}),
|
||||
value: 'space'
|
||||
},
|
||||
{
|
||||
label: intl.formatMessage({
|
||||
id: 'backend.form.parameterFormat.equal'
|
||||
}),
|
||||
value: 'equal'
|
||||
}
|
||||
]}
|
||||
></SealSelect>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData>
|
||||
name="common_parameters"
|
||||
rules={[{ required: false }]}
|
||||
>
|
||||
<ListInput
|
||||
btnText={intl.formatMessage({ id: 'backend.form.addParameter' })}
|
||||
label={intl.formatMessage({
|
||||
id: 'backend.form.commonParameters'
|
||||
})}
|
||||
></ListInput>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData> name="default_env">
|
||||
<LabelSelector
|
||||
label={intl.formatMessage({
|
||||
|
||||
@@ -344,6 +344,8 @@ export interface BackendGroupItem {
|
||||
isBuiltIn: boolean;
|
||||
backend_source: string;
|
||||
enabled: boolean;
|
||||
common_parameters?: string[];
|
||||
parameter_format?: 'space' | 'equal' | null;
|
||||
versions: {
|
||||
label: string;
|
||||
value: string;
|
||||
@@ -363,6 +365,8 @@ export interface BackendOption {
|
||||
backend_source: string;
|
||||
default_env?: Record<string, any>;
|
||||
enabled: boolean;
|
||||
common_parameters?: string[];
|
||||
parameter_format?: 'space' | 'equal' | null;
|
||||
versions: {
|
||||
label: string;
|
||||
value: string;
|
||||
@@ -387,6 +391,8 @@ export interface BackendItem {
|
||||
is_built_in: boolean;
|
||||
backend_source: string;
|
||||
enabled: boolean;
|
||||
common_parameters?: string[];
|
||||
parameter_format?: 'space' | 'equal' | null;
|
||||
versions: {
|
||||
version: string;
|
||||
env?: Record<string, any>;
|
||||
|
||||
@@ -12,7 +12,7 @@ import BackendParameters, {
|
||||
|
||||
const BackendParametersList: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const { onValuesChange } = useFormContext();
|
||||
const { onValuesChange, flatBackendOptions } = useFormContext();
|
||||
const form = Form.useFormInstance();
|
||||
const backend = Form.useWatch('backend', form);
|
||||
|
||||
@@ -21,8 +21,18 @@ const BackendParametersList: React.FC = () => {
|
||||
}, [backend]);
|
||||
|
||||
const paramsConfig = useMemo(() => {
|
||||
return _.get(BackendParameters, backend, []);
|
||||
}, [backend]);
|
||||
const builtIn = _.get(BackendParameters, backend, []) as Array<{
|
||||
label: string;
|
||||
value: string;
|
||||
opts?: { label: any; value: any }[];
|
||||
}>;
|
||||
const selected = flatBackendOptions?.find((o) => o.value === backend);
|
||||
const extra = (selected?.common_parameters || []).map((v) => ({
|
||||
label: v,
|
||||
value: v
|
||||
}));
|
||||
return _.uniqBy([...extra, ...builtIn], 'value');
|
||||
}, [backend, flatBackendOptions]);
|
||||
|
||||
const handleBackendParametersOnBlur = () => {
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
|
||||
@@ -63,7 +63,9 @@ export default function useQueryBackends() {
|
||||
'backend_source',
|
||||
'is_built_in',
|
||||
'default_backend_param',
|
||||
'default_env'
|
||||
'default_env',
|
||||
'common_parameters',
|
||||
'parameter_format'
|
||||
]),
|
||||
backend_source: item.backend_source || BackendSourceValueMap.CUSTOM,
|
||||
value: item.backend_name,
|
||||
|
||||
Reference in New Issue
Block a user