From 0edec683764837d54e65b81ee0822d9fb967eb76 Mon Sep 17 00:00:00 2001 From: josc146 Date: Mon, 10 Jul 2023 20:44:09 +0800 Subject: [PATCH] improve training data path compatibility --- frontend/src/pages/Train.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Train.tsx b/frontend/src/pages/Train.tsx index e6caf4f..f2b0c29 100644 --- a/frontend/src/pages/Train.tsx +++ b/frontend/src/pages/Train.tsx @@ -281,7 +281,9 @@ const LoraFinetune: FC = observer(() => { if (!ok) return; - const convertedDataPath = `./finetune/json2binidx_tool/data/${dataParams.dataPath.split(/[\/\\]/).pop()!.split('.')[0]}_text_document`; + const convertedDataPath = './finetune/json2binidx_tool/data/' + + dataParams.dataPath.replace(/[\/\\]$/, '').split(/[\/\\]/).pop()!.split('.')[0] + + '_text_document'; if (!await FileExists(convertedDataPath + '.idx')) { toast(t('Please convert data first.'), { type: 'error' }); return; @@ -432,7 +434,10 @@ const LoraFinetune: FC = observer(() => { return; const outputPrefix = './finetune/json2binidx_tool/data/' + dataParams.dataPath.replace(/[\/\\]$/, '').split(/[\/\\]/).pop()!.split('.')[0]; - ConvertData(commonStore.settings.customPythonPath, dataParams.dataPath, outputPrefix, dataParams.vocabPath).then(async () => { + ConvertData(commonStore.settings.customPythonPath, + dataParams.dataPath.replaceAll('\\', '/'), + outputPrefix, + dataParams.vocabPath).then(async () => { if (!await FileExists(outputPrefix + '_text_document.idx')) { toast(t('Failed to convert data') + ' - ' + await GetPyError(), { type: 'error' }); } else {