diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-16 16:02:33 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-16 16:02:33 +0200 |
| commit | 7917bca6c4da52f65de7f5ff139d66db2ac9ec51 (patch) | |
| tree | e6790843122e733aba70ccce356e066a0d25f397 /app | |
| parent | 3fbc955e814eb26e55fb083e688b49545b125f5e (diff) | |
navigationnnn
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/dashboard/dashboard.component.js | 1 | ||||
| -rw-r--r-- | app/client/modules/pix2pix/index.js | 31 | ||||
| -rw-r--r-- | app/client/modules/pix2pix/pix2pix.tasks.js | 1 | ||||
| -rw-r--r-- | app/client/modules/pix2wav/index.js | 32 | ||||
| -rw-r--r-- | app/client/modules/samplernn/index.js | 36 | ||||
| -rw-r--r-- | app/client/system/system.actions.js | 5 | ||||
| -rw-r--r-- | app/client/system/system.reducer.js | 2 | ||||
| -rw-r--r-- | app/relay/modules/pix2pix.js | 19 |
8 files changed, 89 insertions, 38 deletions
diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js index 7c14bcb..1e037bc 100644 --- a/app/client/dashboard/dashboard.component.js +++ b/app/client/dashboard/dashboard.component.js @@ -70,7 +70,6 @@ class Dashboard extends Component { </div> ) }).filter(a => !!a) - console.log(sampleRNNrenders) return ( <div className='app dashboard'> <DashboardHeader /> diff --git a/app/client/modules/pix2pix/index.js b/app/client/modules/pix2pix/index.js index 174398d..21bffe7 100644 --- a/app/client/modules/pix2pix/index.js +++ b/app/client/modules/pix2pix/index.js @@ -1,22 +1,33 @@ import { h, Component } from 'preact' import { Route, Link } from 'react-router-dom' +import actions from '../../actions' + import util from '../../util' import Pix2PixNew from './views/pix2pix.new' import Pix2PixShow from './views/pix2pix.show' import Pix2PixLive from './views/pix2pix.live' -function router () { - document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #fde, #ffe)' - return ( - <section> - <Route exact path='/pix2pix/new/' component={Pix2PixNew} /> - <Route exact path='/pix2pix/sequences/' component={Pix2PixShow} /> - <Route exact path='/pix2pix/sequences/:id/' component={Pix2PixShow} /> - <Route exact path='/pix2pix/live/' component={Pix2PixLive} /> - </section> - ) +class router { + componentWillMount(){ + actions.system.changeTool('pix2pix') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #fde, #ffe)' + } + componentWillReceiveProps(){ + actions.system.changeTool('pix2pix') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #fde, #ffe)' + } + render(){ + return ( + <section> + <Route exact path='/pix2pix/new/' component={Pix2PixNew} /> + <Route exact path='/pix2pix/sequences/' component={Pix2PixShow} /> + <Route exact path='/pix2pix/sequences/:id/' component={Pix2PixShow} /> + <Route exact path='/pix2pix/live/' component={Pix2PixLive} /> + </section> + ) + } } function links(){ diff --git a/app/client/modules/pix2pix/pix2pix.tasks.js b/app/client/modules/pix2pix/pix2pix.tasks.js index c4b79fb..f3a4fec 100644 --- a/app/client/modules/pix2pix/pix2pix.tasks.js +++ b/app/client/modules/pix2pix/pix2pix.tasks.js @@ -40,6 +40,7 @@ export const train_task = (dataset, folder_id, epochs=1) => dispatch => { module: 'pix2pix', activity: 'train', dataset: dataset.name, + epoch: 0, epochs: epochs, opt: { folder_id: folder_id, diff --git a/app/client/modules/pix2wav/index.js b/app/client/modules/pix2wav/index.js index 4bbae56..1bc953a 100644 --- a/app/client/modules/pix2wav/index.js +++ b/app/client/modules/pix2wav/index.js @@ -1,21 +1,33 @@ import { h, Component } from 'preact' import { Route, Link } from 'react-router-dom' + +import actions from '../../actions' + import util from '../../util' import Pix2WavNew from './views/pix2wav.new' import Pix2WavShow from './views/pix2wav.show' import Pix2WavLive from './views/pix2wav.live' -function router () { - document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #fde, #ffe)' - return ( - <section> - <Route exact path='/pix2wav/new/' component={Pix2WavNew} /> - <Route exact path='/pix2wav/datasets/' component={Pix2WavShow} /> - <Route exact path='/pix2wav/datasets/:id/' component={Pix2WavShow} /> - <Route exact path='/pix2wav/live/' component={Pix2WavLive} /> - </section> - ) +class router { + componentWillMount(){ + actions.system.changeTool('pix2wav') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #bdf, #def)' + } + componentWillReceiveProps(){ + actions.system.changeTool('pix2wav') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #bdf, #def)' + } + render(){ + return ( + <section> + <Route exact path='/pix2wav/new/' component={Pix2WavNew} /> + <Route exact path='/pix2wav/datasets/' component={Pix2WavShow} /> + <Route exact path='/pix2wav/datasets/:id/' component={Pix2WavShow} /> + <Route exact path='/pix2wav/live/' component={Pix2WavLive} /> + </section> + ) + } } function links(){ diff --git a/app/client/modules/samplernn/index.js b/app/client/modules/samplernn/index.js index 2a9d64d..85c99e4 100644 --- a/app/client/modules/samplernn/index.js +++ b/app/client/modules/samplernn/index.js @@ -1,5 +1,8 @@ import { h, Component } from 'preact' import { Route, Link } from 'react-router-dom' + +import actions from '../../actions' + import util from '../../util' import SampleRNNNew from './views/samplernn.new' @@ -8,18 +11,27 @@ import SampleRNNImport from './views/samplernn.import' import SampleRNNResults from './views/samplernn.results' import SampleRNNGraph from './views/samplernn.graph' -function router () { - document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #eef, #fef)' - return ( - <section> - <Route exact path='/samplernn/new' component={SampleRNNNew} /> - <Route exact path='/samplernn/datasets' component={SampleRNNShow} /> - <Route exact path='/samplernn/datasets/:id' component={SampleRNNShow} /> - <Route exact path='/samplernn/import' component={SampleRNNImport} /> - <Route exact path='/samplernn/results' component={SampleRNNResults} /> - <Route exact path='/samplernn/graph' component={SampleRNNGraph} /> - </section> - ) +class router { + componentWillMount(){ + actions.system.changeTool('samplernn') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #eef, #fef)' + } + componentWillReceiveProps(){ + actions.system.changeTool('samplernn') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #eef, #fef)' + } + render(){ + return ( + <section> + <Route exact path='/samplernn/new' component={SampleRNNNew} /> + <Route exact path='/samplernn/datasets' component={SampleRNNShow} /> + <Route exact path='/samplernn/datasets/:id' component={SampleRNNShow} /> + <Route exact path='/samplernn/import' component={SampleRNNImport} /> + <Route exact path='/samplernn/results' component={SampleRNNResults} /> + <Route exact path='/samplernn/graph' component={SampleRNNGraph} /> + </section> + ) + } } function links(){ diff --git a/app/client/system/system.actions.js b/app/client/system/system.actions.js index 7831704..a34bd58 100644 --- a/app/client/system/system.actions.js +++ b/app/client/system/system.actions.js @@ -1,7 +1,7 @@ import socket from '../socket' import types from '../types' -import actions from '../actions' +// import actions from '../actions' export const run = (cmd) => (dispatch) => { dispatch({ type: types.system.running_command, cmd }) @@ -26,6 +26,7 @@ export const listDirectory = (opt) => (dispatch) => { } export const changeTool = (tool) => { + localStorage.setItem('system.last_tool', tool) return { type: types.app.change_tool, tool } } @@ -35,7 +36,7 @@ export const enqueue_test_task = (dataset) => dispatch => { activity: 'cpu', dataset: dataset, } - return actions.queue.add_task(task) + // return actions.queue.add_task(task) } window.addEventListener('keyDown', e => { diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js index dd980ea..b6c5a83 100644 --- a/app/client/system/system.reducer.js +++ b/app/client/system/system.reducer.js @@ -10,7 +10,7 @@ const systemInitialState = { name: 'loading', }, app: { - tool: 'pix2pix', + tool: localStorage.getItem('system.last_tool') || 'pix2pix', }, server: { connected: false, diff --git a/app/relay/modules/pix2pix.js b/app/relay/modules/pix2pix.js index 54fcdc3..6979be5 100644 --- a/app/relay/modules/pix2pix.js +++ b/app/relay/modules/pix2pix.js @@ -1,4 +1,5 @@ import path from 'path' +import fs from 'fs' const name = 'pix2pix' const cwd = process.env.PIX2PIX_CWD || path.join(process.env.HOME, 'code/' + name + '/') @@ -58,8 +59,20 @@ const train = { type: 'pytorch', script: 'train.py', params: (task) => { + let epoch = 0 + const datasets_path = path.join(cwd, 'datasets', task.module, task.dataset) + const checkpoints_path = path.join(cwd, 'checkpoints', task.module, task.dataset) + if (fs.existsSync(checkpoints_path)) { + try { + const checkpoints = fs.readdirSync(checkpoints_path) + checkpoints.forEach(c => { + epoch = Math.max(parseInt(c.name) || 0, epoch) + }) + console.log(task.module, task.dataset, epoch, task.epochs) + } catch (e) { } + } return [ - '--dataroot', path.join(cwd, 'datasets', task.module, task.dataset), + '--dataroot', datasets_path, '--module-name', task.module, '--name', task.dataset, '--model', 'pix2pix', @@ -69,7 +82,9 @@ const train = { '--which_direction', 'AtoB', '--lambda_B', 100, '--dataset_mode', 'aligned', - '--epoch_count', task.epochs, + '--epoch_count', task.epoch + task.epochs + 1, + '--niter', task.epochs, + '--niter_decay', 0, '--which_epoch', 'latest', '--continue_train', '--no_lsgan', |
