-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Make log_line_prefix_template
Optional in Elastic Launcher for Backward Compatibility
#2888
Conversation
log_line_prefix_template
argument from LaunchConfig to ensure compatibility with supported PyTorch versionslog_line_prefix_template
argument from LaunchConfig to ensure compatibility with supported PyTorch versions
Thanks for this PR. I wonder if we could not check the PyTorch version and pass the argument only if it's supported? Alternatively, we could check the signature for this argument, but I'm not a big fan of that. |
Thanks for your review :) It looks like the minimum torch version that supports the target argument is 2.2.0, so I added logic to check for a specific version. |
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.
Thanks for the change. Just one small suggestion from my side.
src/accelerate/launchers.py
Outdated
@@ -235,7 +237,11 @@ def train(*args): | |||
monitor_interval=monitor_interval, | |||
start_method="fork", | |||
) | |||
elastic_launch(config=launch_config, entrypoint=function)(*args) | |||
if is_torch_version(">=", ELASTIC_LOG_LINE_PREFIX_TEMPLATE_PYTORCH_VERSION): | |||
launch_config_kwargs["log_line_prefix_template"] = os.environ.get( |
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.
Instead of trying to get this from the env vars, I think it's better to import the value directly. I don't think there is ever a reason for a user to override this via env vars, is there?
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.
Thanks for your review. I've deleted the logic that takes that value as an environment variable :)
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Thanks, LGTM. Let's wait for another review before merging.
log_line_prefix_template
argument from LaunchConfig to ensure compatibility with supported PyTorch versionslog_line_prefix_template
Optional in Elastic Launcher for Backward Compatibility
Hi there, I wanted to kindly ask about the status of this PR. I don't mean to rush, but this PR is crucial for resolving a bug in my project. Your review and approval would be greatly appreciated :) Thank you for your time and assistance! |
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.
Thanks!
What does this PR do?
This PR addresses an issue with the
notebook_launcher
in theaccelerate
library, where the inclusion of thelog_line_prefix_template
argument in theLaunchConfig
instantiation leads to aTypeError
in certain PyTorch versions. By making this argument optional, we ensure compatibility across all supported PyTorch versions.Description
The
notebook_launcher
function in theaccelerate
library currently includes alog_line_prefix_template
argument when creating aLaunchConfig
instance. However, this argument is not supported in some versions of PyTorch, resulting in aTypeError
. To maintain compatibility with all supported versions of PyTorch, this PR makes the inclusion of thelog_line_prefix_template
argument conditional.Changes Made:
log_line_prefix_template
parameter to the notebook_launcher function.notebook_launcher
function to conditionally include thelog_line_prefix_template
argument in theLaunchConfig
instantiation based on the PyTorch version.Motivation and Context
Ensuring compatibility with a wider range of PyTorch versions is crucial for users who may not be able to upgrade to the latest versions. This change will allow users with different PyTorch versions to use the
notebook_launcher
without encountering errors.Log / Env
Torch Version Comparison
Torch Version 1.10
Torch Version 2.24
Before submitting