Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] in-loop task evaluator compatible from oe-eval-internal #72

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ license = { file = "LICENSE" }
dependencies = [
"numpy<2.0",
"torch>=2.4,<=2.6.0.dev20241009",
"torchmetrics<=1.5.1",
"cached-path",
"requests",
"packaging",
Expand Down
1 change: 1 addition & 0 deletions src/eval/oe_eval_tasks/pubmedqa/mc_3shot/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"task_name": "pubmedqa:mc", "task_hash": "6f91fd6326a60b11e8c2d33d632467c0", "task_config": {"task_name": "pubmedqa:mc", "task_core": "pubmedqa", "limit": 1000, "split": "test", "num_shots": 3, "fewshot_seed": 1234, "primary_metric": "acc_raw", "random_subsample_seed": 1234, "context_kwargs": {}, "generation_kwargs": {}, "metric_kwargs": {}, "native_id_field": "id", "fewshot_source": "SciLLM:PubMedQA", "dataset_path": "bigbio/pubmed_qa", "dataset_name": "pubmed_qa_labeled_fold0_source", "use_chat_format": null, "version": 0, "revision": null, "metadata": {"description": "PubMedQA (MC) using SciLLM", "regimes": ["SciLLM-v0.1"], "alias": "pubmedqa:mc::scillm"}}, "current_date": "2024-10-13 03:45:58 UTC", "num_instances": 500}
Binary file not shown.
1 change: 1 addition & 0 deletions src/eval/oe_eval_tasks/pubmedqa/rc_3shot/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"task_name": "pubmedqa", "task_hash": "7145b0916b8d74ab75e87e2768c233df", "task_config": {"task_name": "pubmedqa", "task_core": "pubmedqa", "limit": 1000, "split": "test", "num_shots": 3, "fewshot_seed": 1234, "primary_metric": "acc_raw", "random_subsample_seed": 1234, "context_kwargs": {"description": null}, "generation_kwargs": {}, "metric_kwargs": {"uncond_docid_offset": 1000000}, "native_id_field": "id", "fewshot_source": "SciLLM:PubMedQA", "dataset_path": "bigbio/pubmed_qa", "dataset_name": "pubmed_qa_labeled_fold0_source", "use_chat_format": null, "version": 0, "revision": null, "metadata": {"description": "PubMedQA (RC) using SciLLM", "regimes": ["SciLLM-v0.1"], "alias": "pubmedqa:rc::scillm"}}, "current_date": "2024-10-13 03:45:51 UTC", "num_instances": 500}
Binary file not shown.
1 change: 1 addition & 0 deletions src/eval/oe_eval_tasks/scifact/mc_3shot/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"task_name": "scifact:mc", "task_hash": "5daebde10a80d12c8c6df755e1d5603f", "task_config": {"task_name": "scifact:mc", "task_core": "scifact", "limit": 1000, "split": "validation", "num_shots": 3, "fewshot_seed": 1234, "primary_metric": "acc_raw", "random_subsample_seed": 1234, "context_kwargs": {"description": null}, "generation_kwargs": {}, "metric_kwargs": {}, "native_id_field": "id", "fewshot_source": "SciLLM:SciFact", "dataset_path": "allenai/scifact_entailment", "dataset_name": null, "use_chat_format": null, "version": 0, "revision": null, "metadata": {"description": "SciFact (MC) using SciLLM", "regimes": ["SciLLM-v0.1"], "alias": "scifact:mc::scillm"}}, "current_date": "2024-10-13 03:46:14 UTC", "num_instances": 340}
Binary file not shown.
1 change: 1 addition & 0 deletions src/eval/oe_eval_tasks/scifact/rc_3shot/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"task_name": "scifact", "task_hash": "d5ef8896b403d58b663afe1be9ea4a62", "task_config": {"task_name": "scifact", "task_core": "scifact", "limit": 1000, "split": "validation", "num_shots": 3, "fewshot_seed": 1234, "primary_metric": "acc_raw", "random_subsample_seed": 1234, "context_kwargs": {"description": null}, "generation_kwargs": {}, "metric_kwargs": {"uncond_docid_offset": 1000000}, "native_id_field": "id", "fewshot_source": "SciLLM:SciFact", "dataset_path": "allenai/scifact_entailment", "dataset_name": null, "use_chat_format": null, "version": 0, "revision": null, "metadata": {"description": "SciFact (RC) using SciLLM", "regimes": ["SciLLM-v0.1"], "alias": "scifact:rc::scillm"}}, "current_date": "2024-10-13 03:46:06 UTC", "num_instances": 340}
Binary file not shown.
16 changes: 16 additions & 0 deletions src/examples/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
GPUMemoryMonitorCallback,
GradClipperCallback,
LMEvaluatorCallbackConfig,
DownstreamEvaluatorCallbackConfig,
ProfilerCallback,
SchedulerCallback,
SequenceLengthSchedulerCallback,
Expand Down Expand Up @@ -89,6 +90,11 @@ def build_config(run_name: str, overrides: List[str]) -> ExperimentConfig:
num_workers=4,
)

downstream_evaluators = [
"pubmedqa_mc",
"scifact_rc",
]

trainer_config = (
TrainerConfig(
save_folder=f"/tmp/{run_name}",
Expand Down Expand Up @@ -147,6 +153,16 @@ def build_config(run_name: str, overrides: List[str]) -> ExperimentConfig:
eval_duration=Duration.steps(10),
),
)
.with_callback(
"downstream",
DownstreamEvaluatorCallbackConfig(
labels=downstream_evaluators,
eval_batch_size=4,
tokenizer="Qwen/Qwen2.5-1.5B",
eval_interval=250,
# eval_duration=Duration.steps(10),
),
)
)

return ExperimentConfig(
Expand Down
2 changes: 2 additions & 0 deletions src/olmo_core/train/callbacks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .comet import CometCallback, CometNotificationSetting
from .config_saver import ConfigSaverCallback
from .console_logger import ConsoleLoggerCallback
from .downstream import DownstreamEvaluatorCallbackConfig
from .evaluator_callback import EvaluatorCallback, LMEvaluatorCallbackConfig
from .float8_handler import Float8HandlerCallback
from .garbage_collector import GarbageCollectorCallback
Expand All @@ -24,6 +25,7 @@
"CometNotificationSetting",
"ConfigSaverCallback",
"ConsoleLoggerCallback",
"DownstreamEvaluatorCallbackConfig",
"EvaluatorCallback",
"Float8HandlerCallback",
"LMEvaluatorCallbackConfig",
Expand Down
Loading
Loading