-
Notifications
You must be signed in to change notification settings - Fork 861
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
Add Actor Init Callback #2221
Add Actor Init Callback #2221
Conversation
…s removed from pool
Co-authored-by: Daniel J. Beutel <daniel@flower.dev>
Co-authored-by: Daniel J. Beutel <daniel@flower.dev>
log(ERROR, ex) | ||
raise ex | ||
except Exception as ex: | ||
log(ERROR, "Do you have Tensorflow installed?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can log this before the try
by checking if TF
is None
(we should also return from the function in that case).
An exception on this line could be many things (whatever the experimental TensorFlow function decides to raise).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true. i moved the TF check at the top of the function.
Co-authored-by: Daniel J. Beutel <daniel@flower.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
This extends the content of #1969 adding support for Actors to accept a user-defined callback to execute upon object creation. This callback is optional.
One of the most obvious reasons for using this callback is when running Flower with TF. In those cases, due to the default behaviour of TF of mapping the entire VRAM, it's likely that users will encounter OOM immediately (even if their workloads don't actually need all VRAM). Lukily, we can design a workaround by enabling gpu growth. This is exactly what the built-in
enable_tf_gpu_growth
callback insrc/.../simulation/ray_transport/utils.py
allows you to do.You can easily test this by editing the lines around
start_simulation
in the TF simulation example: