Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orbax updates causing issues with an old version of jax #60

Open
AdrienBolling opened this issue Jul 3, 2024 · 4 comments
Open

Orbax updates causing issues with an old version of jax #60

AdrienBolling opened this issue Jul 3, 2024 · 4 comments

Comments

@AdrienBolling
Copy link
Contributor

Got the following error while training an agent when it came to saving the agents training.

WARNING:absl:SaveArgs.aggregate is deprecated, please use custom TypeHandler (https://orbax.readthedocs.io/en/latest/custom_handlers.html#typehandler) or contact Orbax team to migrate before August 1st, 2024.
Traceback (most recent call last):
  File "/Users/adrien.bolling/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers-pro/pydevd_asyncio/pydevd_nest_asyncio.py", line 138, in run
    return loop.run_until_complete(task)
  File "/Users/adrien.bolling/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers-pro/pydevd_asyncio/pydevd_nest_asyncio.py", line 243, in run_until_complete
    return f.result()
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/futures.py", line 201, in result
    raise self._exception
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 256, in __step
    result = coro.send(None)
  File "/Users/adrien.bolling/PycharmProjects/technician-assignment/.venv/lib/python3.9/site-packages/orbax/checkpoint/base_pytree_checkpoint_handler.py", line 620, in async_save
    commit_futures = await self.async_save(*args, **kwargs)  # pytype: disable=bad-return-type
  File "/Users/adrien.bolling/PycharmProjects/technician-assignment/.venv/lib/python3.9/site-packages/orbax/checkpoint/base_pytree_checkpoint_handler.py", line 528, in async_save
    save_args = jax.tree.map(
  File "/Users/adrien.bolling/PycharmProjects/technician-assignment/.venv/lib/python3.9/site-packages/jax/_src/deprecations.py", line 53, in getattr
    raise AttributeError(f"module {module!r} has no attribute {name!r}")
AttributeError: module 'jax' has no attribute 'tree'
python-BaseException

This is very likely due to a mismatch between jax and orbax versions, especially considering the recent changes to orbax-checkpoints.

I temporarily fixed it by upgrading jax to 0.4.30 and keeping orbax to 0.5.16, then forcibly downgrading numpy to 1.21.0 and scipy to 1.10.1

It seems to me like this will need a refactor to either use legacy functionnalities that will soon be deprecated, or a global version bump for jax, orbax, numpy, and scipy (the former 2 which in turn break other functions due to behaviour changes, I think it stems from PettingZoo requirements)

Also be advised that such problems will only increase in the future due to the following :

WARNING:absl:SaveArgs.aggregate is deprecated, please use custom TypeHandler (https://orbax.readthedocs.io/en/latest/custom_handlers.html#typehandler) or contact Orbax team to migrate before August 1st, 2024.
@ffelten
Copy link
Collaborator

ffelten commented Oct 24, 2024

Hi @AdrienBolling, would you mind submitting a PR as you seem to have fixed it on your side? :)

@AdrienBolling
Copy link
Contributor Author

@ffelten As mentionned I fixed it by forcibly downgrading certain packages after install, I didn't adapt the code to the new API, I can look into it if needed however

@ffelten
Copy link
Collaborator

ffelten commented Oct 24, 2024

@ffelten As mentionned I fixed it by forcibly downgrading certain packages after install, I didn't adapt the code to the new API, I can look into it if needed however

That would be cool to fix if you have time :-)

@AdrienBolling
Copy link
Contributor Author

Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants