I see. Why not try (I have not tried myself) defining script_tpl, via cluster_script.sh such that
#SBATCH --partition=
is defined depending on {{ num_gpu }}, using syntax similar to Using job_type in slurm if statement.
Alternatively, I also read that the --partition= parameter allows a comma-separated list, but I do not know whether the mere inclusion of a “valid” (for the job’s resource spec) partition in a list would allow you to avoid
`