Use either X CPU or Y GPU for a task


I’m trying to setup parallel training of independent models and I would like to be able to parallel my training procedure, in a way that it can be either processed on X amount of cpus OR Y amount of gpus.
If I do @ray.remote(num_cpus=X, num_gpus=Y) then it will give to that task both X and Y resources whereas I want this to work:
If I have 32 cpus and 4 gpus and a task consumes either 8 cpus or 1 gpu then I want to be able to parallel 8 jobs at the same time

Is there a way to do this with Ray ?