feat: modelscope model
This commit is contained in:
@@ -87,7 +87,16 @@ export const modelSourceMap: Record<string, string> = {
|
||||
s3: 'S3',
|
||||
huggingface_value: 'huggingface',
|
||||
ollama_library_value: 'ollama_library',
|
||||
s3_value: 's3'
|
||||
s3_value: 's3',
|
||||
modelScope: 'ModelScope',
|
||||
modelscope_value: 'model_scope'
|
||||
};
|
||||
|
||||
export const modelSourceValueMap = {
|
||||
[modelSourceMap.huggingface_value]: modelSourceMap.huggingface,
|
||||
[modelSourceMap.ollama_library_value]: modelSourceMap.ollama_library,
|
||||
[modelSourceMap.s3_value]: modelSourceMap.s3,
|
||||
[modelSourceMap.modelscope_value]: modelSourceMap.modelScope
|
||||
};
|
||||
|
||||
export const InstanceStatusMap = {
|
||||
@@ -148,6 +157,13 @@ export const ModelSortType = {
|
||||
lastModified: 'lastModified'
|
||||
};
|
||||
|
||||
export const ModelScopeSortType = {
|
||||
[ModelSortType.trendingScore]: 'Default',
|
||||
[ModelSortType.likes]: 'StarsCount',
|
||||
[ModelSortType.downloads]: 'DownloadsCount',
|
||||
[ModelSortType.lastModified]: 'GmtModified'
|
||||
};
|
||||
|
||||
export const placementStrategyOptions = [
|
||||
{
|
||||
label: 'Spread',
|
||||
@@ -158,3 +174,61 @@ export const placementStrategyOptions = [
|
||||
value: 'binpack'
|
||||
}
|
||||
];
|
||||
|
||||
export const sourceRepoConfig = {
|
||||
[modelSourceMap.huggingface_value]: {
|
||||
repo_id: 'huggingface_repo_id',
|
||||
file_name: 'huggingface_filename'
|
||||
},
|
||||
|
||||
[modelSourceMap.modelscope_value]: {
|
||||
repo_id: 'model_scope_model_id',
|
||||
file_name: 'model_scope_file_path'
|
||||
}
|
||||
};
|
||||
|
||||
export const getSourceRepoConfigValue = (
|
||||
source: string,
|
||||
data: any
|
||||
): {
|
||||
values: Record<string, any>;
|
||||
omits: string[];
|
||||
} => {
|
||||
const config: Record<string, any> = sourceRepoConfig[source] || {};
|
||||
const result: Record<string, any> = {};
|
||||
const omits: string[] = [];
|
||||
Object.keys(config)?.forEach((key: string) => {
|
||||
if (config[key]) {
|
||||
result[config[key]] = data[key];
|
||||
omits.push(key);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
values: result,
|
||||
omits: omits
|
||||
};
|
||||
};
|
||||
|
||||
export const setSourceRepoConfigValue = (
|
||||
source: string,
|
||||
data: any
|
||||
): {
|
||||
values: Record<string, any>;
|
||||
omits: string[];
|
||||
} => {
|
||||
const config: Record<string, any> = sourceRepoConfig[source] || {};
|
||||
const result: Record<string, any> = {};
|
||||
const omits: string[] = [];
|
||||
Object.keys(config)?.forEach((key: string) => {
|
||||
if (config[key]) {
|
||||
result[key] = data[config[key]];
|
||||
omits.push(config[key]);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
values: result,
|
||||
omits: omits
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,6 +4,8 @@ export interface ListItem {
|
||||
huggingface_file_name: string;
|
||||
huggingface_filename: string;
|
||||
ollama_library_model_name: string;
|
||||
model_scope_file_path: string;
|
||||
model_scope_model_id: string;
|
||||
embedding_only?: boolean;
|
||||
ready_replicas: number;
|
||||
replicas: number;
|
||||
@@ -23,11 +25,15 @@ export interface ListItem {
|
||||
|
||||
export interface FormData {
|
||||
source: string;
|
||||
repo_id: string;
|
||||
file_name: string;
|
||||
huggingface_repo_id: string;
|
||||
huggingface_filename: string;
|
||||
s3_address: string;
|
||||
ollama_library_model_name: 'string';
|
||||
distributed_inference_across_workers?: boolean;
|
||||
model_scope_model_id?: string;
|
||||
model_scope_file_path?: string;
|
||||
gpu_selector?: {
|
||||
worker_name: string;
|
||||
gpu_index: number;
|
||||
|
||||
Reference in New Issue
Block a user