diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-02 20:44:46 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-02 20:44:46 +0200 |
| commit | fdf927db614a1e7696688b6e39c2bdb7548a72cc (patch) | |
| tree | 1c8e3cf64dfa4275e0526265f296b376c2c1b827 /app/client/modules/samplernn/samplernn.actions.js | |
| parent | 01cda57ffd9edc0a3f53501399c134815232e4b5 (diff) | |
loss report
Diffstat (limited to 'app/client/modules/samplernn/samplernn.actions.js')
| -rw-r--r-- | app/client/modules/samplernn/samplernn.actions.js | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/app/client/modules/samplernn/samplernn.actions.js b/app/client/modules/samplernn/samplernn.actions.js index 339c347..4b8d00b 100644 --- a/app/client/modules/samplernn/samplernn.actions.js +++ b/app/client/modules/samplernn/samplernn.actions.js @@ -11,10 +11,9 @@ export const load_directories = () => (dispatch) => { actions.task.index({ module: 'samplernn' }), actions.socket.list_directory({ module: 'samplernn', dir: 'results' }), actions.socket.list_directory({ module: 'samplernn', dir: 'datasets' }), - actions.socket.run_script({ module: 'samplernn', activity: 'report' }) ]).then(res => { - console.log(res) - const [folders, files, tasks, results, datasets, report] = res + // console.log(res) + const [folders, files, tasks, results, datasets] = res const folderLookup = folders.reduce((folderLookup, folder) => { folderLookup[folder.id] = folder @@ -75,27 +74,14 @@ export const load_directories = () => (dispatch) => { .map(s => s.split(':')) .filter(b => b.length && b[1]) .reduce((a,b) => (a[b[0]] = b[1]) && a, {}) + // console.log(checkpoint.dataset) + checkpoint.name = checkpoint.dataset checkpoint.dir = s const file = fileLookup[checkpoint.dataset] || fileLookup.unsorted file.checkpoints.push(checkpoint) return checkpoint }) - // console.log(folders.length, files.length, tasks.length, results.length, datasets.length) - // console.log(report) - report.stdout.split('\n\n').filter(a=>!!a).forEach(data => { - const [ name, ...lines ] = data.split('\n') - const file = fileLookup[name] || fileLookup.unsorted - file.log = lines - .map(s => - s.split('\t').map(s => - s.split(': ') - .filter(b => b.length && b[1]) - .reduce((a,b) => (a[b[0]] = b[1])&&a, {}) - ) - ) - }) - dispatch({ type: types.samplernn.init, data: { @@ -103,13 +89,12 @@ export const load_directories = () => (dispatch) => { folders, files, checkpoints, builtDatasets, - report }, }) if (folders.length) { dispatch({ type: types.samplernn.set_folder, - folder: folders[0].name, + folder: folders[0], }) } }).catch(e => { @@ -117,6 +102,29 @@ export const load_directories = () => (dispatch) => { }) } +export const load_loss = () => dispatch => { + actions.socket.run_script({ module: 'samplernn', activity: 'report' }) + .then(report => { + const lossReport = {} + report.stdout.split('\n\n').filter(a=>!!a).forEach(data => { + const [ name, ...lines ] = data.split('\n') + lossReport[name] = lines + .map(s => + s.split('\t').reduce((a,s) => { + const b = s.split(': ') + a[b[0]] = b[1] + return a + }, {}) + ) + // console.log(loss[name]) + }) + dispatch({ + type: types.samplernn.load_loss, + lossReport + }) + }) +} + export const set_folder = (folder) => { types.samplernn.set_folder, folder } export const fetch_url = (url) => (dispatch) => { |
