chore: replace legacy jax.random.PRNGKey with modern jax.random.key#2134
chore: replace legacy jax.random.PRNGKey with modern jax.random.key#2134fehiepsi merged 10 commits intopyro-ppl:masterfrom
jax.random.PRNGKey with modern jax.random.key#2134Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
The following test case is failing on I am unable to reproduce the following test cases on my local machine. Maybe they pass in the next CI. |
0b63438 to
14d3ee8
Compare
|
@fehiepsi, pickling failed again. Can you rerun the CI? |
|
Could you add a simple test in test_pickle to check if we can pickle a PRNGKey? if it happens on CI and is unrelated to numpyro, we can report the issue to jax devs. |
|
It seems the tests are failing consistently. How about using PRNGKey like before in this test? |
And it is only in py3.11. I will use the legacy keys in the tests and report this issue to JAX team. |
|
Issue reported: jax-ml/jax#35065 |
|
@fehiepsi, we fixed the issue related to optax==0.2.7 in #2137. Now flax has pinned the optax version (google/flax#5225), and it is effective in the latest flax==0.12.4. Should we revert the changes? |
|
Sounds reasonable to me. We can revise the test to be flexible when |
As per the official JAX docs,
jax.random.PRNGKeyis a legacy API and should be replaced withjax.random.keywherever possible 1. This PR replaces calls tojax.random.PRNGKeywithjax.random.key, accompanied by necessary documentation.I have replaced "PRNGKey" with "PRNG key" in the documentation to distinguish PRNG key as a concept from the function
jax.random.PRNGKey.Footnotes
See note in https://docs.jax.dev/en/latest/jax.random.html#prng-keys ↩