Compare commits

...

3 Commits

Author SHA1 Message Date
Starbeamrainbowlabs 9acfd0633e
new sample summary, courtesy of ChatGPT :P
continuous-integration/laminar-eldarion Build 3 succeeded in 11 seconds . Details
2023-03-04 22:25:24 +00:00
Starbeamrainbowlabs 65b18cc1f0
bugfix: make parsing more robust
Now it parses output from ChatGPT :P
2023-03-04 22:24:43 +00:00
Starbeamrainbowlabs ae595b45e6
esbuild: add watching 2023-03-04 22:11:16 +00:00
5 changed files with 61 additions and 16 deletions

View File

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

14
samples/lstm 2.txt Normal file
View File

@ -0,0 +1,14 @@
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,7 +13,6 @@ 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,10 +57,8 @@ async function do_html() {
}
}
(async () => {
"use strict";
const result = await esbuild.build({
function make_context() {
return {
entryPoints: [
"./app.mjs",
"./app.css",
@ -79,10 +77,40 @@ async function do_html() {
".ttf": "file",
},
external: ["fs", "path"],
});
if (result.errors.length > 0 || result.warnings.length > 0)
console.log(result);
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();
})
}
}
]
};
}
await do_html();
(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();
// console.log(await esbuild.analyzeMetafile(result.metafile));
})();
})();

View File

@ -15,12 +15,14 @@ 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) {
if(line.trim().length == 0) {
console.log(`DEBUG:layers/line`, line, `CONDITION B`, line.trim().search(/^\-+$/));
if(line.trim().length == 0 || line.trim().search(/^[-_]+$/) > -1) {
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
@ -39,7 +41,8 @@ export default function parse_summary(text) {
result.connected_to = [ layer_prev.name ];
}
result.type = result.name_raw.match(/ \(([^)]+)\)/)[1];
console.log(`DEBUG:result`, result)
result.type = result.name_raw.match(/ \(([^)]+)(?:\)|$)/)[1];
result.name = result.name_raw.split(/\s+/)[0];
layer_prev = result;
@ -47,8 +50,8 @@ export default function parse_summary(text) {
acc.length = 0;
}
acc.push(line);
else
acc.push(line);
}
const edges = [];