Skip to content

Commit

Permalink
improve training data path compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Jul 10, 2023
1 parent ee63dc2 commit 0edec68
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/src/pages/Train.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0edec68

Please sign in to comment.