Compare commits

..

No commits in common. "9acfd0633eb1ba8a364577bcd83d263fdff368df" and "418e4344b6ad7fcca489a37df9a90dc314f5e9a1" have entirely different histories.

5 changed files with 16 additions and 61 deletions

View file

@ -5,8 +5,7 @@
"main": "src/index.mjs",
"scripts": {
"test": "echo \"No tests have been written yet.\"",
"build": "node ./src/esbuild.mjs",
"watch": "ES_MODE=\"watch\" node ./src/esbuild.mjs"
"build": "node ./src/esbuild.mjs"
},
"repository": {
"type": "git",

View file

@ -1,14 +0,0 @@
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, 500, 16) 160000
_________________________________________________________________
lstm (LSTM) (None, 32) 6272
_________________________________________________________________
dense (Dense) (None, 1) 33
=================================================================
Total params: 166,305
Trainable params: 166,305
Non-trainable params: 0
_________________________________________________________________

View file

@ -13,6 +13,7 @@ function do_visualisation(el_in, el_out) {
console.log(summary);
const svg = make_graph(summary);
console.log(svg);
const container = document.createElement("div");
container.innerHTML = svg;

View file

@ -57,8 +57,10 @@ async function do_html() {
}
}
function make_context() {
return {
(async () => {
"use strict";
const result = await esbuild.build({
entryPoints: [
"./app.mjs",
"./app.css",
@ -77,40 +79,10 @@ function make_context() {
".ttf": "file",
},
external: ["fs", "path"],
plugins: [
{
name: "copy-html",
setup(build) {
build.onEnd(result => {
if (result.errors.length > 0 || result.warnings.length > 0)
console.log(result);
console.log(`${new Date().toISOString()} | Build complete`);
do_html();
})
}
}
]
};
}
});
if (result.errors.length > 0 || result.warnings.length > 0)
console.log(result);
(async () => {
"use strict";
switch(process.env.ES_MODE ?? "build") {
case "build":
const result = await esbuild.build(make_context());
if (result.errors.length > 0 || result.warnings.length > 0)
console.log(result);
break;
case "watch":
const ctx = await esbuild.context(make_context());
await ctx.watch();
console.log(`>>> Watching for changes`);
break;
}
// await do_html();
await do_html();
// console.log(await esbuild.analyzeMetafile(result.metafile));
})();
})();

View file

@ -15,14 +15,12 @@ export default function parse_summary(text) {
const sep_output_shape = lines[2].search("Output Shape");
const sep_param_hash = lines[2].search("Param #");
const sep_connected_to = has_connected_to ? lines[2].search("Connected to") : lines[2].length;
console.log(`DEBUG:layers_raw`, layers_raw);
let layer_prev = null;
let acc = [];
for (const line of layers_raw) {
console.log(`DEBUG:layers/line`, line, `CONDITION B`, line.trim().search(/^\-+$/));
if(line.trim().length == 0 || line.trim().search(/^[-_]+$/) > -1) {
if(line.trim().length == 0) {
if(acc.length === 0) continue;
console.log(`LAYER`);
console.log(`DEBUG:params`, acc.map(layer_line => layer_line.substring(sep_param_hash, sep_connected_to).trim()));
// Handle parsed item
@ -41,8 +39,7 @@ export default function parse_summary(text) {
result.connected_to = [ layer_prev.name ];
}
console.log(`DEBUG:result`, result)
result.type = result.name_raw.match(/ \(([^)]+)(?:\)|$)/)[1];
result.type = result.name_raw.match(/ \(([^)]+)\)/)[1];
result.name = result.name_raw.split(/\s+/)[0];
layer_prev = result;
@ -50,8 +47,8 @@ export default function parse_summary(text) {
acc.length = 0;
}
else
acc.push(line);
acc.push(line);
}
const edges = [];