summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-09-04 14:45:35 +0200
committerJules Laplace <julescarbon@gmail.com>2018-09-04 14:45:35 +0200
commit7910767b7283e62f03dec5f86e08a796c792080f (patch)
tree9bde717d63fdf3a1caad826022163371a7f810ba /public/bundle.js
parent25815ab4916dc8c9e3256cbfe53bea0535930f30 (diff)
list checkpoint and epoch
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js101
1 files changed, 80 insertions, 21 deletions
diff --git a/public/bundle.js b/public/bundle.js
index 9ad18ad..f2e7ef2 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -3320,6 +3320,7 @@ var NumberInput = function (_Component) {
changed: true
});
this.props.onInput && this.props.onInput(e.target.value, e.target.name);
+ this.props.onChange && this.props.onInput(e.target.name, e.target.value);
}
}, {
key: 'handleKeydown',
@@ -5831,6 +5832,13 @@ var datasetReducer = function datasetReducer() {
case _types2.default.file.destroy:
return handleFileDestroy(state, action);
+ case _types2.default.dataset.list_epochs:
+ return _extends({}, state, {
+ data: _extends({}, state.data, {
+ epochs: action.data.epochs
+ })
+ });
+
default:
return state;
}
@@ -9226,7 +9234,7 @@ exports.default = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.load_results = exports.load_directories = undefined;
+exports.list_epochs = exports.load_results = exports.load_directories = undefined;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
@@ -9441,6 +9449,31 @@ var load_results = exports.load_results = function load_results(id) {
};
};
+var G_NET_REGEXP = new RegExp('_net_G.pth$');
+
+var list_epochs = exports.list_epochs = function list_epochs(checkpoint_name) {
+ return function (dispatch) {
+ var module = _pix2pixhd2.default.name;
+ _actions2.default.socket.list_directory({ module: module, dir: 'checkpoints/' + checkpoint_name }).then(function (files) {
+ // console.log(files)
+ var epochs = files.map(function (f) {
+ if (!f.name.match(G_NET_REGEXP)) return null;
+ return f.name.replace(G_NET_REGEXP, '');
+ }).filter(function (f) {
+ return !!f;
+ });
+ // console.log(epochs)
+ dispatch({
+ type: _types2.default.dataset.list_epochs,
+ data: {
+ epochs: epochs,
+ module: module
+ }
+ });
+ });
+ };
+};
+
/***/ }),
/***/ "./app/client/modules/pix2pixhd/pix2pixhd.module.js":
@@ -10898,7 +10931,7 @@ var Pix2PixHDTrain = function (_Component) {
_this.handleChange = _this.handleChange.bind(_this);
_this.state = {
- sequence: '',
+ checkpoint_name: '',
epoch: 'latest',
augment_take: 100,
augment_make: 20
@@ -10927,14 +10960,24 @@ var Pix2PixHDTrain = function (_Component) {
}
}
}, {
- key: 'handleChange',
- value: function handleChange(value, name) {
- this.setState(_defineProperty({}, name, value));
+ key: 'componentDidUpdate',
+ value: function componentDidUpdate(prevProps, prevState) {
+ if (!prevProps.pix2pixhd.data && this.props.pix2pixhd.data) {
+ console.log('set checkpoint_name');
+ this.setState({
+ checkpoint_name: this.props.pix2pixhd.data.sequences[0].name,
+ epoch: 'latest'
+ });
+ } else if (prevState.checkpoint_name !== this.state.checkpoint_name) {
+ this.setState({ epoch: 'latest' });
+ this.props.actions.list_epochs(this.state.checkpoint_name);
+ }
}
}, {
- key: 'changeCheckpoint',
- value: function changeCheckpoint(name) {
- // this.props.actions.list_epochs('pix2pixhd', nextProps.opt.checkpoint_name)
+ key: 'handleChange',
+ value: function handleChange(name, value) {
+ console.log('name', name, 'value', value);
+ this.setState(_defineProperty({}, name, value));
}
}, {
key: 'render',
@@ -10955,7 +10998,7 @@ var Pix2PixHDTrain = function (_Component) {
datasetLookup = _ref.datasetLookup;
var folder = (folderLookup || {})[pix2pixhd.folder_id] || {};
- console.log(pix2pixhd);
+ // console.log(pix2pixhd)
var checkpointGroups = Object.keys(folderLookup).map(function (id) {
var folder = _this2.props.pix2pixhd.data.folderLookup[id];
@@ -10979,44 +11022,59 @@ var Pix2PixHDTrain = function (_Component) {
return a.name.localeCompare(b.name);
});
+ console.log('state', this.props.pix2pixhd.data.epochs);
+ // console.log(this.state.checkpoint_name, this.state.epoch)
+
return (0, _preact.h)(
'div',
{ className: 'app pix2pixhd' },
(0, _preact.h)(
- 'h1',
- null,
- 'pix2pixhd training'
+ 'div',
+ { 'class': 'heading' },
+ (0, _preact.h)(
+ 'h1',
+ null,
+ 'pix2pixhd training'
+ )
),
(0, _preact.h)(
'div',
{ 'class': 'heading' },
- (0, _preact.h)(_common.SelectGroup, { live: true,
+ (0, _preact.h)(_common.SelectGroup, {
name: 'checkpoint_name',
title: 'Checkpoint',
options: checkpointGroups,
- onChange: this.changeCheckpoint
+ onChange: this.handleChange,
+ value: this.state.checkpoint_name
}),
(0, _preact.h)(_common.Select, {
title: 'Epoch',
+ name: 'epoch',
+ options: this.props.pix2pixhd.data.epochs,
+ onChange: this.handleChange,
value: this.state.epoch
}),
(0, _preact.h)('br', null),
(0, _preact.h)(
_common.Group,
{ title: 'Augment' },
- (0, _preact.h)(_common.TextInput, {
- type: 'number',
+ (0, _preact.h)(_common.NumberInput, {
name: 'augment_take',
title: 'Pick N random frames',
value: this.state.augment_take,
- onInput: this.handleChange
+ onChange: this.handleChange,
+ type: 'int',
+ min: '1',
+ max: '1000'
}),
- (0, _preact.h)(_common.TextInput, {
- type: 'number',
+ (0, _preact.h)(_common.NumberInput, {
name: 'augment_make',
title: 'Generate N recursively',
value: this.state.augment_make,
- onInput: this.handleChange
+ onChange: this.handleChange,
+ type: 'int',
+ min: '1',
+ max: '1000'
}),
(0, _preact.h)(_common.Button, {
title: 'Augment dataset',
@@ -16057,7 +16115,8 @@ exports.default = {
file_progress: 'DATASET_FILE_PROGRESS',
file_uploaded: 'DATASET_FILE_UPLOADED',
fetch_url: 'DATASET_FETCH_URL',
- fetch_progress: 'DATASET_FETCH_PROGRESS'
+ fetch_progress: 'DATASET_FETCH_PROGRESS',
+ list_epochs: 'DATASET_LIST_EPOCHS'
},
samplernn: {
init: 'SAMPLERNN_INIT',