remove enableHighPrecisionForLastLayer

This commit is contained in:
josc146 2023-06-09 20:49:45 +08:00
parent cea1d8b4d1
commit 510683c57e
3 changed files with 11 additions and 60 deletions

View File

@ -40,7 +40,6 @@ export type ModelParameters = {
precision: Precision; precision: Precision;
storedLayers: number; storedLayers: number;
maxStoredLayers: number; maxStoredLayers: number;
enableHighPrecisionForLastLayer: boolean;
useCustomCuda?: boolean; useCustomCuda?: boolean;
customStrategy?: string; customStrategy?: string;
} }
@ -323,17 +322,7 @@ export const Configs: FC = observer(() => {
} /> } />
} }
{ {
selectedConfig.modelParameters.device == 'CUDA' && selectedConfig.modelParameters.device == 'CUDA' && <div />
<Labeled label={t('Enable High Precision For Last Layer')}
desc={t('Whether to use CPU to calculate the last output layer of the neural network with FP32 precision to obtain better quality.')}
content={
<Switch checked={selectedConfig.modelParameters.enableHighPrecisionForLastLayer}
onChange={(e, data) => {
setSelectedConfigModelParams({
enableHighPrecisionForLastLayer: data.checked
});
}} />
} />
} }
{ {
displayStrategyImg && displayStrategyImg &&

View File

@ -17,7 +17,6 @@ export const defaultModelConfigsMac: ModelConfig[] = [
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: false, useCustomCuda: false,
customStrategy: 'mps fp32' customStrategy: 'mps fp32'
} }
@ -38,7 +37,6 @@ export const defaultModelConfigsMac: ModelConfig[] = [
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: false, useCustomCuda: false,
customStrategy: 'mps fp32' customStrategy: 'mps fp32'
} }
@ -59,7 +57,6 @@ export const defaultModelConfigsMac: ModelConfig[] = [
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: false, useCustomCuda: false,
customStrategy: 'mps fp32' customStrategy: 'mps fp32'
} }
@ -79,8 +76,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -98,8 +94,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -117,8 +112,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -136,8 +130,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -155,8 +148,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
} }
]; ];
@ -178,7 +170,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 4, storedLayers: 4,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -198,7 +189,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -218,7 +208,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 24, storedLayers: 24,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -238,7 +227,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 24, storedLayers: 24,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -258,7 +246,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 8, storedLayers: 8,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -278,7 +265,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 8, storedLayers: 8,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -298,7 +284,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -318,7 +303,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -338,7 +322,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -358,7 +341,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 18, storedLayers: 18,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -378,7 +360,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 18, storedLayers: 18,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: true,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -398,7 +379,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -418,7 +398,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -438,7 +417,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 27, storedLayers: 27,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -458,7 +436,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 27, storedLayers: 27,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -478,7 +455,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -498,7 +474,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -518,7 +493,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 24, storedLayers: 24,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -538,7 +512,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -558,7 +531,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -578,7 +550,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 37, storedLayers: 37,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -598,7 +569,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -618,7 +588,6 @@ export const defaultModelConfigs: ModelConfig[] = [
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41,
enableHighPrecisionForLastLayer: false,
useCustomCuda: true useCustomCuda: true
} }
}, },
@ -637,8 +606,7 @@ export const defaultModelConfigs: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -656,8 +624,7 @@ export const defaultModelConfigs: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -675,8 +642,7 @@ export const defaultModelConfigs: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -694,8 +660,7 @@ export const defaultModelConfigs: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
}, },
{ {
@ -713,8 +678,7 @@ export const defaultModelConfigs: ModelConfig[] = [
device: 'CPU', device: 'CPU',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
maxStoredLayers: 41, maxStoredLayers: 41
enableHighPrecisionForLastLayer: false
} }
} }
]; ];

View File

@ -137,8 +137,6 @@ export const getStrategy = (modelConfig: ModelConfig | undefined = undefined) =>
strategy += params.precision === 'fp16' ? 'fp16' : params.precision === 'int8' ? 'fp16i8' : 'fp32'; strategy += params.precision === 'fp16' ? 'fp16' : params.precision === 'int8' ? 'fp16i8' : 'fp32';
if (params.storedLayers < params.maxStoredLayers) if (params.storedLayers < params.maxStoredLayers)
strategy += ` *${params.storedLayers}+`; strategy += ` *${params.storedLayers}+`;
if (params.enableHighPrecisionForLastLayer)
strategy += ' -> cpu fp32 *1';
break; break;
case 'MPS': case 'MPS':
strategy += 'mps '; strategy += 'mps ';