feat: add gpus_per_replicas

This commit is contained in:
jialin
2025-10-20 14:53:33 +08:00
parent 19e275a17a
commit 9b843151fe
10 changed files with 170 additions and 17 deletions
+15 -2
View File
@@ -1,4 +1,5 @@
import _ from 'lodash';
import { gpusCountTypeMap } from '.';
import { backendOptionsMap } from '../config/backend-parameters';
import { FormData } from './types';
@@ -33,6 +34,11 @@ export const generateGPUSelector = (data: any, gpuOptions: any[]) => {
};
};
/**
* before submit the form, generate the gpu_selector field
* @param data
* @returns
*/
export const generateGPUIds = (data: FormData) => {
const gpu_ids = _.get(data, 'gpu_selector.gpu_ids', []);
console.log('generateGPUIds', gpu_ids);
@@ -54,10 +60,17 @@ export const generateGPUIds = (data: FormData) => {
},
[]
);
if (gpusCountTypeMap.Auto === data.gpusCountType) {
return {
gpu_selector: {
gpu_ids: result || []
}
};
}
return {
gpu_selector: {
gpu_ids: result || []
gpu_ids: result || [],
gpus_per_replica: data.gpu_selector?.gpus_per_replica || null
}
};
};