Giter VIP home page Giter VIP logo

Comments (5)

lindapaiste avatar lindapaiste commented on June 26, 2024 1

Seems like it's all TensorFlow? Screenshot of the webpack-bundle-analyzer. It does seem like we have both the webgl and cpu backends in the bundle. We may want to include only 1 backend, so that it works out of the box, and tell the user to include an additional <script> tag to register any other backends.

image

Edit: now I'm looking at the bundle and we're including source maps. We don't want those in a production build because they are huge.

We also have a comment block with the Google License that appears over 1,000 times even in the .min.js file. Seems excessive.

from ml5-next-gen.

shiffman avatar shiffman commented on June 26, 2024

So it looks like #111 may have increased the filesize, @ziyuan-linn will take a look.

from ml5-next-gen.

ziyuan-linn avatar ziyuan-linn commented on June 26, 2024

@lindapaiste Thank you for looking into this. I set extractComments to true and it reduced the file size from 4.18 Mib to 3.43 Mib!

Though I am pretty sure the source map is built to a different file named ml5.min.js.map. I tried changing devtool to false and the bundle size did not change.

from ml5-next-gen.

shiffman avatar shiffman commented on June 26, 2024

This is probably a longer term discussion, but just thinking through some ideas for the future:

  • What if we don't include tensorflow.js at all in the bundle? What would be required for ml5.js end users, is it as simple as just including the tf.js script tag as well? Maybe this has no real benefit since the overall size of the webpage wouldn't change.
  • The cpu back-end is needed for the neuroevolution examples, but is otherwise rarely used. We could consider a build process that creates separate versions ml5.min.js, ml5.webgl.min.js, ml5.cpu.min.js? Or even build ml5.js in a modular way so that beginners can use the entire library, but if someone is building a project that uses only, say, facemesh, they could load ml5-facemesh.min.js?

This discussion may become a higher priority if/when we consider bundling other backends for supporting new models, like transformers.js.

3.48Mb feels "ok" to me for now so maybe we revisit this after 1.0?

from ml5-next-gen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.