chore: vllm params

This commit is contained in:
jialin
2024-09-26 10:30:40 +08:00
parent a698c65a07
commit f813f56c1f
13 changed files with 42 additions and 41 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ const isProduction = env === 'production';
const t = Date.now(); const t = Date.now();
export default defineConfig({ export default defineConfig({
proxy: { proxy: {
...proxy('http://192.168.50.4') ...proxy()
}, },
history: { history: {
type: 'hash' type: 'hash'
-7
View File
@@ -31,13 +31,6 @@ export default [
access: 'canSeeAdmin', access: 'canSeeAdmin',
component: './resources' component: './resources'
}, },
// {
// name: 'usage',
// path: '/usage',
// key: 'usage',
// icon: 'BarChartOutlined',
// component: './usage'
// },
{ {
name: 'apikeys', name: 'apikeys',
path: '/api-keys', path: '/api-keys',
+1 -1
View File
@@ -21,7 +21,7 @@ const HintInput: React.FC<HintInputProps> = (props) => {
const generateOptions = (context: string) => { const generateOptions = (context: string) => {
if (!context) { if (!context) {
setOptions([]); setOptions(sourceOptions || []);
return; return;
} }
const match = context.match(matchReg); const match = context.match(matchReg);
-1
View File
@@ -78,7 +78,6 @@ const ListInput: React.FC<ListInputProps> = (props) => {
options={options} options={options}
key={item.uid} key={item.uid}
value={item.value} value={item.value}
label={`${index + 1}`}
onRemove={() => handleOnRemove(index)} onRemove={() => handleOnRemove(index)}
onChange={(val) => handleOnChange(val, index)} onChange={(val) => handleOnChange(val, index)}
/> />
+8
View File
@@ -9,6 +9,14 @@ import shortcuts from './zh-CN/shortcuts';
import usage from './zh-CN/usage'; import usage from './zh-CN/usage';
import users from './zh-CN/users'; 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 { export default {
...common, ...common,
...menu, ...menu,
+9
View File
@@ -154,9 +154,17 @@ export async function queryModelScopeModels(
Target?: string; Target?: string;
SingleCriterion?: any[]; SingleCriterion?: any[];
Name: string; Name: string;
filterGGUF?: boolean;
}, },
config?: any config?: any
) { ) {
const Criterion = params.filterGGUF
? {
Criterion: [
{ category: 'tags', predicate: 'contains', values: ['gguf'] }
]
}
: {};
const res = await fetch(`${MODEL_SCOPE_LIST_MODEL_API}`, { const res = await fetch(`${MODEL_SCOPE_LIST_MODEL_API}`, {
method: 'PUT', method: 'PUT',
signal: config?.signal, signal: config?.signal,
@@ -165,6 +173,7 @@ export async function queryModelScopeModels(
}, },
body: JSON.stringify({ body: JSON.stringify({
...params, ...params,
...Criterion,
Name: `${params.Name}`, Name: `${params.Name}`,
PageSize: 100, PageSize: 100,
PageNumber: 1 PageNumber: 1
@@ -1,5 +1,7 @@
import LabelSelector from '@/components/label-selector'; import LabelSelector from '@/components/label-selector';
import ListInput from '@/components/list-input';
import SealSelect from '@/components/seal-form/seal-select'; import SealSelect from '@/components/seal-form/seal-select';
import { PageAction } from '@/config';
import { PageActionType } from '@/config/types'; import { PageActionType } from '@/config/types';
import { InfoCircleOutlined, RightOutlined } from '@ant-design/icons'; import { InfoCircleOutlined, RightOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
@@ -191,7 +193,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
</Form.Item> </Form.Item>
</> </>
)} )}
{/* <Form.Item name="backend"> <Form.Item name="backend">
<SealSelect <SealSelect
label={intl.formatMessage({ id: 'models.form.backend' })} label={intl.formatMessage({ id: 'models.form.backend' })}
options={[ options={[
@@ -208,8 +210,8 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
]} ]}
disabled={action === PageAction.EDIT} disabled={action === PageAction.EDIT}
></SealSelect> ></SealSelect>
</Form.Item> */} </Form.Item>
{/* <Form.Item<FormData> name="backend_parameters"> <Form.Item<FormData> name="backend_parameters">
<ListInput <ListInput
btnText="common.button.addParams" btnText="common.button.addParams"
label={intl.formatMessage({ id: 'models.form.backend_parameters' })} label={intl.formatMessage({ id: 'models.form.backend_parameters' })}
@@ -217,7 +219,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
onChange={handleBackendParametersChange} onChange={handleBackendParametersChange}
options={paramsConfig} options={paramsConfig}
></ListInput> ></ListInput>
</Form.Item> */} </Form.Item>
{scheduleType === 'manual' && ( {scheduleType === 'manual' && (
<Form.Item<FormData> <Form.Item<FormData>
name="gpu_selector" name="gpu_selector"
@@ -101,9 +101,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
); );
const handleOnSelectModel = () => { const handleOnSelectModel = () => {
if (!props.selectedModel.name) {
return;
}
let name = _.split(props.selectedModel.name, '/').slice(-1)[0]; let name = _.split(props.selectedModel.name, '/').slice(-1)[0];
const reg = /(-gguf)$/i; const reg = /(-gguf)$/i;
name = _.toLower(name).replace(reg, ''); name = _.toLower(name).replace(reg, '');
@@ -192,7 +192,6 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
} }
const newList = generateGroupByFilename(list); const newList = generateGroupByFilename(list);
console.log('newList====', newList);
const sortList = _.sortBy(newList, (item: any) => { const sortList = _.sortBy(newList, (item: any) => {
return sortType === 'size' ? item.size : item.path; return sortType === 'size' ? item.size : item.path;
}); });
@@ -200,7 +199,6 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
handleSelectModelFile(sortList[0]); handleSelectModelFile(sortList[0]);
setDataSource({ fileList: sortList, loading: false }); setDataSource({ fileList: sortList, loading: false });
} catch (error) { } catch (error) {
console.log('error======', error);
setDataSource({ fileList: [], loading: false }); setDataSource({ fileList: [], loading: false });
handleSelectModelFile({}); handleSelectModelFile({});
} }
@@ -246,9 +244,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
fetchModelFiles: handleFetchModelFiles fetchModelFiles: handleFetchModelFiles
})); }));
// useEffect(() => { useEffect(() => {
// handleFetchModelFiles(); if (!props.selectedModel.name) {
// }, [props.selectedModel.name]); setDataSource({ fileList: [], loading: false });
handleSelectModelFile({});
}
}, [props.selectedModel.name]);
useEffect(() => { useEffect(() => {
return () => { return () => {
@@ -96,7 +96,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
<div>{workerIp}</div> <div>{workerIp}</div>
<div> <div>
{intl.formatMessage({ id: 'models.table.gpuindex' })}: [ {intl.formatMessage({ id: 'models.table.gpuindex' })}: [
{_.join(item.gpu_indexes, ',')}] {_.join(item.gpu_indexes?.sort?.(), ',')}]
</div> </div>
</div> </div>
); );
@@ -119,7 +119,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
worker_name: `${row.worker_name}`, worker_name: `${row.worker_name}`,
worker_ip: `${row.worker_ip}`, worker_ip: `${row.worker_ip}`,
port: row.port, port: row.port,
gpu_index: `${row.gpu_indexes} (main)` gpu_index: `${row.gpu_indexes?.sort?.()} (main)`
} }
]; ];
+7 -11
View File
@@ -1,6 +1,6 @@
import { BulbOutlined } from '@ant-design/icons'; import { BulbOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import { Select } from 'antd'; import { Checkbox, Select } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { queryHuggingfaceModels, queryModelScopeModels } from '../apis'; import { queryHuggingfaceModels, queryModelScopeModels } from '../apis';
@@ -22,7 +22,6 @@ interface SearchInputProps {
} }
const SearchModel: React.FC<SearchInputProps> = (props) => { const SearchModel: React.FC<SearchInputProps> = (props) => {
console.log('SearchModel======');
const intl = useIntl(); const intl = useIntl();
const { modelSource, setLoadingModel, onSourceChange, onSelectModel } = props; const { modelSource, setLoadingModel, onSourceChange, onSelectModel } = props;
const [dataSource, setDataSource] = useState<{ const [dataSource, setDataSource] = useState<{
@@ -44,7 +43,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
const cacheRepoOptions = useRef<any[]>([]); const cacheRepoOptions = useRef<any[]>([]);
const axiosTokenRef = useRef<any>(null); const axiosTokenRef = useRef<any>(null);
const searchInputRef = useRef<any>(''); const searchInputRef = useRef<any>('');
const filterGGUFRef = useRef<boolean>(true); const filterGGUFRef = useRef<boolean | undefined>();
const modelFilesSortOptions = useRef<any[]>([ const modelFilesSortOptions = useRef<any[]>([
{ {
label: intl.formatMessage({ id: 'models.sort.trending' }), label: intl.formatMessage({ id: 'models.sort.trending' }),
@@ -78,8 +77,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
search: { search: {
query: searchInputRef.current || '', query: searchInputRef.current || '',
sort: sort, sort: sort,
// tags: filterGGUFRef.current ? ['gguf'] : [], tags: filterGGUFRef.current ? ['gguf'] : [],
tags: ['gguf'],
task task
} }
}; };
@@ -103,10 +101,8 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
const getModelsFromModelscope = useCallback(async (sort: string) => { const getModelsFromModelscope = useCallback(async (sort: string) => {
try { try {
const params = { const params = {
// Name: filterGGUFRef.current Name: `${searchInputRef.current}`,
// ? `${searchInputRef.current} gguf` filterGGUF: filterGGUFRef.current,
// : searchInputRef.current || '',
Name: `${searchInputRef.current} gguf`,
SortBy: ModelScopeSortType[sort] SortBy: ModelScopeSortType[sort]
}; };
const data = await queryModelScopeModels(params, { const data = await queryModelScopeModels(params, {
@@ -233,13 +229,13 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
</span> </span>
</span> </span>
<span> <span>
{/* <Checkbox <Checkbox
onChange={handleFilterGGUFChange} onChange={handleFilterGGUFChange}
className="m-r-5" className="m-r-5"
checked={filterGGUFRef.current} checked={filterGGUFRef.current}
> >
GGUF GGUF
</Checkbox> */} </Checkbox>
<Select <Select
allowClear allowClear
value={dataSource.sortType} value={dataSource.sortType}
@@ -42,9 +42,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
const [systemMessage, setSystemMessage] = useState(''); const [systemMessage, setSystemMessage] = useState('');
const [show, setShow] = useState(false); const [show, setShow] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [activeIndex, setActiveIndex] = useState(-1);
const [tokenResult, setTokenResult] = useState<any>(null); const [tokenResult, setTokenResult] = useState<any>(null);
const [currentIsFocus, setCurrentIsFocus] = useState(false);
const [collapse, setCollapse] = useState(false); const [collapse, setCollapse] = useState(false);
const contentRef = useRef<any>(''); const contentRef = useRef<any>('');
const controllerRef = useRef<any>(null); const controllerRef = useRef<any>(null);
@@ -92,7 +90,6 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
}); });
setMessageId(); setMessageId();
setMessageList([...messageList]); setMessageList([...messageList]);
setActiveIndex(messageList.length - 1);
}; };
const joinMessage = (chunk: any) => { const joinMessage = (chunk: any) => {
@@ -252,7 +249,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
<div className="ground-left-wrapper"> <div className="ground-left-wrapper">
<div className="ground-left"> <div className="ground-left">
<div <div
className="message-list-wrap" className="message-list-wrap custome-scrollbar"
onWheel={handleContentWheel} onWheel={handleContentWheel}
ref={scroller} ref={scroller}
> >
+1 -2
View File
@@ -32,8 +32,7 @@
.role { .role {
display: flex; display: flex;
width: 60px; width: 50px;
flex-basis: 60px;
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
margin-bottom: 8px; margin-bottom: 8px;
} }