Context
PR #328 standardized all task configs and introduced corral.utils.task_loader as a shared utility for loading tasks from HuggingFace or local JSON directories. Catalyst env.py was refactored as the reference implementation.
Task
Migrate the remaining environment env.py files to use the shared task loader instead of their custom load_tasks_from_json() functions:
For each environment:
- Replace custom
load_tasks_from_json() with load_task_entries() / load_task_entries_from_env_package() from corral.utils.task_loader
- Add an
entries_to_task_definitions() function that maps entries to TaskDefinition using the env's scoring function registry (see catalyst env.py for reference)
- Update
create_environments() to accept local_dir (local) or environment (HF) kwargs
- Remove duplicate
TaskGroupEnvironment classes in ml, corral_md, and afm — use the shared one from corral.utils.task_group
- Fix stale path references (retrosynthesis:
tasks/subtasks → tasks_json/subtasks_json, corral_md: old category paths, afm: src/enviroment/)
Reference
Context
PR #328 standardized all task configs and introduced
corral.utils.task_loaderas a shared utility for loading tasks from HuggingFace or local JSON directories. Catalystenv.pywas refactored as the reference implementation.Task
Migrate the remaining environment
env.pyfiles to use the shared task loader instead of their customload_tasks_from_json()functions:tasks/ml/src/ml/env.pytasks/resistor_network/src/resistor_network/env.pytasks/corral_md/src/corral_md/env.pytasks/afm/src/env.pytasks/spectra_elucidation/spectra_elucidation/env.pytasks/retrosynthesis/retrosynthesis/env.pyFor each environment:
load_tasks_from_json()withload_task_entries()/load_task_entries_from_env_package()fromcorral.utils.task_loaderentries_to_task_definitions()function that maps entries toTaskDefinitionusing the env's scoring function registry (see catalystenv.pyfor reference)create_environments()to acceptlocal_dir(local) orenvironment(HF) kwargsTaskGroupEnvironmentclasses in ml, corral_md, and afm — use the shared one fromcorral.utils.task_grouptasks/subtasks→tasks_json/subtasks_json, corral_md: old category paths, afm:src/enviroment/)Reference
src/corral/utils/task_loader.pytasks/catalyst/src/catalyst/env.pyjablonkagroup/corral-environment-tasks