Skip to content

Adapt all environment env.py files to use shared task loader (HF + local) #329

@n0w0f

Description

@n0w0f

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:

  • tasks/ml/src/ml/env.py
  • tasks/resistor_network/src/resistor_network/env.py
  • tasks/corral_md/src/corral_md/env.py
  • tasks/afm/src/env.py
  • tasks/spectra_elucidation/spectra_elucidation/env.py
  • tasks/retrosynthesis/retrosynthesis/env.py

For each environment:

  1. Replace custom load_tasks_from_json() with load_task_entries() / load_task_entries_from_env_package() from corral.utils.task_loader
  2. 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)
  3. Update create_environments() to accept local_dir (local) or environment (HF) kwargs
  4. Remove duplicate TaskGroupEnvironment classes in ml, corral_md, and afm — use the shared one from corral.utils.task_group
  5. Fix stale path references (retrosynthesis: tasks/subtaskstasks_json/subtasks_json, corral_md: old category paths, afm: src/enviroment/)

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions