@@ -202,28 +202,28 @@ def _balanced_trial_args(args: argparse.Namespace, task_names: list[str]) -> str
202202 Only the KNN tasks carry a ``balanced_trial`` config (see
203203 ``_aef_ps1_task``), so these must not be applied to the LP tasks -- there is
204204 no nested config there to override.
205+
206+ Read through ``getattr`` like ``priority``/``window_size`` above: the
207+ cluster-side submitters in olmoearth_plus_cropharvest build this namespace
208+ by hand, so a new field must not become a required attribute.
205209 """
206210 overrides = []
211+ max_folds = getattr (args , "balanced_trial_max_folds" , None )
212+ draw_pool = getattr (args , "balanced_trial_draw_pool" , None )
213+ eval_split = getattr (args , "balanced_trial_eval_split" , None )
214+ disabled = getattr (args , "no_balanced_trials" , False )
207215 for name in task_names :
208216 if EMBEDDING_EVAL_TASKS [name ].balanced_trial is None :
209217 continue
210- if args . no_balanced_trials :
218+ if disabled :
211219 overrides .append (_task_arg (name , "balanced_trial.enabled" , "False" ))
212- if args .balanced_trial_max_folds is not None :
213- overrides .append (
214- _task_arg (
215- name , "balanced_trial.max_folds" , args .balanced_trial_max_folds
216- )
217- )
218- if args .balanced_trial_draw_pool is not None :
219- pool = "[" + "," .join (args .balanced_trial_draw_pool .split ("," )) + "]"
220+ if max_folds is not None :
221+ overrides .append (_task_arg (name , "balanced_trial.max_folds" , max_folds ))
222+ if draw_pool is not None :
223+ pool = "[" + "," .join (draw_pool .split ("," )) + "]"
220224 overrides .append (_task_arg (name , "balanced_trial.draw_pool" , pool ))
221- if args .balanced_trial_eval_split is not None :
222- overrides .append (
223- _task_arg (
224- name , "balanced_trial.eval_split" , args .balanced_trial_eval_split
225- )
226- )
225+ if eval_split is not None :
226+ overrides .append (_task_arg (name , "balanced_trial.eval_split" , eval_split ))
227227 if not overrides :
228228 return ""
229229 return " " + " " .join (overrides )
0 commit comments