mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-24 17:05:03 +00:00
Basic curriculum (#198)
* feat: Add optional curriculum support to dataset registration and creation * docs: Add docstrings to create_curriculum() and register_dataset() * feat: Add curriculum configuration classes for CurriculumExperiment * feat: Add weight parameter to CurriculumAttributeConfig and use in DatasetSpec * refactor: Simplify CurriculumAttributeConfig with "*" attribute level support * test: Add unit tests for CurriculumExperiment class * feat: Add from_yaml() method to CurriculumExperimentConfig with unit test
This commit is contained in:
parent
34889d0517
commit
c2263979bc
29 changed files with 943 additions and 63 deletions
|
|
@ -89,12 +89,12 @@ def create_app(config: ServerConfig) -> FastAPI:
|
|||
try:
|
||||
entries = []
|
||||
for i in range(base_index, base_index + batch_size):
|
||||
entry = experiment.dataset[i]
|
||||
entry = experiment.get_dataset_entry(i)
|
||||
|
||||
# Create BatchEntry with minimal required data
|
||||
batch_entry = BatchEntry(
|
||||
question=entry["question"],
|
||||
entry_id=f"{entry['metadata']['version_id']}.{i}",
|
||||
entry_id=f"{entry['metadata']['entry_id']}",
|
||||
metadata=entry["metadata"],
|
||||
)
|
||||
entries.append(batch_entry)
|
||||
|
|
@ -115,7 +115,7 @@ def create_app(config: ServerConfig) -> FastAPI:
|
|||
scores = []
|
||||
entry_ids = []
|
||||
for item in request.answers:
|
||||
score = experiment.dataset.score_answer_with_id(item.answer, item.entry_id)
|
||||
score = experiment.score_answer_with_id(item.answer, item.entry_id)
|
||||
scores.append(score)
|
||||
entry_ids.append(item.entry_id)
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ def create_app(config: ServerConfig) -> FastAPI:
|
|||
# Convert internal config to API response format
|
||||
datasets = {}
|
||||
for ds_spec in experiment.config.datasets:
|
||||
dataset = experiment.dataset.datasets[ds_spec.name]
|
||||
dataset = experiment.composite.datasets[ds_spec.name]
|
||||
datasets[ds_spec.name] = {
|
||||
"weight": ds_spec.weight,
|
||||
"config": vars(dataset.config), # Get current config from dataset instance
|
||||
|
|
@ -152,7 +152,7 @@ def create_app(config: ServerConfig) -> FastAPI:
|
|||
raise HTTPException(status_code=404, detail=f"Experiment '{name}' not found")
|
||||
|
||||
try:
|
||||
experiment.dataset.update_dataset_config(dataset_name, config_update.config)
|
||||
experiment.composite.update_dataset_config(dataset_name, config_update.config)
|
||||
return {"status": "updated"}
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail=f"Dataset '{dataset_name}' not found in experiment")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue