diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/live/live.reducer.js | 3 | ||||
| -rw-r--r-- | app/client/modules/pix2pixhd/views/pix2pixhd.live.js | 5 | ||||
| -rw-r--r-- | app/relay/modules/pix2pixhd.js | 1 | ||||
| -rw-r--r-- | app/relay/queue.js | 3 | ||||
| -rw-r--r-- | app/relay/runner.js | 19 |
5 files changed, 26 insertions, 5 deletions
diff --git a/app/client/live/live.reducer.js b/app/client/live/live.reducer.js index 2472594..7fd7667 100644 --- a/app/client/live/live.reducer.js +++ b/app/client/live/live.reducer.js @@ -8,7 +8,8 @@ const liveInitialState = { opt: { hue: 0, saturation: 0, luminosity: 0, sequence_playing: true, sequence_step: 1, - recurse_roll: 0, rotate: 0, scale: 0, process_frac: 0.5 + recurse_roll: 0, rotate: 0, scale: 0, process_frac: 0.5, + view_mode: 'b', }, checkpoints: [], epochs: ['latest'], diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js index 05a23dc..2c89459 100644 --- a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js @@ -152,6 +152,11 @@ class Pix2PixHDLive extends Component { min={-4.0} max={4.0} type='float' /> <Slider live + title='skip frames' + name='sequence_skip' + min={0} max={100} type='int' + /> + <Slider live name='frame_delay' min={0.0} max={2.0} type='float' /> diff --git a/app/relay/modules/pix2pixhd.js b/app/relay/modules/pix2pixhd.js index ebfebf2..42c88d6 100644 --- a/app/relay/modules/pix2pixhd.js +++ b/app/relay/modules/pix2pixhd.js @@ -120,6 +120,7 @@ const live = { '--just-copy', '--poll_delay', opt.poll_delay || 0.09, '--which_epoch', 'latest', '--norm', 'batch', + '--store_b', // comment this line to store all live output ] }, listen: (task, res, i) => { diff --git a/app/relay/queue.js b/app/relay/queue.js index 8cd6f61..5e5a8a6 100644 --- a/app/relay/queue.js +++ b/app/relay/queue.js @@ -32,6 +32,9 @@ export class Queue { remove_task(task){ this.a = this.a.filter(t => t.id !== task.id) } + add_next_task(){ + return this.a.unshift() + } get_next_task(){ return this.a.shift() } diff --git a/app/relay/runner.js b/app/relay/runner.js index 994dcd4..dbfcb4b 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -299,7 +299,8 @@ export function run_task(task, preempt=false, watch=false){ if (! task) return null const module = modules[task.module] if (! module) return { type: 'error', error: "No such module: " + task.module } - const activity = module.activities[task.activity] + const activity = task.activity_object || module.activities[task.activity] + delete task.activity_object if (! activity) return { type: 'error', error: 'No such activity in module: ' + task.module + ' ' + task.activity } return run_task_with_activity(task, module, activity, preempt, watch) } @@ -314,7 +315,7 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa terminate(state.current_gpu_task) } else { console.log('already running GPU task :(', state.current_gpu_task.pid) - return { type: 'error', preempt: false, error: 'task already running on gpu' } + return { type: 'error', busy: true, preempt: false, error: 'task already running on gpu' } } } else if (!interpreter.gpu && state.current_cpu_task.status !== 'IDLE') { if (preempt) { @@ -322,7 +323,7 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa terminate(state.current_cpu_task) } else { console.log('already running CPU task :(') - return { type: 'error', preempt: false, error: 'task already running on cpu' } + return { type: 'error', busy: true, preempt: false, error: 'task already running on cpu' } } } @@ -405,7 +406,17 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa if (task.success && activity.after) { if (activity.after in modules[task.module].activities) { const after_activity = modules[task.module].activities[activity.after] - return run_task_with_activity(task, module, after_activity, preempt, watch) + const task_result = run_task_with_activity(task, module, after_activity, preempt, watch) + if (task_result.busy) { + task.activity_object = after_activity + const interpreter = interpreters[activity.type] + if (interpreter.gpu) { + q.gpu.add_next_task(task) + } else { + q.cpu.add_next_task(task) + } + } + return task_result } else { console.warn('no such after activity:', task.module, activity.after) } |
