ray.tune.Tuner resource configuration

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

How do you specify the resource usage when using the new Tuner? I’ve tried several different ways, but nothing is working and I get the following:

Error
No trial resources are available for launching the actor

Resources available
>> ray.available_resources()
{'CPU': 16.0, 'node:__internal_head__': 1.0, 'node:172.22.193.158': 1.0, 'memory': 29689181799.0, 'object_store_memory': 14844590899.0}

Implementation:
Pastebin

There seems to be quite a few ways. Here is what I use

    tuner = ray.tune.Tuner(
        tune.with_resources(partial(main, **kwargs), {'cpu': cpus_per_trial, 'gpu': gpus_per_trial}),
        tune_config=ray.tune.TuneConfig(
            ...
        ),  
        param_space=config
    )   
    results = tuner.fit()

I give it a partial method from functools, and then I also pass it a dictionary of my resources per trial with the tune.with_resources function.

Instead of partial it can be beneficial to use tune.with_parameters instead (especially when passing large objects).

But your code from the pastebin generally looks correct. The issue is that PPO itselfs tries to start actors, and there are not enough resources in your placement group for them to start.

You can try building your PPOConfig in the main() function. Then you can use

pgf = ppo.PPO.default_resource_request(config)

to build the placement group factory automatically.

You can then pass the PPOConfig as a param_space item to tune.Tuner.