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

Fix JAX allocating too much memory and remove unnecessary import. #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JankowskiChristopher
Copy link

Hello,
Setting the flag:

os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false'

did not correctly impact JAX, as it was done after the import. Therefore JAX allocated ~80% of memory of the GPU. When I moved this line of code to the beginning the usage of memory dropped to ~15% (Tested on Nvidia Titan V, HalfCheetah-v4 environment).

Also the import:

from stable_baselines3.common.callbacks import EvalCallback,

Is not used as EvalCallback is imported from sbx.sac.actor_critic_evaluation_callback. It is safer to delete this unnecessary import as it can clash with the other and also some programs e.g. isort when sorting the imports change the order and EvalCallback is then imported from stable_baselines3 instead of sbx.sac.actor_critic_evaluation_callback (that happened in my case when I sorted the imports.)

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

Successfully merging this pull request may close these issues.

1 participant