agentomics 1.2.0__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agentomics-1.2.0/src/agentomics.egg-info → agentomics-2.1.0}/PKG-INFO +4 -3
- {agentomics-1.2.0 → agentomics-2.1.0}/README.md +1 -1
- {agentomics-1.2.0 → agentomics-2.1.0}/pyproject.toml +4 -2
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/check_dataset.py +3 -3
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/docker_utils.py +19 -1
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/inference.py +6 -10
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/retrain.py +2 -6
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/run.py +20 -12
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/run_arguments.py +7 -1
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/datasets/create_datasets.py +3 -3
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/datasets/dataset_preparation.py +33 -115
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/datasets/datasets_interactive.py +8 -9
- agentomics-2.1.0/src/agentomics/datasets/label_processing.py +31 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/run_agent.py +9 -4
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/run_agent_interactive.py +8 -4
- agentomics-2.1.0/src/agentomics/runtime/archives.py +47 -0
- agentomics-2.1.0/src/agentomics/runtime/collected_data_directory.py +127 -0
- agentomics-2.1.0/src/agentomics/runtime/data_collection_workflow.py +67 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/evaluate.py +7 -7
- agentomics-2.1.0/src/agentomics/runtime/evaluate_result.py +62 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/filesystem.py +52 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/generate_final_reports.py +21 -234
- agentomics-2.1.0/src/agentomics/runtime/iterations_lessons.py +133 -0
- agentomics-2.1.0/src/agentomics/runtime/paper_retrieval.py +76 -0
- agentomics-2.1.0/src/agentomics/runtime/plots_helpers.py +207 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/read_write_utils.py +0 -28
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/run_lifecycle.py +23 -9
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/run_workflow.py +3 -18
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/step_outputs.py +2 -2
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/training_workflow.py +2 -1
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/config.py +55 -2
- agentomics-2.1.0/src/agentomics/utils/data_module_config.py +59 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/exceptions.py +10 -1
- agentomics-2.1.0/src/agentomics/utils/metrics.py +16 -0
- agentomics-2.1.0/src/agentomics/utils/metrics_interactive.py +32 -0
- agentomics-2.1.0/src/agentomics/utils/ml_tasks/__init__.py +22 -0
- agentomics-2.1.0/src/agentomics/utils/ml_tasks/base.py +104 -0
- agentomics-2.1.0/src/agentomics/utils/ml_tasks/classification.py +255 -0
- agentomics-2.1.0/src/agentomics/utils/ml_tasks/registry.py +37 -0
- agentomics-2.1.0/src/agentomics/utils/ml_tasks/regression.py +126 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/printing_utils.py +7 -7
- {agentomics-1.2.0 → agentomics-2.1.0/src/agentomics.egg-info}/PKG-INFO +4 -3
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics.egg-info/SOURCES.txt +13 -2
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics.egg-info/requires.txt +1 -0
- agentomics-1.2.0/src/agentomics/datasets/label_processing.py +0 -61
- agentomics-1.2.0/src/agentomics/runtime/evaluate_result.py +0 -103
- agentomics-1.2.0/src/agentomics/utils/metrics.py +0 -167
- agentomics-1.2.0/src/agentomics/utils/metrics_interactive.py +0 -63
- agentomics-1.2.0/src/agentomics/utils/task_types.py +0 -6
- {agentomics-1.2.0 → agentomics-2.1.0}/LICENSE +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/setup.cfg +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/__init__.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/__init__.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/add_supplementary.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/cli/download_dataset.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/datasets/__init__.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/datasets/csv_converter.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/datasets/data_contract.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/__init__.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/best_iteration_snapshot.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/conda_utils.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/git_checkpoints.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/inference_runner.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/inference_workflow.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/iteration_reports.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/report_workflow.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/setup_fork.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/runtime/system_resources.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/README.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/ChemBERTa.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/DNABERT-2.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/ESM-2.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/HyenaDNA.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/MolFormerXL.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/NucleotideTransformer.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/NucleotideTransformerV2.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/rinalmo.md +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/__init__.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/agent_id.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/api_keys.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/text_processing_utils.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/user_input.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics/utils/versioning.py +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics.egg-info/dependency_links.txt +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics.egg-info/entry_points.txt +0 -0
- {agentomics-1.2.0 → agentomics-2.1.0}/src/agentomics.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentomics
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Package for running Agentomics - an autonomous agentic system for ML model development
|
|
5
5
|
Author: Vlastimil Martinek
|
|
6
6
|
Maintainer-email: Vlastimil Martinek <martinekvlastimil95@gmail.com>
|
|
@@ -28,7 +28,7 @@ License: MIT License
|
|
|
28
28
|
|
|
29
29
|
Project-URL: Documentation, https://biogemt.github.io/agentomics-ml/
|
|
30
30
|
Project-URL: Repository, https://github.com/BioGeMT/Agentomics-ML
|
|
31
|
-
Requires-Python: >=3.
|
|
31
|
+
Requires-Python: >=3.12
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
33
33
|
License-File: LICENSE
|
|
34
34
|
Requires-Dist: genomic-benchmarks==1.0.0
|
|
@@ -41,11 +41,12 @@ Requires-Dist: scipy>=1.11
|
|
|
41
41
|
Requires-Dist: rich>=14.0
|
|
42
42
|
Requires-Dist: pytest==9.1.1
|
|
43
43
|
Requires-Dist: pypdf>=6.0
|
|
44
|
+
Requires-Dist: pypdfium2>=5.14
|
|
44
45
|
Dynamic: license-file
|
|
45
46
|
|
|
46
47
|
# Agentomics
|
|
47
48
|
NEWS:
|
|
48
|
-
- *Agentomics
|
|
49
|
+
- *Agentomics has been presented at ISMB 2026 in Washington DC*
|
|
49
50
|
- *Agentomics has been published in Bioinformatics journal* [link to published paper](https://academic.oup.com/bioinformatics/article/42/Supplement_1/btag250/8726289)
|
|
50
51
|
- *Agentomics now supports any data type and supplementary material*
|
|
51
52
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agentomics
|
|
2
2
|
NEWS:
|
|
3
|
-
- *Agentomics
|
|
3
|
+
- *Agentomics has been presented at ISMB 2026 in Washington DC*
|
|
4
4
|
- *Agentomics has been published in Bioinformatics journal* [link to published paper](https://academic.oup.com/bioinformatics/article/42/Supplement_1/btag250/8726289)
|
|
5
5
|
- *Agentomics now supports any data type and supplementary material*
|
|
6
6
|
|
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agentomics"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "2.1.0"
|
|
8
8
|
description = "Package for running Agentomics - an autonomous agentic system for ML model development"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
11
|
dependencies = [
|
|
12
12
|
"genomic-benchmarks==1.0.0",
|
|
13
13
|
"hrid>=0.3.0",
|
|
@@ -19,6 +19,7 @@ dependencies = [
|
|
|
19
19
|
"rich>=14.0",
|
|
20
20
|
"pytest==9.1.1",
|
|
21
21
|
"pypdf>=6.0",
|
|
22
|
+
"pypdfium2>=5.14",
|
|
22
23
|
]
|
|
23
24
|
license = { file = "LICENSE" }
|
|
24
25
|
authors = [
|
|
@@ -51,6 +52,7 @@ packages = [
|
|
|
51
52
|
"agentomics.datasets",
|
|
52
53
|
"agentomics.runtime",
|
|
53
54
|
"agentomics.utils",
|
|
55
|
+
"agentomics.utils.ml_tasks",
|
|
54
56
|
]
|
|
55
57
|
|
|
56
58
|
[tool.setuptools.package-data]
|
|
@@ -37,7 +37,7 @@ def _suggested_metadata(summary: dict) -> dict:
|
|
|
37
37
|
"task_type",
|
|
38
38
|
"label_column",
|
|
39
39
|
"id_column",
|
|
40
|
-
"
|
|
40
|
+
"task_metadata",
|
|
41
41
|
)
|
|
42
42
|
return {
|
|
43
43
|
key: summary[key]
|
|
@@ -62,8 +62,8 @@ def _print_summary(summary: dict, interactive: bool) -> None:
|
|
|
62
62
|
if test_rows is not None:
|
|
63
63
|
console.print(f"Test rows: {test_rows}")
|
|
64
64
|
|
|
65
|
-
if "
|
|
66
|
-
console.print(f"
|
|
65
|
+
if summary.get("task_metadata"):
|
|
66
|
+
console.print(f"Task metadata: {summary['task_metadata']}")
|
|
67
67
|
console.print(f"Input structure: {summary.get('input_structure')}")
|
|
68
68
|
|
|
69
69
|
if interactive:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import argparse
|
|
4
|
+
import ctypes
|
|
4
5
|
import os
|
|
5
6
|
import shutil
|
|
6
7
|
import subprocess
|
|
8
|
+
import sys
|
|
7
9
|
from pathlib import Path
|
|
8
10
|
|
|
9
11
|
from agentomics.utils.versioning import get_version
|
|
@@ -73,6 +75,14 @@ def create_parser(description: str) -> argparse.ArgumentParser:
|
|
|
73
75
|
return parser
|
|
74
76
|
|
|
75
77
|
def build_development_image() -> str:
|
|
78
|
+
try:
|
|
79
|
+
return _build_development_image()
|
|
80
|
+
except RuntimeError as error:
|
|
81
|
+
# These errors are user mistakes, so print only the message, without a traceback.
|
|
82
|
+
print(f"Error: {error}", file=sys.stderr)
|
|
83
|
+
sys.exit(1)
|
|
84
|
+
|
|
85
|
+
def _build_development_image() -> str:
|
|
76
86
|
if shutil.which("docker") is None:
|
|
77
87
|
raise RuntimeError("Missing required command: docker")
|
|
78
88
|
|
|
@@ -112,6 +122,13 @@ def docker_environment_arguments(*variable_names: str) -> list[str]:
|
|
|
112
122
|
docker_arguments.extend(["-e", variable_name])
|
|
113
123
|
return docker_arguments
|
|
114
124
|
|
|
125
|
+
def _without_console_window() -> dict:
|
|
126
|
+
"""On Windows, when agentomics-run has no console (the desktop app starts it in the background), docker would
|
|
127
|
+
open a console window of its own and print there. This keeps docker windowless and printing to our output."""
|
|
128
|
+
if sys.platform != "win32" or ctypes.windll.kernel32.GetConsoleWindow():
|
|
129
|
+
return {}
|
|
130
|
+
return {"creationflags": subprocess.CREATE_NO_WINDOW, "stdout": sys.stdout, "stderr": sys.stderr}
|
|
131
|
+
|
|
115
132
|
def validate_docker_gpu_access(image: str) -> None:
|
|
116
133
|
if shutil.which("docker") is None:
|
|
117
134
|
raise RuntimeError("Missing required command: docker")
|
|
@@ -129,6 +146,7 @@ def validate_docker_gpu_access(image: str) -> None:
|
|
|
129
146
|
],
|
|
130
147
|
capture_output=True,
|
|
131
148
|
text=True,
|
|
149
|
+
creationflags=_without_console_window().get("creationflags", 0),
|
|
132
150
|
)
|
|
133
151
|
if result.returncode != 0:
|
|
134
152
|
raise RuntimeError(
|
|
@@ -166,4 +184,4 @@ def run_python_in_docker(
|
|
|
166
184
|
command.extend(["--mount", mount])
|
|
167
185
|
command.extend(["--entrypoint", CONTAINER_PYTHON, image])
|
|
168
186
|
command.extend(python_arguments)
|
|
169
|
-
return subprocess.run(command, check=check).returncode
|
|
187
|
+
return subprocess.run(command, check=check, **_without_console_window()).returncode
|
|
@@ -52,12 +52,12 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
52
52
|
parser.add_argument("--wandb-prefix", help="Enable W&B logging with this prefix; valid WANDB_API_KEY, WANDB_PROJECT_NAME, and WANDB_ENTITY are also required")
|
|
53
53
|
return parser
|
|
54
54
|
|
|
55
|
-
def run_inference_in_docker(arguments: argparse.Namespace) -> int:
|
|
55
|
+
def run_inference_in_docker(arguments: argparse.Namespace, extra_docker_arguments: tuple[str, ...] = ()) -> int:
|
|
56
56
|
resolve_inference_paths(arguments)
|
|
57
|
-
return _run_inference_with_resolved_paths(arguments)
|
|
57
|
+
return _run_inference_with_resolved_paths(arguments, extra_docker_arguments)
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
|
|
60
|
+
def _run_inference_with_resolved_paths(arguments: argparse.Namespace, extra_docker_arguments: tuple[str, ...] = ()) -> int:
|
|
61
61
|
container_input = "/inference-input"
|
|
62
62
|
python_arguments = [
|
|
63
63
|
"-m",
|
|
@@ -69,7 +69,7 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
|
|
|
69
69
|
"--output",
|
|
70
70
|
f"/inference-output/{arguments.output.name}",
|
|
71
71
|
"--iteration-dir",
|
|
72
|
-
|
|
72
|
+
arguments.iteration_dir.as_posix(), # a path inside the container
|
|
73
73
|
]
|
|
74
74
|
mounts = [
|
|
75
75
|
f"type=bind,src={arguments.agent_dir},dst=/agent,readonly",
|
|
@@ -107,7 +107,7 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
|
|
|
107
107
|
"https_proxy",
|
|
108
108
|
"all_proxy",
|
|
109
109
|
"no_proxy",
|
|
110
|
-
),
|
|
110
|
+
) + list(extra_docker_arguments),
|
|
111
111
|
check=False,
|
|
112
112
|
)
|
|
113
113
|
|
|
@@ -115,11 +115,7 @@ def main() -> int:
|
|
|
115
115
|
arguments = build_parser().parse_args()
|
|
116
116
|
resolve_inference_paths(arguments)
|
|
117
117
|
if arguments.dev:
|
|
118
|
-
|
|
119
|
-
arguments.image = build_development_image()
|
|
120
|
-
except RuntimeError as error:
|
|
121
|
-
print(f"Error: {error}", file=sys.stderr)
|
|
122
|
-
return 1
|
|
118
|
+
arguments.image = build_development_image()
|
|
123
119
|
return _run_inference_with_resolved_paths(arguments)
|
|
124
120
|
|
|
125
121
|
if __name__ == "__main__":
|
|
@@ -47,7 +47,7 @@ def _run_in_docker(arguments: argparse.Namespace) -> None:
|
|
|
47
47
|
"--artifacts-dir",
|
|
48
48
|
f"/training-output/{arguments.artifacts_dir.name}",
|
|
49
49
|
"--iteration-dir",
|
|
50
|
-
|
|
50
|
+
arguments.iteration_dir.as_posix(),
|
|
51
51
|
]
|
|
52
52
|
if arguments.label_col:
|
|
53
53
|
python_arguments.extend(["--label-col", arguments.label_col])
|
|
@@ -69,11 +69,7 @@ def main() -> int:
|
|
|
69
69
|
arguments = build_parser().parse_args()
|
|
70
70
|
resolve_training_paths(arguments)
|
|
71
71
|
if arguments.dev:
|
|
72
|
-
|
|
73
|
-
arguments.image = build_development_image()
|
|
74
|
-
except RuntimeError as error:
|
|
75
|
-
print(f"Error: {error}", file=sys.stderr)
|
|
76
|
-
return 1
|
|
72
|
+
arguments.image = build_development_image()
|
|
77
73
|
_run_in_docker(arguments)
|
|
78
74
|
return 0
|
|
79
75
|
|
|
@@ -4,7 +4,7 @@ import argparse
|
|
|
4
4
|
import json
|
|
5
5
|
import sys
|
|
6
6
|
import tempfile
|
|
7
|
-
from pathlib import Path
|
|
7
|
+
from pathlib import Path, PurePosixPath
|
|
8
8
|
|
|
9
9
|
from agentomics.cli.docker_utils import (
|
|
10
10
|
build_development_image,
|
|
@@ -30,10 +30,11 @@ from agentomics.utils.config import Config
|
|
|
30
30
|
|
|
31
31
|
DEFAULT_DATASETS_DIRECTORY = Path("datasets")
|
|
32
32
|
DEFAULT_OUTPUTS_DIRECTORY = Path("outputs")
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
# Paths inside the (Linux) container: always forward slashes, whatever the host OS.
|
|
34
|
+
CONTAINER_CODEX_DIRECTORY = PurePosixPath("/mnt/codex-host")
|
|
35
|
+
CONTAINER_DATASETS_DIRECTORY = PurePosixPath("/datasets")
|
|
36
|
+
CONTAINER_FORK_SOURCE_DIRECTORY = PurePosixPath("/fork-source")
|
|
37
|
+
CONTAINER_WORKSPACE_DIRECTORY = PurePosixPath("/workspace")
|
|
37
38
|
PUBLIC_DATASET_ENTRY_NAMES = (
|
|
38
39
|
"train",
|
|
39
40
|
"train.csv",
|
|
@@ -71,6 +72,7 @@ def _build_container_arguments(arguments: argparse.Namespace) -> list[str]:
|
|
|
71
72
|
for option, value in (
|
|
72
73
|
("--model", arguments.model),
|
|
73
74
|
("--iteration-plan-model", arguments.iteration_plan_model),
|
|
75
|
+
("--trace-analysis-model", arguments.trace_analysis_model),
|
|
74
76
|
("--provider", arguments.provider),
|
|
75
77
|
("--dataset", arguments.dataset),
|
|
76
78
|
("--task-type", arguments.task_type),
|
|
@@ -108,6 +110,7 @@ def _build_container_arguments(arguments: argparse.Namespace) -> list[str]:
|
|
|
108
110
|
def _docker_environment_arguments(agent_id: str) -> list[str]:
|
|
109
111
|
docker_arguments = docker_environment_arguments(
|
|
110
112
|
"OPENAI_API_KEY", "ANTHROPIC_API_KEY", "OPENROUTER_API_KEY",
|
|
113
|
+
"ASTA_API_KEY", "S2_API_KEY", "UNPAYWALL_EMAIL",
|
|
111
114
|
"PROVISIONING_OPENROUTER_API_KEY", "OLLAMA_BASE_URL",
|
|
112
115
|
"WANDB_API_KEY", "WANDB_PROJECT_NAME", "WANDB_ENTITY",
|
|
113
116
|
"WANDB_RUN_GROUP", "WANDB_JOB_TYPE", "WANDB_NAME",
|
|
@@ -186,6 +189,12 @@ def build_dataset_mounts(
|
|
|
186
189
|
return mounts
|
|
187
190
|
|
|
188
191
|
|
|
192
|
+
def _workspace_label_arguments(workspace_directory: Path) -> list[str]:
|
|
193
|
+
# A run's containers carry its workspace folder's name, so a UI can find and stop them where
|
|
194
|
+
# signals can't reach them (Windows).
|
|
195
|
+
return ["--label", f"agentomics.workspace={workspace_directory.name}"]
|
|
196
|
+
|
|
197
|
+
|
|
189
198
|
def _run_agent_in_docker(
|
|
190
199
|
arguments: argparse.Namespace,
|
|
191
200
|
workspace_directory: Path,
|
|
@@ -225,6 +234,7 @@ def _run_agent_in_docker(
|
|
|
225
234
|
)
|
|
226
235
|
|
|
227
236
|
docker_arguments = _docker_environment_arguments(agent_id)
|
|
237
|
+
docker_arguments.extend(_workspace_label_arguments(workspace_directory))
|
|
228
238
|
if arguments.provider == "ollama":
|
|
229
239
|
docker_arguments.extend(["--network", "host"])
|
|
230
240
|
# A non-zero exit is an expected outcome (for example, no best-iteration
|
|
@@ -263,7 +273,8 @@ def _run_inference_on_test_input(
|
|
|
263
273
|
all_iterations=False,
|
|
264
274
|
cpu_only=cpu_only,
|
|
265
275
|
wandb_prefix=test_input.name,
|
|
266
|
-
)
|
|
276
|
+
),
|
|
277
|
+
extra_docker_arguments=tuple(_workspace_label_arguments(workspace_directory)),
|
|
267
278
|
)
|
|
268
279
|
|
|
269
280
|
|
|
@@ -313,7 +324,7 @@ def _run_test_evaluation_in_docker(
|
|
|
313
324
|
destination_dir=prepared_directory,
|
|
314
325
|
task_type=metadata["task_type"],
|
|
315
326
|
input_structure=metadata["input_structure"],
|
|
316
|
-
|
|
327
|
+
task_metadata=metadata["task_metadata"],
|
|
317
328
|
label_column=metadata.get("label_column"),
|
|
318
329
|
id_column=metadata.get("id_column"),
|
|
319
330
|
)
|
|
@@ -351,6 +362,7 @@ def _run_reporting_in_docker(
|
|
|
351
362
|
"--agent-id",
|
|
352
363
|
agent_id,
|
|
353
364
|
],
|
|
365
|
+
docker_arguments=_workspace_label_arguments(workspace_directory),
|
|
354
366
|
)
|
|
355
367
|
|
|
356
368
|
|
|
@@ -384,11 +396,7 @@ def main() -> int:
|
|
|
384
396
|
agent_id = create_agent_id()
|
|
385
397
|
|
|
386
398
|
if arguments.dev:
|
|
387
|
-
|
|
388
|
-
arguments.image = build_development_image()
|
|
389
|
-
except RuntimeError as error:
|
|
390
|
-
print(f"Error: {error}", file=sys.stderr)
|
|
391
|
-
return 1
|
|
399
|
+
arguments.image = build_development_image()
|
|
392
400
|
|
|
393
401
|
if not arguments.cpu_only:
|
|
394
402
|
try:
|
|
@@ -3,6 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
+
from agentomics.utils.ml_tasks import get_task_names
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
def add_run_arguments(parser: argparse.ArgumentParser) -> None:
|
|
8
10
|
run_arguments = parser.add_argument_group("run configuration")
|
|
@@ -14,6 +16,10 @@ def add_run_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
14
16
|
"--iteration-plan-model",
|
|
15
17
|
help="LLM model used to generate the iteration plan; defaults to --model",
|
|
16
18
|
)
|
|
19
|
+
run_arguments.add_argument(
|
|
20
|
+
"--trace-analysis-model",
|
|
21
|
+
help="LLM model used to extract iterations lessons from step traces; defaults to --iteration-plan-model",
|
|
22
|
+
)
|
|
17
23
|
run_arguments.add_argument(
|
|
18
24
|
"--provider",
|
|
19
25
|
help="Provider override when multiple API-key providers are configured",
|
|
@@ -27,7 +33,7 @@ def add_run_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
27
33
|
)
|
|
28
34
|
run_arguments.add_argument(
|
|
29
35
|
"--task-type",
|
|
30
|
-
choices=(
|
|
36
|
+
choices=get_task_names(),
|
|
31
37
|
help=(
|
|
32
38
|
"Task type used to prepare the selected dataset; when omitted, use "
|
|
33
39
|
"dataset metadata or prompt interactively"
|
|
@@ -17,6 +17,7 @@ from agentomics.datasets.data_contract import (
|
|
|
17
17
|
TEST_SPLIT_PREFIX,
|
|
18
18
|
TRAIN_SPLIT,
|
|
19
19
|
)
|
|
20
|
+
from agentomics.runtime.filesystem import write_atomically
|
|
20
21
|
|
|
21
22
|
REPO_PATH = Path.cwd()
|
|
22
23
|
FREE_SPOKEN_DIGIT_DATASET_VERSION = "v1.0.10"
|
|
@@ -251,9 +252,8 @@ def generate_spoken_digits_files(_dataset_name: str = "spoken_digits") -> None:
|
|
|
251
252
|
)
|
|
252
253
|
|
|
253
254
|
if not archive_path.exists():
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
temp_archive_path.replace(archive_path)
|
|
255
|
+
with write_atomically(archive_path) as temp_archive_path:
|
|
256
|
+
urllib.request.urlretrieve(source_url, temp_archive_path)
|
|
257
257
|
|
|
258
258
|
recordings_dirs = sorted(download_dir.glob("free-spoken-digit-dataset-*/recordings"))
|
|
259
259
|
if not recordings_dirs:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import json
|
|
2
|
-
import math
|
|
3
2
|
import shutil
|
|
4
3
|
import sys
|
|
5
4
|
import tempfile
|
|
@@ -11,7 +10,6 @@ from rich.console import Console
|
|
|
11
10
|
from agentomics.datasets.data_contract import (
|
|
12
11
|
DATASET_DESCRIPTION_FILE_NAME,
|
|
13
12
|
INPUT_DIR_NAME,
|
|
14
|
-
LABEL_COLUMN_NAME,
|
|
15
13
|
LABELS_FILE_NAME,
|
|
16
14
|
METADATA_FILE_NAME,
|
|
17
15
|
NON_TEST_SPLIT_NAMES,
|
|
@@ -36,13 +34,10 @@ from agentomics.datasets.datasets_interactive import (
|
|
|
36
34
|
select_task_type,
|
|
37
35
|
)
|
|
38
36
|
from agentomics.datasets.label_processing import (
|
|
39
|
-
convert_classification_labels,
|
|
40
|
-
convert_regression_labels,
|
|
41
37
|
load_split_label_dfs,
|
|
42
|
-
validate_single_label_classification,
|
|
43
38
|
)
|
|
44
39
|
from agentomics.runtime.filesystem import create_absolute_symlink, find_symlinks_in_dir
|
|
45
|
-
from agentomics.utils.
|
|
40
|
+
from agentomics.utils.ml_tasks import MLTask, get_task
|
|
46
41
|
|
|
47
42
|
console = Console()
|
|
48
43
|
|
|
@@ -54,58 +49,13 @@ def _reject_symlinks_in_dir(directory: Path) -> None:
|
|
|
54
49
|
f"{len(symlinks)} symlink(s) found (e.g. {symlinks[0]})."
|
|
55
50
|
)
|
|
56
51
|
|
|
57
|
-
def
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# If every label is numeric-looking, sort by value: "1", "2", "10".
|
|
61
|
-
# If any label is non-numeric, keep the whole set lexicographic.
|
|
62
|
-
try:
|
|
63
|
-
numeric_values = [float(label.strip()) for label in string_labels]
|
|
64
|
-
all_labels_are_numeric = all(math.isfinite(value) for value in numeric_values)
|
|
65
|
-
except ValueError:
|
|
66
|
-
all_labels_are_numeric = False
|
|
67
|
-
|
|
68
|
-
if all_labels_are_numeric:
|
|
69
|
-
return sorted(string_labels, key=lambda label: float(label.strip()))
|
|
70
|
-
return sorted(string_labels)
|
|
71
|
-
|
|
72
|
-
def _resolve_task_type(source_metadata: dict, cli_task_type: str | None, train_labels: pd.DataFrame, interactive: bool) -> str:
|
|
52
|
+
def _resolve_task(
|
|
53
|
+
source_metadata: dict, cli_task_type: str | None, train_labels: pd.DataFrame, interactive: bool,
|
|
54
|
+
) -> MLTask:
|
|
73
55
|
resolved = cli_task_type or source_metadata.get("task_type")
|
|
74
56
|
if resolved is None:
|
|
75
57
|
resolved = select_task_type(train_labels, interactive=interactive)
|
|
76
|
-
|
|
77
|
-
raise ValueError(f"Invalid task_type '{resolved}'. Must be one of: {TaskTypes}")
|
|
78
|
-
return resolved
|
|
79
|
-
|
|
80
|
-
def _build_binary_label_mapping(
|
|
81
|
-
source_metadata: dict,
|
|
82
|
-
cli_positive_class: str | None,
|
|
83
|
-
cli_negative_class: str | None,
|
|
84
|
-
unique_labels,
|
|
85
|
-
interactive: bool,
|
|
86
|
-
) -> dict[str, int]:
|
|
87
|
-
resolved_positive = cli_positive_class if cli_positive_class is not None else source_metadata.get("positive_class")
|
|
88
|
-
resolved_negative = cli_negative_class if cli_negative_class is not None else source_metadata.get("negative_class")
|
|
89
|
-
has_positive = resolved_positive is not None
|
|
90
|
-
has_negative = resolved_negative is not None
|
|
91
|
-
if has_positive != has_negative:
|
|
92
|
-
raise ValueError("Provide both positive_class and negative_class, or neither.")
|
|
93
|
-
if not has_positive:
|
|
94
|
-
if interactive and sys.stdin.isatty():
|
|
95
|
-
resolved_positive = select_positive_class(unique_labels)
|
|
96
|
-
resolved_negative = next(str(label) for label in unique_labels if str(label) != str(resolved_positive))
|
|
97
|
-
else:
|
|
98
|
-
sorted_labels = _sort_class_labels(unique_labels)
|
|
99
|
-
resolved_negative = sorted_labels[0]
|
|
100
|
-
resolved_positive = sorted_labels[1]
|
|
101
|
-
label_set = {str(label) for label in unique_labels}
|
|
102
|
-
resolved_set = {str(resolved_positive), str(resolved_negative)}
|
|
103
|
-
if resolved_set != label_set:
|
|
104
|
-
raise ValueError(
|
|
105
|
-
f"positive_class and negative_class must match the observed labels. "
|
|
106
|
-
f"Observed: {sorted(label_set)}; requested: {sorted(resolved_set)}"
|
|
107
|
-
)
|
|
108
|
-
return {str(resolved_negative): 0, str(resolved_positive): 1}
|
|
58
|
+
return get_task(resolved)
|
|
109
59
|
|
|
110
60
|
def _build_output_metadata(
|
|
111
61
|
source_metadata: dict,
|
|
@@ -131,14 +81,19 @@ def prepare_dataset(
|
|
|
131
81
|
positive_class=None,
|
|
132
82
|
negative_class=None,
|
|
133
83
|
interactive=False,
|
|
134
|
-
|
|
84
|
+
task_metadata: dict | None = None,
|
|
135
85
|
label_column=None,
|
|
86
|
+
*,
|
|
87
|
+
fit: bool = True,
|
|
136
88
|
) -> dict:
|
|
137
89
|
"""Prepare a dataset from source_dir into destination_dir.
|
|
138
90
|
|
|
139
91
|
Reads from source_dir (never modified), writes the prepared result to
|
|
140
92
|
destination_dir (input dirs are symlinked, labels are converted, metadata
|
|
141
93
|
is written). Returns the output metadata dict.
|
|
94
|
+
|
|
95
|
+
Use fit=False to reuse the saved task metadata without fitting a new
|
|
96
|
+
label encoding.
|
|
142
97
|
"""
|
|
143
98
|
source_dir = Path(source_dir)
|
|
144
99
|
destination_dir = Path(destination_dir)
|
|
@@ -176,47 +131,23 @@ def prepare_dataset(
|
|
|
176
131
|
input_structure = record_input_dir_structure(source_splits[TRAIN_SPLIT] / INPUT_DIR_NAME)
|
|
177
132
|
split_labels = load_split_label_dfs(source_splits)
|
|
178
133
|
|
|
179
|
-
|
|
134
|
+
task = _resolve_task(source_metadata, task_type, split_labels[TRAIN_SPLIT], interactive)
|
|
180
135
|
output_metadata = _build_output_metadata(
|
|
181
|
-
source_metadata,
|
|
136
|
+
source_metadata, task.name, split_labels, input_structure,
|
|
182
137
|
)
|
|
183
138
|
|
|
184
|
-
if
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if len(unique_labels) == 2 or has_cli_class_override:
|
|
197
|
-
label_to_scalar = _build_binary_label_mapping(
|
|
198
|
-
source_metadata,
|
|
199
|
-
positive_class,
|
|
200
|
-
negative_class,
|
|
201
|
-
unique_labels,
|
|
202
|
-
interactive,
|
|
203
|
-
)
|
|
204
|
-
else:
|
|
205
|
-
sorted_labels = _sort_class_labels(unique_labels)
|
|
206
|
-
label_to_scalar = {str(label): index for index, label in enumerate(sorted_labels)}
|
|
207
|
-
console.print(f"INFO: Label to number mapping: {label_to_scalar}. If this is wrong, please provide --positive-class and --negative-class parameters to the script.")
|
|
208
|
-
output_metadata["label_to_scalar"] = label_to_scalar
|
|
209
|
-
numeric_split_labels = {
|
|
210
|
-
split_name: convert_classification_labels(labels, label_to_scalar, split_name)
|
|
211
|
-
for split_name, labels in split_labels.items()
|
|
212
|
-
}
|
|
213
|
-
elif resolved_task_type == TaskTypes.REGRESSION:
|
|
214
|
-
numeric_split_labels = {
|
|
215
|
-
split_name: convert_regression_labels(labels, split_name)
|
|
216
|
-
for split_name, labels in split_labels.items()
|
|
217
|
-
}
|
|
218
|
-
else:
|
|
219
|
-
raise ValueError(f"Unknown task_type: {resolved_task_type}. Expected one of {TaskTypes}.")
|
|
139
|
+
if task_metadata is None:
|
|
140
|
+
task_metadata = source_metadata.get("task_metadata", {})
|
|
141
|
+
numeric_split_labels, label_metadata = task.validate_and_numericalize_labels(
|
|
142
|
+
split_labels, task_metadata, fit=fit,
|
|
143
|
+
options={
|
|
144
|
+
"source_metadata": source_metadata,
|
|
145
|
+
"positive_class": positive_class,
|
|
146
|
+
"negative_class": negative_class,
|
|
147
|
+
"positive_class_selector": select_positive_class if interactive and sys.stdin.isatty() else None,
|
|
148
|
+
},
|
|
149
|
+
)
|
|
150
|
+
output_metadata["task_metadata"] = label_metadata
|
|
220
151
|
|
|
221
152
|
destination_dir.mkdir(parents=True, exist_ok=True)
|
|
222
153
|
destination_splits = {}
|
|
@@ -277,7 +208,7 @@ def check_dataset(source_dir: Path, interactive: bool = False) -> dict:
|
|
|
277
208
|
destination_dir=temporary_root / "prepared_test",
|
|
278
209
|
task_type=metadata["task_type"],
|
|
279
210
|
input_structure=metadata["input_structure"],
|
|
280
|
-
|
|
211
|
+
task_metadata=metadata["task_metadata"],
|
|
281
212
|
label_column=metadata.get("label_column"),
|
|
282
213
|
id_column=metadata.get("id_column"),
|
|
283
214
|
)
|
|
@@ -301,7 +232,7 @@ def prepare_test_dataset(
|
|
|
301
232
|
destination_dir: Path,
|
|
302
233
|
task_type: str,
|
|
303
234
|
input_structure: list[str],
|
|
304
|
-
|
|
235
|
+
task_metadata: dict | None = None,
|
|
305
236
|
label_column: str | None = None,
|
|
306
237
|
id_column: str | None = None,
|
|
307
238
|
) -> dict:
|
|
@@ -311,6 +242,7 @@ def prepare_test_dataset(
|
|
|
311
242
|
destination_dir (input dir is symlinked, labels are converted, metadata
|
|
312
243
|
is written). Returns the output metadata dict.
|
|
313
244
|
"""
|
|
245
|
+
task = get_task(task_type)
|
|
314
246
|
source_dir = Path(source_dir)
|
|
315
247
|
destination_dir = Path(destination_dir)
|
|
316
248
|
|
|
@@ -332,23 +264,10 @@ def prepare_test_dataset(
|
|
|
332
264
|
|
|
333
265
|
test_labels = load_split_label_dfs({TEST_SPLIT_PREFIX: test_source})
|
|
334
266
|
|
|
335
|
-
|
|
336
|
-
if not
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
label_to_scalar = {str(k): int(v) for k, v in label_to_scalar.items()}
|
|
340
|
-
actual_labels = set(test_labels[TEST_SPLIT_PREFIX][LABEL_COLUMN_NAME].astype(str).unique())
|
|
341
|
-
unknown_labels = sorted(actual_labels - set(label_to_scalar))
|
|
342
|
-
if unknown_labels:
|
|
343
|
-
raise ValueError(
|
|
344
|
-
f"Test split contains labels not present in train: {unknown_labels}. "
|
|
345
|
-
f"Known labels: {sorted(label_to_scalar)}"
|
|
346
|
-
)
|
|
347
|
-
numeric_labels = convert_classification_labels(test_labels[TEST_SPLIT_PREFIX], label_to_scalar, TEST_SPLIT_PREFIX)
|
|
348
|
-
elif task_type == TaskTypes.REGRESSION:
|
|
349
|
-
numeric_labels = convert_regression_labels(test_labels[TEST_SPLIT_PREFIX], TEST_SPLIT_PREFIX)
|
|
350
|
-
else:
|
|
351
|
-
raise ValueError(f"Unknown task_type: {task_type}. Expected one of {TaskTypes}.")
|
|
267
|
+
numeric_test_labels, label_metadata = task.validate_and_numericalize_labels(
|
|
268
|
+
test_labels, task_metadata if task_metadata is not None else {},
|
|
269
|
+
)
|
|
270
|
+
numeric_labels = numeric_test_labels[TEST_SPLIT_PREFIX]
|
|
352
271
|
|
|
353
272
|
dest_test = destination_dir / TEST_SPLIT_PREFIX
|
|
354
273
|
dest_test.mkdir(parents=True, exist_ok=True)
|
|
@@ -370,8 +289,7 @@ def prepare_test_dataset(
|
|
|
370
289
|
"input_structure": input_structure,
|
|
371
290
|
"prepared": True,
|
|
372
291
|
}
|
|
373
|
-
|
|
374
|
-
test_metadata["label_to_scalar"] = label_to_scalar
|
|
292
|
+
test_metadata["task_metadata"] = label_metadata
|
|
375
293
|
(destination_dir / METADATA_FILE_NAME).write_text(json.dumps(test_metadata, indent=4), encoding="utf-8")
|
|
376
294
|
|
|
377
295
|
return test_metadata
|
|
@@ -13,7 +13,7 @@ from agentomics.datasets.data_contract import (
|
|
|
13
13
|
TRAIN_SPLIT,
|
|
14
14
|
VALIDATION_SPLIT,
|
|
15
15
|
)
|
|
16
|
-
from agentomics.utils.
|
|
16
|
+
from agentomics.utils.ml_tasks import get_task_names
|
|
17
17
|
from agentomics.utils.user_input import get_user_input_for_int
|
|
18
18
|
|
|
19
19
|
console = Console()
|
|
@@ -113,11 +113,12 @@ def interactive_dataset_selection(datasets: list[dict]) -> str | None:
|
|
|
113
113
|
return selected_dataset
|
|
114
114
|
|
|
115
115
|
def select_task_type(train_labels: pd.DataFrame, interactive=False):
|
|
116
|
+
task_names = get_task_names()
|
|
116
117
|
if not interactive or not sys.stdin.isatty():
|
|
117
118
|
raise ValueError(
|
|
118
119
|
"Task type is required for non-interactive terminals. "
|
|
119
|
-
"Pass --task-type
|
|
120
|
-
"
|
|
120
|
+
"Pass --task-type or add 'task_type' to your metadata.json. "
|
|
121
|
+
f"Available task types: {', '.join(task_names)}."
|
|
121
122
|
)
|
|
122
123
|
|
|
123
124
|
print_label_summary(train_labels)
|
|
@@ -125,12 +126,10 @@ def select_task_type(train_labels: pd.DataFrame, interactive=False):
|
|
|
125
126
|
print('Tip: Add "task_type" to your metadata.json to skip this prompt in the future.')
|
|
126
127
|
|
|
127
128
|
while True:
|
|
128
|
-
choice = input("Select task type (
|
|
129
|
-
if choice in
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
return TaskTypes.REGRESSION
|
|
133
|
-
print(f"Please enter '{TaskTypes.CLASSIFICATION}' or '{TaskTypes.REGRESSION}'.")
|
|
129
|
+
choice = input(f"Select task type ({'/'.join(task_names)}): ").strip().lower()
|
|
130
|
+
if choice in task_names:
|
|
131
|
+
return choice
|
|
132
|
+
print(f"Please enter one of: {', '.join(task_names)}.")
|
|
134
133
|
|
|
135
134
|
def select_positive_class(unique_labels) -> str:
|
|
136
135
|
label_options = [str(label) for label in unique_labels]
|