chalk-diagrams / chalk

A declarative drawing API in Python
MIT License
276 stars 13 forks source link

SVGs getting very large #123

Closed jerinphilip closed 1 year ago

jerinphilip commented 1 year ago

I'm trying to replicate some of the diagrams in Understanding LSTM Networks with some variations using chalk, mostly for trying out (nothing serious, really).

The following is an attempted render in progress of an SSRU[1], in a similar style, using chalk:

This one uses LaTeX, as you can see from the picture and is very slow to write-out. I suspect this is due to several spawns of diagram generation commands involving LaTex. I also suspect there's some stitching together of glyphs from the latex fonts over subdiagrams happening which is leading to the large size (75MB). One more thing I notice is a large number <g>.. </g> in the SVG code. This is also making it difficult to do some finishing touches in inkscape.

Code is not in a great shape, but please find it here.

[1] From Research to Production and Back: Ludicrously Fast Neural Machine Translation

jerinphilip commented 1 year ago

It appears I've been using diagram += diagram.connect_outside(...) which led to this. Fixed, closing as a wrong report.

srush commented 1 year ago

This is such a cool project. Thanks for trying out Chalk!