From 7910767b7283e62f03dec5f86e08a796c792080f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 4 Sep 2018 14:45:35 +0200 Subject: list checkpoint and epoch --- app/client/modules/pix2pixhd/pix2pixhd.actions.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'app/client/modules/pix2pixhd/pix2pixhd.actions.js') diff --git a/app/client/modules/pix2pixhd/pix2pixhd.actions.js b/app/client/modules/pix2pixhd/pix2pixhd.actions.js index 6459794..c1cd2b1 100644 --- a/app/client/modules/pix2pixhd/pix2pixhd.actions.js +++ b/app/client/modules/pix2pixhd/pix2pixhd.actions.js @@ -179,4 +179,25 @@ export const load_results = (id) => (dispatch) => { } }) }) +} + +const G_NET_REGEXP = new RegExp('_net_G.pth$') + +export const list_epochs = (checkpoint_name) => (dispatch) => { + const module = pix2pixhdModule.name + actions.socket.list_directory({ module, dir: 'checkpoints/' + checkpoint_name }).then(files => { + // console.log(files) + const epochs = files.map(f => { + if (!f.name.match(G_NET_REGEXP)) return null + return f.name.replace(G_NET_REGEXP, '') + }).filter(f => !!f) + // console.log(epochs) + dispatch({ + type: types.dataset.list_epochs, + data: { + epochs, + module + }, + }) + }) } \ No newline at end of file -- cgit v1.2.3-70-g09d2