Skip to content

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

Open
JankowskiChristopher wants to merge 1 commit intoadityab:mainfrom
JankowskiChristopher:main
Open

Fix JAX allocating too much memory and remove unnecessary import.#5
JankowskiChristopher wants to merge 1 commit intoadityab:mainfrom
JankowskiChristopher:main

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