"testing/python/vscode:/vscode.git/clone" did not exist on "11456de25f06a2fef3cf8e13c1e284bd81df5996"
Unverified Commit 444d2d7b authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

fix batch tuner customized trial bug (#2116)

parent 02678d6e
...@@ -59,29 +59,34 @@ class Customize extends React.Component<CustomizeProps, CustomizeState> { ...@@ -59,29 +59,34 @@ class Customize extends React.Component<CustomizeProps, CustomizeState> {
}); });
// true: parameters are wrong // true: parameters are wrong
let flag = false; let parametersIllegal = false;
Object.keys(customized).map(item => { Object.keys(customized).map(item => {
if (item !== 'tag') { if (item !== 'tag') {
// unified data type // unified data type
if (typeof copyTrialParameter[item] === 'number' && typeof customized[item] === 'string') { if (typeof copyTrialParameter[item] === 'number' && typeof customized[item] === 'string') {
customized[item] = JSON.parse(customized[item]); customized[item] = JSON.parse(customized[item]);
} }
if (searchSpace[item] === undefined) {
// sometimes the schema of trial parameters is different from search space
// e.g. Batch Tuner
return;
}
if (searchSpace[item]._type === 'choice') { if (searchSpace[item]._type === 'choice') {
if (searchSpace[item]._value.find((val: string | number) => if (searchSpace[item]._value.find((val: string | number) =>
val === customized[item]) === undefined) { val === customized[item]) === undefined) {
flag = true; parametersIllegal = true;
return; return;
} }
} else { } else {
if (customized[item] < searchSpace[item]._value[0] if (customized[item] < searchSpace[item]._value[0]
|| customized[item] > searchSpace[item]._value[1]) { || customized[item] > searchSpace[item]._value[1]) {
flag = true; parametersIllegal = true;
return; return;
} }
} }
} }
}); });
if (flag !== false) { if (parametersIllegal !== false) {
// open the warning modal // open the warning modal
this.setState(() => ({ isShowWarning: true, customParameters: customized })); this.setState(() => ({ isShowWarning: true, customParameters: customized }));
} else { } else {
...@@ -269,4 +274,4 @@ class Customize extends React.Component<CustomizeProps, CustomizeState> { ...@@ -269,4 +274,4 @@ class Customize extends React.Component<CustomizeProps, CustomizeState> {
} }
} }
export default Customize; export default Customize;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment