maxent_grpo.config.recipes

Helper utilities to load YAML recipes into GRPO dataclasses.

Recipes are resolved with OmegaConf (or PyYAML when OmegaConf is unavailable), split into script/training/model sections, and instantiated into the corresponding config objects used by the training pipeline. Optional dependencies are guarded to keep doc builds and unit tests lightweight.

License Copyright 2025 Liv d’Aliberti

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Functions

_dataclass_field_names(cls)

Return dataclass field names for filtering dictionaries.

_format_recipe_errors(errors)

_infer_recipe_kind(recipe_path, payload)

_maybe_infer_vllm_server_overrides(...)

Fill vLLM server host/port when only vllm_url is provided.

_normalize_recipe_objective_payload(payload)

Normalize legacy objective selectors before schema validation/loading.

_should_validate_recipe(payload)

_split_recipe_payload(payload, model_cls)

Split a recipe dict into script/training/model/other sections.

_validate_recipe_payload(payload, recipe_path)

load_grpo_recipe(recipe_path, *, ...)

Load a GRPO recipe YAML into config dataclasses.

Classes

_BaseRecipeSchema(**kwargs)

_BaselineRecipeSchema(**kwargs)

_MaxentRecipeSchema(**kwargs)

maxent_grpo.config.recipes.ConfigDict(**kwargs)
maxent_grpo.config.recipes.model_validator(*_args, **_kwargs)
maxent_grpo.config.recipes.load_grpo_recipe(recipe_path, *, model_config_cls)[source]

Load a GRPO recipe YAML into config dataclasses.

Parameters:
  • recipe_path (str) – Path to the YAML recipe under configs/recipes.

  • model_config_cls (Type[Any]) – TRL ModelConfig class used for model kwargs.

Returns:

Tuple containing script arguments, training config, and model config.

Raises:
  • ImportError – If neither OmegaConf nor PyYAML is available.

  • ValueError – If the resolved recipe payload is not a mapping.

Return type:

Tuple[GRPOScriptArguments, GRPOConfig, Any]