Coder Social home page Coder Social logo

Comments (8)

fehiepsi avatar fehiepsi commented on July 17, 2024 1

Yup, I can confirm this is a regression of JAX. This happens for other samplers too: e.g. random.normal.

random.normal(random.PRNGKey(0), (1000,))

Jax 0.1.24 took 1ms
while Jax 0.1.25 took more than 100ms

cc @mattjj

from numpyro.

fehiepsi avatar fehiepsi commented on July 17, 2024 1

@neerajprad It seems that LKJ does not perform well in CPU w.r.t. GPU is because of vector_to_tril_matrix function, not because of gamma sampler. Most of 5s in the benchmark is spent for this function. I reported the issue here: google/jax#695. :)

from numpyro.

fehiepsi avatar fehiepsi commented on July 17, 2024

This is bad. I believe this is a regression because it happens for standard_gamma too.

from numpyro.

neerajprad avatar neerajprad commented on July 17, 2024

I believe this is a regression because it happens for standard_gamma too.

I noticed this because test_distributions.py seems to be unusually slow now (earlier it was only initial calls to some tests during which standard_gamma would be compiled for a few shapes), so I think this is a regression too.

from numpyro.

fehiepsi avatar fehiepsi commented on July 17, 2024

It seems a bit weird that if I wrap these samplers in a dummy function

def f():
    return random.normal(random.PRNGKey(0), (1000,))

then it is fast again.
This applies for standard_gamma too but does not apply for our distribution class. >"<

from numpyro.

neerajprad avatar neerajprad commented on July 17, 2024

This applies for standard_gamma too but does not apply for our distribution class. >"<

Hmm..maybe the cache key is different now and for some reason we are generating a new key with our distribution classes and missing the cache. I'll take a look at it too.

from numpyro.

fehiepsi avatar fehiepsi commented on July 17, 2024

The fix is landed in the new version of JAX. Hopefully our tests will be faster now.

from numpyro.

neerajprad avatar neerajprad commented on July 17, 2024

@neerajprad It seems that LKJ does not perform well in CPU w.r.t. GPU is because of vector_to_tril_matrix function, not because of gamma sampler.

Whoa..that's great to know. Thanks for digging into this, and pinning it down!

from numpyro.

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.