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

[tune] Introduce tune.with_resources() to specify function trainable resources #26830

Merged
merged 6 commits into from
Jul 22, 2022

Conversation

krfricke
Copy link
Contributor

@krfricke krfricke commented Jul 21, 2022

Why are these changes needed?

We don't have a way to specify resource requirements with the Tuner() API. This PR introduces tune.with_resources() to attach a resource request to class and function trainables. In class trainables, it will override potential existing default resource requests.

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Kai Fricke added 4 commits July 21, 2022 14:42
Signed-off-by: Kai Fricke <[email protected]>
Signed-off-by: Kai Fricke <[email protected]>
Signed-off-by: Kai Fricke <[email protected]>
python/ray/tune/trainable/util.py Outdated Show resolved Hide resolved
python/ray/tune/trainable/util.py Show resolved Hide resolved
def with_resources(
trainable,
resources: Union[
Dict[str, float], PlacementGroupFactory, Callable[[dict], PlacementGroupFactory]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little hesitant about adding PlacementGroupFactory actually.

We need a better API. How about just plain resources dict for now? Until someone yells at us?
it covers most simple cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it for resources_per_trial so it would be a bit odd to leave it out imo.
We could add ScalingConfig here... :-D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the placement group factory for now - it's a tune concept, it's advanced, but it's the same as in resources_per_trial. I'm happy to deprecate this once we have a good alternative, but then we can deprecate it in all places. Does that sound good?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sg!

Signed-off-by: Kai Fricke <[email protected]>
@krfricke krfricke marked this pull request as ready for review July 21, 2022 21:52
@krfricke krfricke changed the title [wip][tune] Proof of concept tune.with_resources() [tune] Proof of concept tune.with_resources() Jul 21, 2022
@krfricke krfricke changed the title [tune] Proof of concept tune.with_resources() [tune] Introduce tune.with_resources() to specify function trainable resources Jul 22, 2022
Signed-off-by: Kai Fricke <[email protected]>
@krfricke krfricke merged commit 0d3a533 into ray-project:master Jul 22, 2022
@krfricke krfricke deleted the tune/with-resources branch July 22, 2022 12:25
Rohan138 pushed a commit to Rohan138/ray that referenced this pull request Jul 28, 2022
…resources (ray-project#26830)

We don't have a way to specify resource requirements with the Tuner() API. This PR introduces tune.with_resources() to attach a resource request to class and function trainables. In class trainables, it will override potential existing default resource requests.

Signed-off-by: Kai Fricke <[email protected]>
Signed-off-by: Rohan138 <[email protected]>
Stefan-1313 pushed a commit to Stefan-1313/ray_mod that referenced this pull request Aug 18, 2022
…resources (ray-project#26830)

We don't have a way to specify resource requirements with the Tuner() API. This PR introduces tune.with_resources() to attach a resource request to class and function trainables. In class trainables, it will override potential existing default resource requests.

Signed-off-by: Kai Fricke <[email protected]>
Signed-off-by: Stefan van der Kleij <[email protected]>
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.

2 participants