From f813f56c1f1294829ee727f154c73ba89f6d5b9e Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 26 Sep 2024 10:29:48 +0800 Subject: [PATCH] chore: vllm params --- config/config.ts | 2 +- config/routes.ts | 7 ------- src/components/list-input/hint-input.tsx | 2 +- src/components/list-input/index.tsx | 1 - src/locales/zh-CN.ts | 8 ++++++++ src/pages/llmodels/apis/index.ts | 9 +++++++++ .../llmodels/components/advance-config.tsx | 10 ++++++---- src/pages/llmodels/components/data-form.tsx | 3 --- .../llmodels/components/hf-model-file.tsx | 11 ++++++----- .../llmodels/components/instance-item.tsx | 4 ++-- src/pages/llmodels/components/search-model.tsx | 18 +++++++----------- .../playground/components/ground-left.tsx | 5 +---- src/pages/playground/style/prompt-modal.less | 3 +-- 13 files changed, 42 insertions(+), 41 deletions(-) diff --git a/config/config.ts b/config/config.ts index 04d89fd6..36546891 100644 --- a/config/config.ts +++ b/config/config.ts @@ -14,7 +14,7 @@ const isProduction = env === 'production'; const t = Date.now(); export default defineConfig({ proxy: { - ...proxy('http://192.168.50.4') + ...proxy() }, history: { type: 'hash' diff --git a/config/routes.ts b/config/routes.ts index 2bfd8cdc..5706e256 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -31,13 +31,6 @@ export default [ access: 'canSeeAdmin', component: './resources' }, - // { - // name: 'usage', - // path: '/usage', - // key: 'usage', - // icon: 'BarChartOutlined', - // component: './usage' - // }, { name: 'apikeys', path: '/api-keys', diff --git a/src/components/list-input/hint-input.tsx b/src/components/list-input/hint-input.tsx index e23d51b2..e261d4a7 100644 --- a/src/components/list-input/hint-input.tsx +++ b/src/components/list-input/hint-input.tsx @@ -21,7 +21,7 @@ const HintInput: React.FC = (props) => { const generateOptions = (context: string) => { if (!context) { - setOptions([]); + setOptions(sourceOptions || []); return; } const match = context.match(matchReg); diff --git a/src/components/list-input/index.tsx b/src/components/list-input/index.tsx index 61cfdc47..e7358ecd 100644 --- a/src/components/list-input/index.tsx +++ b/src/components/list-input/index.tsx @@ -78,7 +78,6 @@ const ListInput: React.FC = (props) => { options={options} key={item.uid} value={item.value} - label={`${index + 1}`} onRemove={() => handleOnRemove(index)} onChange={(val) => handleOnChange(val, index)} /> diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 1aa6a287..f07040f5 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -9,6 +9,14 @@ import shortcuts from './zh-CN/shortcuts'; import usage from './zh-CN/usage'; import users from './zh-CN/users'; +// import { LangConfigType } from './lang-config-map'; + +// const DIR: LangConfigType = 'zh-CN'; + +// const langConfig = require.context(`./`, true, /\.ts$/); + +// console.log('langConfig====', langConfig); + export default { ...common, ...menu, diff --git a/src/pages/llmodels/apis/index.ts b/src/pages/llmodels/apis/index.ts index a1956d3c..1d4cd800 100644 --- a/src/pages/llmodels/apis/index.ts +++ b/src/pages/llmodels/apis/index.ts @@ -154,9 +154,17 @@ export async function queryModelScopeModels( Target?: string; SingleCriterion?: any[]; Name: string; + filterGGUF?: boolean; }, config?: any ) { + const Criterion = params.filterGGUF + ? { + Criterion: [ + { category: 'tags', predicate: 'contains', values: ['gguf'] } + ] + } + : {}; const res = await fetch(`${MODEL_SCOPE_LIST_MODEL_API}`, { method: 'PUT', signal: config?.signal, @@ -165,6 +173,7 @@ export async function queryModelScopeModels( }, body: JSON.stringify({ ...params, + ...Criterion, Name: `${params.Name}`, PageSize: 100, PageNumber: 1 diff --git a/src/pages/llmodels/components/advance-config.tsx b/src/pages/llmodels/components/advance-config.tsx index b8a7b852..3f23623c 100644 --- a/src/pages/llmodels/components/advance-config.tsx +++ b/src/pages/llmodels/components/advance-config.tsx @@ -1,5 +1,7 @@ import LabelSelector from '@/components/label-selector'; +import ListInput from '@/components/list-input'; import SealSelect from '@/components/seal-form/seal-select'; +import { PageAction } from '@/config'; import { PageActionType } from '@/config/types'; import { InfoCircleOutlined, RightOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; @@ -191,7 +193,7 @@ const AdvanceConfig: React.FC = (props) => { )} - {/* + = (props) => { ]} disabled={action === PageAction.EDIT} > - */} - {/* name="backend_parameters"> + + name="backend_parameters"> = (props) => { onChange={handleBackendParametersChange} options={paramsConfig} > - */} + {scheduleType === 'manual' && ( name="gpu_selector" diff --git a/src/pages/llmodels/components/data-form.tsx b/src/pages/llmodels/components/data-form.tsx index ff40cf40..61f08cd9 100644 --- a/src/pages/llmodels/components/data-form.tsx +++ b/src/pages/llmodels/components/data-form.tsx @@ -101,9 +101,6 @@ const DataForm: React.FC = forwardRef((props, ref) => { ); const handleOnSelectModel = () => { - if (!props.selectedModel.name) { - return; - } let name = _.split(props.selectedModel.name, '/').slice(-1)[0]; const reg = /(-gguf)$/i; name = _.toLower(name).replace(reg, ''); diff --git a/src/pages/llmodels/components/hf-model-file.tsx b/src/pages/llmodels/components/hf-model-file.tsx index 5c74eb72..bfe1b24e 100644 --- a/src/pages/llmodels/components/hf-model-file.tsx +++ b/src/pages/llmodels/components/hf-model-file.tsx @@ -192,7 +192,6 @@ const HFModelFile: React.FC = forwardRef((props, ref) => { } const newList = generateGroupByFilename(list); - console.log('newList====', newList); const sortList = _.sortBy(newList, (item: any) => { return sortType === 'size' ? item.size : item.path; }); @@ -200,7 +199,6 @@ const HFModelFile: React.FC = forwardRef((props, ref) => { handleSelectModelFile(sortList[0]); setDataSource({ fileList: sortList, loading: false }); } catch (error) { - console.log('error======', error); setDataSource({ fileList: [], loading: false }); handleSelectModelFile({}); } @@ -246,9 +244,12 @@ const HFModelFile: React.FC = forwardRef((props, ref) => { fetchModelFiles: handleFetchModelFiles })); - // useEffect(() => { - // handleFetchModelFiles(); - // }, [props.selectedModel.name]); + useEffect(() => { + if (!props.selectedModel.name) { + setDataSource({ fileList: [], loading: false }); + handleSelectModelFile({}); + } + }, [props.selectedModel.name]); useEffect(() => { return () => { diff --git a/src/pages/llmodels/components/instance-item.tsx b/src/pages/llmodels/components/instance-item.tsx index 9f6dc1c6..282564e8 100644 --- a/src/pages/llmodels/components/instance-item.tsx +++ b/src/pages/llmodels/components/instance-item.tsx @@ -96,7 +96,7 @@ const InstanceItem: React.FC = ({
{workerIp}
{intl.formatMessage({ id: 'models.table.gpuindex' })}: [ - {_.join(item.gpu_indexes, ',')}] + {_.join(item.gpu_indexes?.sort?.(), ',')}]
); @@ -119,7 +119,7 @@ const InstanceItem: React.FC = ({ worker_name: `${row.worker_name}`, worker_ip: `${row.worker_ip}`, port: row.port, - gpu_index: `${row.gpu_indexes} (main)` + gpu_index: `${row.gpu_indexes?.sort?.()} (main)` } ]; diff --git a/src/pages/llmodels/components/search-model.tsx b/src/pages/llmodels/components/search-model.tsx index 2b00368a..8d49eef0 100644 --- a/src/pages/llmodels/components/search-model.tsx +++ b/src/pages/llmodels/components/search-model.tsx @@ -1,6 +1,6 @@ import { BulbOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; -import { Select } from 'antd'; +import { Checkbox, Select } from 'antd'; import _ from 'lodash'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { queryHuggingfaceModels, queryModelScopeModels } from '../apis'; @@ -22,7 +22,6 @@ interface SearchInputProps { } const SearchModel: React.FC = (props) => { - console.log('SearchModel======'); const intl = useIntl(); const { modelSource, setLoadingModel, onSourceChange, onSelectModel } = props; const [dataSource, setDataSource] = useState<{ @@ -44,7 +43,7 @@ const SearchModel: React.FC = (props) => { const cacheRepoOptions = useRef([]); const axiosTokenRef = useRef(null); const searchInputRef = useRef(''); - const filterGGUFRef = useRef(true); + const filterGGUFRef = useRef(); const modelFilesSortOptions = useRef([ { label: intl.formatMessage({ id: 'models.sort.trending' }), @@ -78,8 +77,7 @@ const SearchModel: React.FC = (props) => { search: { query: searchInputRef.current || '', sort: sort, - // tags: filterGGUFRef.current ? ['gguf'] : [], - tags: ['gguf'], + tags: filterGGUFRef.current ? ['gguf'] : [], task } }; @@ -103,10 +101,8 @@ const SearchModel: React.FC = (props) => { const getModelsFromModelscope = useCallback(async (sort: string) => { try { const params = { - // Name: filterGGUFRef.current - // ? `${searchInputRef.current} gguf` - // : searchInputRef.current || '', - Name: `${searchInputRef.current} gguf`, + Name: `${searchInputRef.current}`, + filterGGUF: filterGGUFRef.current, SortBy: ModelScopeSortType[sort] }; const data = await queryModelScopeModels(params, { @@ -233,13 +229,13 @@ const SearchModel: React.FC = (props) => { - {/* GGUF - */} +