"""Run validation for Neuroevolution fitting."""fromcommon.optim.ne.space.baseimportBaseSpacefromcommon.optim.utils.hydraimportget_launcher_config
[docs]defvalidate_space(space:BaseSpace,*,pop_merge:bool)->None:"""Makes sure that the Space is valid given config values. Args: space: See :paramref:`~.evaluate_on_cpu.space`. pop_merge: See :paramref:`~.NeuroevolutionSubtaskConfig.pop_merge`. """launcher_config=get_launcher_config()ifpop_mergeandspace.num_pops!=2:# noqa: PLR2004error_msg="`pop_merge = True` requires `num_pops = 2`."raiseValueError(error_msg)ifnotlauncher_config.gpus_per_nodeandspace.evaluates_on_gpu:error_msg=("GPU evaluation is not supported when `gpus_per_node` is not ""specified in the launcher config or set to 0.")raiseValueError(error_msg)