Comparar commits
12 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 4b87d5867d | |||
| e53b684b45 | |||
| c8e9dfd0e0 | |||
| 8c88bca52b | |||
| de50123046 | |||
| 619a0b8db0 | |||
| 71d79a6d07 | |||
| 4ca379f8b9 | |||
| 53ce61caa6 | |||
| 26398a38d0 | |||
| 11d0a5e113 | |||
| 1d58dd19ab |
+2
-4
@@ -4,9 +4,6 @@
|
||||
[](https://gitter.im/deepforge-dev/deepforge?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://waffle.io/deepforge-dev/deepforge)
|
||||
|
||||
**Notice**: DeepForge is still a work in progress and in beta! That being said, any contributions and/or feedback is greatly appreciated. If you have any questions, check out the [wiki](https://github.com/dfst/deepforge/wiki/) or drop me a line on the gitter!
|
||||
|
||||
|
||||
# DeepForge
|
||||
DeepForge is an open-source visual development environment for deep learning providing end-to-end support for creating deep learning models. This is achieved through providing the ability to design **architectures**, create training **pipelines**, and then execute these pipelines over a cluster. Using a notebook-esque api, users can get real-time feedback about the status of any of their **executions** including compare them side-by-side in real-time.
|
||||
|
||||
@@ -49,6 +46,7 @@ Also, be sure to check out the other available features of the `deepforge` cli;
|
||||
- [Datamodel Developer Slides](https://docs.google.com/presentation/d/1hd3IyUlzW_TIPnzCnE-1pdz00Pw8WaIxYiOW_Hyog-M/edit#slide=id.p)
|
||||
|
||||
## Interested in contributing?
|
||||
Contributions are welcome! Either fork the project and submit some PR's or shoot me an email about getting more involved!
|
||||
Contributions are welcome! Either fork the project and submit some PR's or shoot me an email about getting more involved! If you have any questions, check out the [wiki](https://github.com/dfst/deepforge/wiki/) or drop me a line on the gitter!
|
||||
|
||||
|
||||
Sponsored by [Digital Reasoning](http://www.digitalreasoning.com/)
|
||||
|
||||
+80
-51
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var Command = require('commander').Command,
|
||||
tcpPortUsed = require('tcp-port-used'),
|
||||
program = new Command(),
|
||||
childProcess = require('child_process'),
|
||||
rawSpawn = childProcess.spawn,
|
||||
@@ -118,32 +119,35 @@ var isLocalUri = function(protocol, uri) {
|
||||
uri.indexOf(protocol + '://127.0.0.1') === 0;
|
||||
};
|
||||
|
||||
var checkMongo = function(args, notSilent) {
|
||||
var checkMongo = function(args, notSilent, mongoUri) {
|
||||
// check the webgme config
|
||||
var gmeConfig = require('../config'),
|
||||
mongoUri = gmeConfig.mongo.uri;
|
||||
var gmeConfig = require('../config');
|
||||
|
||||
mongoUri = mongoUri || gmeConfig.mongo.uri;
|
||||
|
||||
if (isLocalUri('mongodb', mongoUri)) {
|
||||
var match = mongoUri.match(/:([0-9]+)/),
|
||||
port = '80';
|
||||
|
||||
if (match) {
|
||||
port = match[1];
|
||||
}
|
||||
|
||||
// Make sure mongo is running locally (using pgrep)
|
||||
try {
|
||||
execSync('pgrep mongod').toString();
|
||||
console.log('MongoDB is already running!');
|
||||
} catch (e) { // no pIds
|
||||
console.log('Starting MongoDB...');
|
||||
var match = mongoUri.match(/:([0-9]+)/),
|
||||
port = '80';
|
||||
|
||||
if (match) {
|
||||
port = match[1];
|
||||
}
|
||||
|
||||
startMongo(args, port, !notSilent);
|
||||
}
|
||||
return tcpPortUsed.waitUntilUsed(+port, 100, 1000);
|
||||
} else if (notSilent) {
|
||||
console.log(`Cannot start remote mongo locally: ${mongoUri}`);
|
||||
} else {
|
||||
console.log(`Using remote mongo: ${mongoUri}`);
|
||||
}
|
||||
return Q();
|
||||
};
|
||||
|
||||
var startMongo = function(args, port, silent) {
|
||||
@@ -209,28 +213,34 @@ var installTorch = function() {
|
||||
args = `clone https://github.com/torch/distro.git ${tgtDir} --recursive`.split(' ');
|
||||
|
||||
return spawn('git', args)
|
||||
.then(code => {
|
||||
if (code !== 0) {
|
||||
if (code === 128) {
|
||||
console.error(`${tgtDir} is not empty. ` +
|
||||
'Please empty it or change the torch directory:\n' +
|
||||
'\n deepforge config torch.dir NEW/TORCH/PATH\n');
|
||||
.catch(result => {
|
||||
var error = result.error || result.stderr ||
|
||||
`Torch install failed with exit code ${result.code}`;
|
||||
|
||||
}
|
||||
if (result.stderr.includes('unable to access')) {
|
||||
error = `Could not access the torch repository. Are you ` +
|
||||
`connected to the internet?\n`;
|
||||
} else if (result.code === 128) {
|
||||
error = `${tgtDir} is not empty. ` +
|
||||
'Please empty it or change the torch directory:\n' +
|
||||
'\n deepforge config torch.dir NEW/TORCH/PATH\n';
|
||||
|
||||
throw `Torch install Failed with exit code ${code}`;
|
||||
} else { // continue installation
|
||||
process.chdir(tgtDir);
|
||||
return spawn('bash', ['install-deps'])
|
||||
.then(() => spawn('bash', ['install.sh'], true))
|
||||
.then(() => {
|
||||
storeConfig('torch.dir', tgtDir);
|
||||
console.log('Installed torch. Please close and ' +
|
||||
're-open your terminal to use DeepForge w/ ' +
|
||||
'torch support!');
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
console.error(error);
|
||||
process.exit(result.code);
|
||||
})
|
||||
.then((code, stderr) => {
|
||||
process.chdir(tgtDir);
|
||||
return spawn('bash', ['install-deps'])
|
||||
.then(() => spawn('bash', ['install.sh'], true))
|
||||
.then(() => {
|
||||
storeConfig('torch.dir', tgtDir);
|
||||
console.log('Installed torch. Please close and ' +
|
||||
're-open your terminal to use DeepForge w/ ' +
|
||||
'torch support!');
|
||||
process.exit(0);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return Q();
|
||||
@@ -243,21 +253,32 @@ var spawn = function(cmd, args, opts) {
|
||||
spawnOpts = typeof opts === 'object' ? opts : null,
|
||||
forwardStdin = opts === true,
|
||||
isOpen = true,
|
||||
stderr = '',
|
||||
err;
|
||||
|
||||
args = args || [];
|
||||
job = spawnOpts ? rawSpawn(cmd, args, spawnOpts) : rawSpawn(cmd, args);
|
||||
job.stdout.on('data', data => process.stdout.write(data));
|
||||
job.stderr.on('data', data => process.stderr.write(data));
|
||||
job.stderr.on('data', data => {
|
||||
stderr += data;
|
||||
process.stderr.write(data);
|
||||
});
|
||||
|
||||
job.on('close', code => {
|
||||
isOpen = false;
|
||||
if (err) {
|
||||
deferred.reject(err, code);
|
||||
if (err || code !== 0) {
|
||||
deferred.reject({
|
||||
code: code,
|
||||
stderr: stderr,
|
||||
error: err
|
||||
});
|
||||
} else {
|
||||
deferred.resolve(code);
|
||||
}
|
||||
});
|
||||
job.on('error', e => err = e);
|
||||
job.on('error', e => {
|
||||
err = e;
|
||||
});
|
||||
|
||||
if (forwardStdin) {
|
||||
process.stdin.on('data', data => {
|
||||
@@ -277,42 +298,49 @@ program.command('start')
|
||||
.option('-w, --worker [url]', 'start a worker and connect to given url. Defaults to local deepforge')
|
||||
.option('-m, --mongo', 'start MongoDB')
|
||||
.action(args => {
|
||||
var main = path.join(__dirname, 'start-local.js');
|
||||
var main = path.join(__dirname, 'start-local.js'),
|
||||
current = Q();
|
||||
|
||||
if (args.port) {
|
||||
process.env.PORT = args.port;
|
||||
}
|
||||
|
||||
if (args.mongo) {
|
||||
current = current.then(() => checkMongo(args, true));
|
||||
}
|
||||
|
||||
if (args.server) {
|
||||
checkMongo(args);
|
||||
main = path.join(__dirname, '..', 'app.js');
|
||||
spawn('node', [main]);
|
||||
current = current
|
||||
.then(() => checkMongo(args))
|
||||
.then(() => {
|
||||
main = path.join(__dirname, '..', 'app.js');
|
||||
return spawn('node', [main]);
|
||||
});
|
||||
}
|
||||
|
||||
if (args.worker) {
|
||||
if (hasTorch()) {
|
||||
installTorchExtras().then(() => {
|
||||
main = path.join(__dirname, 'start-worker.js');
|
||||
if (args.worker !== true) {
|
||||
spawn('node', [main, args.worker]);
|
||||
} else {
|
||||
spawn('node', [main]);
|
||||
}
|
||||
});
|
||||
current
|
||||
.then(() => installTorchExtras())
|
||||
.then(() => {
|
||||
main = path.join(__dirname, 'start-worker.js');
|
||||
if (args.worker !== true) {
|
||||
spawn('node', [main, args.worker]);
|
||||
} else {
|
||||
spawn('node', [main]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
installTorch();
|
||||
}
|
||||
}
|
||||
|
||||
if (args.mongo) {
|
||||
checkMongo(args, true);
|
||||
}
|
||||
|
||||
if (!args.server && !args.worker && !args.mongo) {
|
||||
// Starting everything
|
||||
checkMongo(args);
|
||||
current = current.then(() => checkMongo(args));
|
||||
if (hasTorch()) {
|
||||
installTorchExtras().then(() => spawn('node', [main]));
|
||||
current.then(() => installTorchExtras())
|
||||
.then(() => spawn('node', [main]));
|
||||
} else {
|
||||
installTorch();
|
||||
}
|
||||
@@ -458,6 +486,7 @@ module.exports = function(cmd) {
|
||||
cmds.unshift('node');
|
||||
program.parse(cmds);
|
||||
};
|
||||
module.exports.checkMongo = checkMongo;
|
||||
|
||||
if (require.main === module) {
|
||||
program.parse(process.argv);
|
||||
|
||||
@@ -73,6 +73,9 @@ var createConfigJson = function() {
|
||||
|
||||
if (process.argv.length > 2) {
|
||||
address = process.argv[2];
|
||||
if (!/^https?:\/\//.test(address)) {
|
||||
address = 'http://' + address;
|
||||
}
|
||||
}
|
||||
|
||||
config[address] = {};
|
||||
|
||||
gerado
+1350
-633
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+4
-3
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "deepforge",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/deepforge-dev/deepforge.git"
|
||||
"type": "git",
|
||||
"url": "https://github.com/deepforge-dev/deepforge.git"
|
||||
},
|
||||
"bin": {
|
||||
"deepforge": "./bin/deepforge"
|
||||
@@ -17,7 +17,7 @@
|
||||
"watch-test": "nodemon --exec 'mocha --recursive test'",
|
||||
"build-nn": "node ./utils/nn-parser.js"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"version": "1.2.0",
|
||||
"dependencies": {
|
||||
"commander": "^2.9.0",
|
||||
"dotenv": "^2.0.0",
|
||||
@@ -32,6 +32,7 @@
|
||||
"npm": "^4.0.5",
|
||||
"q": "1.4.1",
|
||||
"rimraf": "^2.4.0",
|
||||
"tcp-port-used": "^0.1.2",
|
||||
"webgme": "^2.7.1",
|
||||
"webgme-autoviz": "^2.2.0",
|
||||
"webgme-breadcrumbheader": "^2.1.1",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
CONTAINED_LAYER_INDEX: 'index',
|
||||
|
||||
LINE_OFFSET: 'lineOffset',
|
||||
DISPLAY_COLOR: 'displayColor',
|
||||
|
||||
// DeepForge metadata creation in dist execution
|
||||
START_CMD: 'deepforge-cmd',
|
||||
@@ -30,6 +31,10 @@
|
||||
GRAPH_CREATE: 'GRAPH',
|
||||
GRAPH_PLOT: 'PLOT',
|
||||
GRAPH_CREATE_LINE: 'LINE',
|
||||
GRAPH_LABEL_AXIS: {
|
||||
X: 'X',
|
||||
Y: 'Y'
|
||||
},
|
||||
|
||||
// Code Generation Constants
|
||||
CTOR_ARGS_ATTR: 'ctor_arg_order',
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
// adding a "plus" button for creating new objects in line
|
||||
|
||||
define([
|
||||
'deepforge/Constants',
|
||||
'q',
|
||||
'css!./NodePrompter.css'
|
||||
], function(
|
||||
Constants,
|
||||
Q
|
||||
) {
|
||||
|
||||
@@ -271,12 +273,14 @@ define([
|
||||
};
|
||||
|
||||
var Container = function(svg, node) { // used for positioning
|
||||
var colorAttr = node.attributes[Constants.DISPLAY_COLOR];
|
||||
this.$el = svg.append('g');
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.node = node;
|
||||
this.decorator = new node.Decorator({
|
||||
node: node,
|
||||
color: colorAttr && colorAttr.value,
|
||||
parentEl: this.$el
|
||||
});
|
||||
};
|
||||
|
||||
@@ -103,6 +103,10 @@ define([
|
||||
delete desc.attributes.code;
|
||||
}
|
||||
|
||||
// Handle the display color
|
||||
desc.displayColor = desc.attributes[CONSTANTS.DISPLAY_COLOR].value;
|
||||
delete desc.attributes[CONSTANTS.DISPLAY_COLOR];
|
||||
|
||||
} else if (desc.isConnection) {
|
||||
// Set src, dst to siblings and add srcPort, dstPort
|
||||
desc.srcPort = desc.src;
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
/*jshint browser: true, camelcase: false*/
|
||||
|
||||
define([
|
||||
'deepforge/Constants',
|
||||
'decorators/EllipseDecorator/EasyDAG/EllipseDecorator.EasyDAGWidget',
|
||||
'css!./OperationDecorator.EasyDAGWidget.css'
|
||||
], function (
|
||||
CONSTANTS,
|
||||
DecoratorBase
|
||||
) {
|
||||
|
||||
@@ -13,6 +15,7 @@ define([
|
||||
var OperationDecorator,
|
||||
NAME_MARGIN = 25,
|
||||
DECORATOR_ID = 'OperationDecorator',
|
||||
OPERATION_COLORS = {},
|
||||
PORT_TOOLTIP_OPTS = {
|
||||
tipJoint: 'left',
|
||||
removeElementsOnHide: true,
|
||||
@@ -24,8 +27,10 @@ define([
|
||||
// - highlight ports
|
||||
// - unhighlight ports
|
||||
// - report the location of specific ports
|
||||
OPERATION_COLORS[CONSTANTS.OP.OUTPUT] = '#b0bec5';
|
||||
OPERATION_COLORS[CONSTANTS.OP.INPUT] = '#b0bec5';
|
||||
OperationDecorator = function (options) {
|
||||
options.color = options.color || '#78909c';
|
||||
options.color = OPERATION_COLORS[options.node.name] || options.color || '#78909c';
|
||||
DecoratorBase.call(this, options);
|
||||
|
||||
this.id = this._node.id;
|
||||
|
||||
@@ -11,6 +11,15 @@ define([
|
||||
CONSTANTS
|
||||
) {
|
||||
|
||||
var SKIP_ATTRIBUTES = [
|
||||
'code',
|
||||
'stdout',
|
||||
'execFiles',
|
||||
'jobId',
|
||||
'secret',
|
||||
CONSTANTS.LINE_OFFSET,
|
||||
CONSTANTS.DISPLAY_COLOR
|
||||
];
|
||||
var ExecuteJob = function() {
|
||||
};
|
||||
|
||||
@@ -285,13 +294,12 @@ define([
|
||||
};
|
||||
|
||||
ExecuteJob.prototype.createAttributeFile = function (node, files) {
|
||||
var skip = ['code', 'stdout', 'execFiles', 'jobId', 'secret', CONSTANTS.LINE_OFFSET],
|
||||
numOrBool = /^(-?\d+\.?\d*((e|e-)\d+)?|(true|false))$/,
|
||||
var numOrBool = /^(-?\d+\.?\d*((e|e-)\d+)?|(true|false))$/,
|
||||
table;
|
||||
|
||||
this.logger.info('Creating attributes file...');
|
||||
table = '{\n\t' + this.core.getAttributeNames(node)
|
||||
.filter(attr => skip.indexOf(attr) === -1)
|
||||
.filter(attr => SKIP_ATTRIBUTES.indexOf(attr) === -1)
|
||||
.map(name => {
|
||||
var value = this.getAttribute(node, name);
|
||||
if (!numOrBool.test(value)) {
|
||||
|
||||
@@ -30,6 +30,30 @@ define([
|
||||
this._metadata[id] = graph;
|
||||
};
|
||||
|
||||
ExecuteJob.prototype[CONSTANTS.GRAPH_LABEL_AXIS.X] = function (job, id) {
|
||||
var name = Array.prototype.slice.call(arguments, 2).join(' '),
|
||||
jobId = this.core.getPath(job),
|
||||
graph;
|
||||
|
||||
id = jobId + '/' + id;
|
||||
this.logger.info(`Labeling the x-axis of ${id}: ${name}`);
|
||||
|
||||
graph = this._metadata[id];
|
||||
this.setAttribute(graph, 'xlabel', name);
|
||||
};
|
||||
|
||||
ExecuteJob.prototype[CONSTANTS.GRAPH_LABEL_AXIS.Y] = function (job, id) {
|
||||
var name = Array.prototype.slice.call(arguments, 2).join(' '),
|
||||
jobId = this.core.getPath(job),
|
||||
graph;
|
||||
|
||||
id = jobId + '/' + id;
|
||||
this.logger.info(`Labeling the y-axis of ${id}: ${name}`);
|
||||
|
||||
graph = this._metadata[id];
|
||||
this.setAttribute(graph, 'ylabel', name);
|
||||
};
|
||||
|
||||
ExecuteJob.prototype[CONSTANTS.GRAPH_PLOT] = function (job, id, x, y) {
|
||||
var jobId = this.core.getPath(job),
|
||||
nonNum = /[^\d-\.]*/g,
|
||||
|
||||
@@ -52,6 +52,14 @@ function Graph:line(name, opts)
|
||||
return deepforge._Line(self.id, name, opts)
|
||||
end
|
||||
|
||||
function Graph:xlabel(name)
|
||||
deepforge._cmd('<%= GRAPH_LABEL_AXIS.X %>', self.id, name)
|
||||
end
|
||||
|
||||
function Graph:ylabel(name)
|
||||
deepforge._cmd('<%= GRAPH_LABEL_AXIS.Y %>', self.id, name)
|
||||
end
|
||||
|
||||
-- Image support
|
||||
local function saveImage(name, tensor)
|
||||
require 'image'
|
||||
|
||||
@@ -130,7 +130,7 @@ define([
|
||||
var args = this.createArgString(layer),
|
||||
def = `nn.${layer.name}${args}`,
|
||||
type = layer.base.base.name,
|
||||
addedIds,
|
||||
memberIds,
|
||||
node,
|
||||
name,
|
||||
children,
|
||||
@@ -141,28 +141,32 @@ define([
|
||||
// each nested architecture's code to the given container
|
||||
if (type === 'Container') {
|
||||
// Get the members of the 'addLayers' set
|
||||
addedIds = {};
|
||||
memberIds = {};
|
||||
id = layer[SimpleNodeConstants.NODE_PATH];
|
||||
node = this._nodeCache[id];
|
||||
this.core.getMemberPaths(node, Constants.CONTAINED_LAYER_SET)
|
||||
.forEach(id => addedIds[id] = true);
|
||||
.forEach(id => memberIds[id] = true);
|
||||
|
||||
// Get the (sorted) children
|
||||
children = layer[SimpleNodeConstants.CHILDREN]
|
||||
.map(child => { // get (child, index) tuples
|
||||
var index;
|
||||
var index = null;
|
||||
|
||||
id = child[SimpleNodeConstants.NODE_PATH];
|
||||
index = this.core.getMemberRegistry(node, Constants.CONTAINED_LAYER_SET, id, Constants.CONTAINED_LAYER_INDEX);
|
||||
if (memberIds[id]) {
|
||||
index = this.core.getMemberRegistry(node,
|
||||
Constants.CONTAINED_LAYER_SET, id, Constants.CONTAINED_LAYER_INDEX);
|
||||
}
|
||||
return [child, index];
|
||||
})
|
||||
.filter(pair => pair[1] !== undefined) // remove non-members
|
||||
.filter(pair => pair[1] !== null) // remove non-members
|
||||
.sort((a, b) => a[1] < b[1] ? -1 : 1) // sort by 'index'
|
||||
.map(pair => pair[0]);
|
||||
|
||||
|
||||
var addedLayerDefs = '',
|
||||
firstLayer;
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
id = children[i][SimpleNodeConstants.NODE_PATH];
|
||||
// Get the children!
|
||||
|
||||
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
@@ -1 +1 @@
|
||||
0.4.1
|
||||
0.6.0
|
||||
Arquivo binário não exibido.
@@ -28,5 +28,28 @@ define([
|
||||
return desc;
|
||||
};
|
||||
|
||||
ArchIndexControl.prototype._initWidgetEventHandlers = function () {
|
||||
this._widget.deletePipeline = id => {
|
||||
var node = this._client.getNode(id),
|
||||
name = node.getAttribute('name'),
|
||||
msg = `Deleted "${name}" architecture`;
|
||||
|
||||
|
||||
this._client.startTransaction(msg);
|
||||
this._client.deleteNode(id);
|
||||
this._client.completeTransaction();
|
||||
};
|
||||
|
||||
this._widget.setName = (id, name) => {
|
||||
var oldName = this._client.getNode(id).getAttribute('name'),
|
||||
msg = `Renaming architecture: "${oldName}" -> "${name}"`;
|
||||
|
||||
if (oldName !== name && !/^\s*$/.test(name)) {
|
||||
this._client.startTransaction(msg);
|
||||
this._client.setAttribute(id, 'name', name);
|
||||
this._client.completeTransaction();
|
||||
}
|
||||
};
|
||||
};
|
||||
return ArchIndexControl;
|
||||
});
|
||||
|
||||
@@ -116,6 +116,7 @@ define([
|
||||
allAttrs = {},
|
||||
hiddenAttrs = [
|
||||
CONSTANTS.LINE_OFFSET,
|
||||
CONSTANTS.DISPLAY_COLOR,
|
||||
'code',
|
||||
'name'
|
||||
],
|
||||
|
||||
@@ -99,6 +99,9 @@ define([
|
||||
|
||||
desc.type = 'line';
|
||||
desc.points = points;
|
||||
} else {
|
||||
desc.xlabel = node.getAttribute('xlabel');
|
||||
desc.ylabel = node.getAttribute('ylabel');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +155,8 @@ define([
|
||||
// Remove DeepForge hidden attributes
|
||||
delete desc.attributes.code;
|
||||
delete desc.attributes[CONSTANTS.LINE_OFFSET];
|
||||
desc.displayColor = desc.attributes[CONSTANTS.DISPLAY_COLOR].value;
|
||||
delete desc.attributes[CONSTANTS.DISPLAY_COLOR];
|
||||
}
|
||||
|
||||
// Extra decoration for data
|
||||
|
||||
@@ -32,9 +32,7 @@ define([
|
||||
SRC: 'src',
|
||||
DST: 'dst'
|
||||
},
|
||||
DECORATORS = {
|
||||
ArtifactFinder: 'ArtifactOpDecorator'
|
||||
},
|
||||
DECORATORS = {},
|
||||
WIDGET_NAME = 'EasyDAG';
|
||||
|
||||
DECORATORS[CONSTANTS.OP.INPUT] = 'ArtifactOpDecorator';
|
||||
|
||||
@@ -23,7 +23,9 @@ define([
|
||||
var jobName = this.selectedItem.desc.name;
|
||||
|
||||
// Check if it is an Input or Output job
|
||||
if (jobName !== CONSTANTS.OP.INPUT && jobName !== CONSTANTS.OP.OUTPUT) {
|
||||
if (!this.selectedItem.isConnection && jobName !== CONSTANTS.OP.INPUT &&
|
||||
jobName !== CONSTANTS.OP.OUTPUT) {
|
||||
|
||||
new Buttons.Enter({
|
||||
context: this._widget,
|
||||
$pEl: this.$selection,
|
||||
|
||||
@@ -42,17 +42,16 @@ define([
|
||||
|
||||
chart.xAxis
|
||||
.tickFormat(d3.format(',r'));
|
||||
|
||||
if (this.options.xAxis) {
|
||||
chart.xAxis
|
||||
.axisLabel(this.options.xAxis);
|
||||
}
|
||||
|
||||
chart.yAxis.tickFormat(d3.format('.02f'));
|
||||
|
||||
if (this.options.yAxis) {
|
||||
chart.yAxis
|
||||
.axisLabel(this.options.yAxis);
|
||||
}
|
||||
if (this.options.xAxis) {
|
||||
chart.xAxis
|
||||
.axisLabel(this.options.xAxis);
|
||||
}
|
||||
|
||||
var myData = this.getData();
|
||||
|
||||
@@ -83,6 +82,9 @@ define([
|
||||
key: desc.name,
|
||||
values: desc.points
|
||||
};
|
||||
} else {
|
||||
this.options.xAxis = desc.xlabel;
|
||||
this.options.yAxis = desc.ylabel;
|
||||
}
|
||||
this.refreshChart();
|
||||
}
|
||||
@@ -94,11 +96,14 @@ define([
|
||||
};
|
||||
|
||||
LineGraphWidget.prototype.updateNode = function (desc) {
|
||||
if (desc && this.lineData[desc.id]) {
|
||||
if (this.lineData[desc.id]) {
|
||||
this.lineData[desc.id].values = desc.points;
|
||||
this.lineData[desc.id].key = desc.name;
|
||||
this.refreshChart();
|
||||
} else {
|
||||
this.options.xAxis = desc.xlabel;
|
||||
this.options.yAxis = desc.ylabel;
|
||||
}
|
||||
this.refreshChart();
|
||||
};
|
||||
|
||||
LineGraphWidget.prototype.onWidgetContainerResize = function(width, height) {
|
||||
@@ -111,6 +116,17 @@ define([
|
||||
|
||||
LineGraphWidget.prototype.updateChartData = function () {
|
||||
if (this.$chart && this.chart) {
|
||||
|
||||
if (this.options.yAxis) {
|
||||
this.chart.yAxis
|
||||
.axisLabel(this.options.yAxis || '');
|
||||
}
|
||||
if (this.options.xAxis) {
|
||||
this.chart.xAxis
|
||||
.axisLabel(this.options.xAxis || '');
|
||||
}
|
||||
|
||||
|
||||
this.$chart
|
||||
.datum(this.getData())
|
||||
.call(this.chart);
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
/*globals define*/
|
||||
define([
|
||||
'deepforge/viz/Buttons',
|
||||
'deepforge/Constants',
|
||||
'widgets/EasyDAG/Buttons',
|
||||
'widgets/EasyDAG/Icons',
|
||||
'underscore'
|
||||
'underscore',
|
||||
'./lib/spectrum.min'
|
||||
], function(
|
||||
CommonButtons,
|
||||
Constants,
|
||||
EasyDAGButtons,
|
||||
Icons,
|
||||
_
|
||||
) {
|
||||
|
||||
var COLOR_PALETTE = [
|
||||
['#78909c', '#ce93d8', '#ff9100', '#ffb74d', '#ffe0b2'],
|
||||
['#42a5f5', '#80deea', '#80cbc4', '#a5d6a7', '#69f0ae']
|
||||
];
|
||||
var AddOutput = function(params) {
|
||||
params.title = params.title || 'Add operation output';
|
||||
EasyDAGButtons.Add.call(this, params);
|
||||
@@ -89,9 +96,54 @@ define([
|
||||
this.selectionManager.deselect();
|
||||
};
|
||||
|
||||
// Set the color
|
||||
var SetColor = function(params) {
|
||||
params.title = params.title || 'Set operation color';
|
||||
EasyDAGButtons.Add.call(this, params);
|
||||
|
||||
// Add the click handling
|
||||
var currentColor = this.item.desc.displayColor;
|
||||
$('.set-color-icon').spectrum({
|
||||
change: color => this.onColorChanged(color.toHexString()),
|
||||
showPaletteOnly: true,
|
||||
showPalette: true,
|
||||
clickoutFiresChange: true,
|
||||
hideAfterPaletteSelect: true,
|
||||
|
||||
color: currentColor,
|
||||
palette: COLOR_PALETTE
|
||||
});
|
||||
};
|
||||
_.extend(SetColor.prototype, EasyDAGButtons.Add.prototype);
|
||||
|
||||
SetColor.prototype.BTN_CLASS = 'set-color-icon';
|
||||
SetColor.prototype._onClick = function() {};
|
||||
|
||||
SetColor.prototype.onColorChanged = function(color) {
|
||||
// Set the displayColor attribute to the given hex value
|
||||
this.context.saveAttributeForNode(this.item.id, Constants.DISPLAY_COLOR, color);
|
||||
};
|
||||
|
||||
SetColor.prototype._render = function() {
|
||||
var lineRadius = EasyDAGButtons.Add.SIZE - EasyDAGButtons.Add.BORDER,
|
||||
btnColor = '#ffcc80';
|
||||
|
||||
if (this.disabled) {
|
||||
btnColor = '#e0e0e0';
|
||||
}
|
||||
|
||||
this.$el
|
||||
.append('circle')
|
||||
.attr('r', EasyDAGButtons.Add.SIZE)
|
||||
.attr('fill', btnColor);
|
||||
|
||||
Icons.addIcon('brush', this.$el, {radius: lineRadius});
|
||||
};
|
||||
|
||||
return {
|
||||
AddOutput: AddOutput,
|
||||
AddInput: AddInput,
|
||||
SetColor: SetColor,
|
||||
AddRef: AddRef,
|
||||
GoToBase: CommonButtons.GoToBase,
|
||||
Delete: Delete
|
||||
|
||||
@@ -9,6 +9,8 @@ define([
|
||||
|
||||
var Item = function(parentEl, desc) {
|
||||
DAGItem.call(this, parentEl, desc);
|
||||
this.decorator.color = desc.displayColor || this.decorator.color;
|
||||
|
||||
|
||||
// Show the warnings
|
||||
this.$warning = null;
|
||||
@@ -19,6 +21,7 @@ define([
|
||||
_.extend(Item.prototype, DAGItem.prototype);
|
||||
|
||||
Item.prototype.update = function(desc) {
|
||||
this.decorator.color = desc.displayColor || this.decorator.color;
|
||||
DAGItem.prototype.update.call(this, desc);
|
||||
this.updateWarnings();
|
||||
};
|
||||
|
||||
@@ -17,6 +17,12 @@ define([
|
||||
|
||||
_.extend(SelectionManager.prototype, EasyDAGSelectionManager.prototype);
|
||||
|
||||
SelectionManager.prototype.deselect = function() {
|
||||
// this would be better in a 'destroy' method...
|
||||
$('.set-color-icon').spectrum('hide');
|
||||
EasyDAGSelectionManager.prototype.deselect.call(this);
|
||||
};
|
||||
|
||||
SelectionManager.prototype.createActionButtons = function(width, height) {
|
||||
var selectedType = this.selectedItem.desc.baseName,
|
||||
dataNodes,
|
||||
@@ -53,6 +59,14 @@ define([
|
||||
x: 2*width/3,
|
||||
y: 0
|
||||
});
|
||||
|
||||
new Buttons.SetColor({ // Set the operation color
|
||||
context: this._widget,
|
||||
$pEl: this.$selection,
|
||||
item: this.selectedItem,
|
||||
x: 0,
|
||||
y: height
|
||||
});
|
||||
} else { // Data or pointer...
|
||||
new Buttons.Delete({
|
||||
context: this._widget,
|
||||
|
||||
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
@@ -9,7 +9,10 @@ define([
|
||||
|
||||
'use strict';
|
||||
var OperationNode = function(parentEl, desc) {
|
||||
DAGItem.call(this, parentEl, desc);
|
||||
var decoratorOpts = {
|
||||
color: desc.displayColor
|
||||
};
|
||||
DAGItem.call(this, parentEl, desc, decoratorOpts);
|
||||
this.inputs = desc.inputs;
|
||||
this.outputs = desc.outputs;
|
||||
this._visiblePorts = null;
|
||||
|
||||
@@ -64,6 +64,17 @@ define([
|
||||
return 'PipelineEditor';
|
||||
};
|
||||
|
||||
PipelineEditorWidget.prototype.onCreateInitialNode = function() {
|
||||
var initialNodes = this.getValidInitialNodes().map(node => {
|
||||
var colorAttr = node.attributes[CONSTANTS.DISPLAY_COLOR];
|
||||
node.decoratorOpts = {color: colorAttr && colorAttr.value};
|
||||
return {node};
|
||||
});
|
||||
|
||||
AddNodeDialog.prompt(initialNodes)
|
||||
.then(selected => this.createNode(selected.node.id));
|
||||
};
|
||||
|
||||
PipelineEditorWidget.prototype.setupItemCallbacks = function() {
|
||||
ThumbnailWidget.prototype.setupItemCallbacks.call(this);
|
||||
this.ItemClass.prototype.connectPort =
|
||||
|
||||
+31
-6
@@ -81,12 +81,37 @@ describe('cli', function() {
|
||||
cli = require('../../bin/deepforge');
|
||||
});
|
||||
|
||||
it('should check for running mongo', function() {
|
||||
var calls;
|
||||
callRegister.childProcess.execSync = [];
|
||||
cli('start');
|
||||
calls = callRegister.childProcess.execSync;
|
||||
assert.notEqual(calls.indexOf('pgrep mongod'), -1);
|
||||
it('should check for running mongo', function(done) {
|
||||
var mongoListening = false,
|
||||
mongoUri = 'mongodb://127.0.0.1:2016/deepforge-test',
|
||||
net = require('net'),
|
||||
server = net.createServer(function(socket) {
|
||||
socket.on('error', err => {
|
||||
// Only worry about mock server errors if the test hasn't completed
|
||||
assert(mongoListening);
|
||||
});
|
||||
socket.pipe(socket);
|
||||
}),
|
||||
mockStartMongo = function(port) {
|
||||
server.listen(+port, '127.0.0.1');
|
||||
mongoListening = true;
|
||||
};
|
||||
|
||||
// Check that 'spawn' node happens after the tcp port has been bound
|
||||
mocks.childProcess.spawn = function(cmd, opts) {
|
||||
if (cmd === 'mongod') {
|
||||
setTimeout(mockStartMongo, 250, opts[3]);
|
||||
}
|
||||
};
|
||||
|
||||
cli.checkMongo({}, false, mongoUri)
|
||||
.then(() => {
|
||||
console.log('closing server');
|
||||
server.close();
|
||||
assert(mongoListening);
|
||||
done();
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
});
|
||||
|
||||
it('should start mongo if no running mongo', function() {
|
||||
|
||||
@@ -90,6 +90,7 @@ describe('GenerateArchitecture', function () {
|
||||
//['/8', 'basic-transfers.lua'],
|
||||
//['/M', 'concat-parallel.lua'],
|
||||
['/Q', 'basiccontainer.lua'],
|
||||
['/P', 'ContainerWithLayerArgs.lua'],
|
||||
['/4', 'requiredOmitted.lua'],
|
||||
['/e', 'googlenet.lua'],
|
||||
['/X', 'overfeat.lua']
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
require 'nn'
|
||||
require 'rnn'
|
||||
|
||||
local m = nn.Sequential()
|
||||
m:add(nn.Linear(100, 50))
|
||||
m:add(nn.LeakyReLU())
|
||||
m:add(nn.Linear(50, 10))
|
||||
|
||||
|
||||
local net = nn.Sequential()
|
||||
net:add(nn.Bottle(m, 2))
|
||||
|
||||
return net
|
||||
Referência em uma Nova Issue
Bloquear um usuário