-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Tune] [Train] Only convert a BaseTrainer
to Trainable
once in the Tuner
#30355
[Tune] [Train] Only convert a BaseTrainer
to Trainable
once in the Tuner
#30355
Conversation
Signed-off-by: Justin Yu <[email protected]>
Signed-off-by: Justin Yu <[email protected]>
Signed-off-by: Justin Yu <[email protected]>
Signed-off-by: Justin Yu <[email protected]>
…ert_trainable_caching
Thanks, this is great. To be extra safe, I'd propose to consider using properties to link @property
def _trainable(self):
return self.__trainable
@property
def _converted_trainable(self):
return self.__converted_trainable
@_trainable.setter
def _trainable(self, value):
self.__trainable = value
self.__converted_trainable = self._convert_trainable(self.__trainable) (and change the keys in constants to account for extra underscores) My worry (even if that's a very unlikely situation) is that we can end up with a situation where Let me know what you think! |
This makes sense, I'll go ahead and make the change! |
Signed-off-by: Justin Yu <[email protected]>
One thing that I had to change was:
|
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, thanks!
…e Tuner (ray-project#30355) When using Tune with Train (Tuner(trainer)), the trainer is currently being converted to a Tune Trainable multiple times. This is possibly expensive, since BaseTrainer.as_trainable will put all of its config (which could contain a large checkpointed model in resume_from_checkpoint) into the object store from a call to tune.with_parameters. This PR makes it so that the conversion only happens once. Signed-off-by: Justin Yu <[email protected]> Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Justin Yu [email protected]
Why are these changes needed?
When using Tune with Train (
Tuner(trainer)
), the trainer is currently being converted to a TuneTrainable
multiple times. This is possibly expensive, sinceBaseTrainer.as_trainable
will put all of its config (which could contain a large checkpointed model inresume_from_checkpoint
) into the object store from a call totune.with_parameters
. This PR makes it so that the conversion only happens once.Related issue number
Closes #30321
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.