agentomics 1.0.6__tar.gz → 1.2.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.0.6/src/agentomics.egg-info → agentomics-1.2.0}/PKG-INFO +4 -1
- {agentomics-1.0.6 → agentomics-1.2.0}/README.md +1 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/pyproject.toml +13 -1
- agentomics-1.2.0/src/agentomics/cli/add_supplementary.py +88 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/docker_utils.py +41 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/inference.py +22 -6
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/run.py +8 -7
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/run_arguments.py +0 -5
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/run_agent.py +20 -19
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/run_agent_interactive.py +9 -9
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/best_iteration_snapshot.py +1 -2
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/conda_utils.py +37 -9
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/filesystem.py +4 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/inference_workflow.py +5 -1
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/read_write_utils.py +3 -5
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/run_lifecycle.py +4 -2
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/run_workflow.py +1 -14
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/setup_fork.py +6 -7
- agentomics-1.2.0/src/agentomics/supplementary_catalog/README.md +50 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/ChemBERTa.md +55 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/DNABERT-2.md +68 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/ESM-2.md +98 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/HyenaDNA.md +73 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/MolFormerXL.md +61 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/NucleotideTransformer.md +68 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/NucleotideTransformerV2.md +80 -0
- agentomics-1.2.0/src/agentomics/supplementary_catalog/foundation_models/rinalmo.md +130 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/config.py +8 -2
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/printing_utils.py +1 -1
- {agentomics-1.0.6 → agentomics-1.2.0/src/agentomics.egg-info}/PKG-INFO +4 -1
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics.egg-info/SOURCES.txt +11 -22
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics.egg-info/entry_points.txt +1 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics.egg-info/requires.txt +2 -0
- agentomics-1.0.6/test/test_agent_permissions.py +0 -178
- agentomics-1.0.6/test/test_bash_lines_collapsing.py +0 -124
- agentomics-1.0.6/test/test_best_iteration_snapshot_and_splits.py +0 -631
- agentomics-1.0.6/test/test_codex_provider.py +0 -189
- agentomics-1.0.6/test/test_csv_converter.py +0 -114
- agentomics-1.0.6/test/test_dataset_extras_and_input_structure.py +0 -301
- agentomics-1.0.6/test/test_dataset_folder_split_contracts.py +0 -219
- agentomics-1.0.6/test/test_dataset_preparation_publishing.py +0 -110
- agentomics-1.0.6/test/test_environment_recreation.py +0 -523
- agentomics-1.0.6/test/test_forking.py +0 -493
- agentomics-1.0.6/test/test_gpu_access.py +0 -57
- agentomics-1.0.6/test/test_pr_title_validation.py +0 -85
- agentomics-1.0.6/test/test_pydantic_ai_validators.py +0 -75
- agentomics-1.0.6/test/test_release_please_configuration.py +0 -49
- agentomics-1.0.6/test/test_replace_tool.py +0 -210
- agentomics-1.0.6/test/test_retry_transport.py +0 -55
- agentomics-1.0.6/test/test_run_launcher_container_contract.py +0 -115
- agentomics-1.0.6/test/test_runtime_lifecycle.py +0 -243
- agentomics-1.0.6/test/test_transient_dataset_state.py +0 -154
- agentomics-1.0.6/test/test_utils.py +0 -114
- agentomics-1.0.6/test/test_version_identity.py +0 -50
- {agentomics-1.0.6 → agentomics-1.2.0}/LICENSE +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/setup.cfg +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/__init__.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/__init__.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/check_dataset.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/download_dataset.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/cli/retrain.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/__init__.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/create_datasets.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/csv_converter.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/data_contract.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/dataset_preparation.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/datasets_interactive.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/datasets/label_processing.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/__init__.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/evaluate.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/evaluate_result.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/generate_final_reports.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/git_checkpoints.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/inference_runner.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/iteration_reports.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/report_workflow.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/step_outputs.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/system_resources.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/runtime/training_workflow.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/__init__.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/agent_id.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/api_keys.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/exceptions.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/metrics.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/metrics_interactive.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/task_types.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/text_processing_utils.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/user_input.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics/utils/versioning.py +0 -0
- {agentomics-1.0.6 → agentomics-1.2.0}/src/agentomics.egg-info/dependency_links.txt +0 -0
- {agentomics-1.0.6 → agentomics-1.2.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.0
|
|
3
|
+
Version: 1.2.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>
|
|
@@ -39,6 +39,8 @@ Requires-Dist: Pillow==12.0.0
|
|
|
39
39
|
Requires-Dist: scikit-learn>=1.5
|
|
40
40
|
Requires-Dist: scipy>=1.11
|
|
41
41
|
Requires-Dist: rich>=14.0
|
|
42
|
+
Requires-Dist: pytest==9.1.1
|
|
43
|
+
Requires-Dist: pypdf>=6.0
|
|
42
44
|
Dynamic: license-file
|
|
43
45
|
|
|
44
46
|
# Agentomics
|
|
@@ -113,6 +115,7 @@ For more details visit **https://biogemt.github.io/agentomics-ml/**
|
|
|
113
115
|
- Trustworthy: If you provide a test set, Agentomics fully abstracts LLMs from accessing it, allowing you to rely on programmaticly computed and reported test set metrics.
|
|
114
116
|
- Various LLM providers: OpenAI, OpenRouter, or local models via Ollama
|
|
115
117
|
- Reliability: Thanks to our functional validators, Agentomics creates a working model 100% of the time (when using recommended settings).
|
|
118
|
+
- Supplementary materials: Give the agent dataset-specific papers, helper scripts, and foundation-model guidance. See the [supplementary materials documentation](https://biogemt.github.io/agentomics-ml/user-guide/datasets/#supplementary-optional).
|
|
116
119
|
|
|
117
120
|
## Run Output Structure Example
|
|
118
121
|
|
|
@@ -70,6 +70,7 @@ For more details visit **https://biogemt.github.io/agentomics-ml/**
|
|
|
70
70
|
- Trustworthy: If you provide a test set, Agentomics fully abstracts LLMs from accessing it, allowing you to rely on programmaticly computed and reported test set metrics.
|
|
71
71
|
- Various LLM providers: OpenAI, OpenRouter, or local models via Ollama
|
|
72
72
|
- Reliability: Thanks to our functional validators, Agentomics creates a working model 100% of the time (when using recommended settings).
|
|
73
|
+
- Supplementary materials: Give the agent dataset-specific papers, helper scripts, and foundation-model guidance. See the [supplementary materials documentation](https://biogemt.github.io/agentomics-ml/user-guide/datasets/#supplementary-optional).
|
|
73
74
|
|
|
74
75
|
## Run Output Structure Example
|
|
75
76
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agentomics"
|
|
7
|
-
version = "1.0
|
|
7
|
+
version = "1.2.0"
|
|
8
8
|
description = "Package for running Agentomics - an autonomous agentic system for ML model development"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -17,6 +17,8 @@ dependencies = [
|
|
|
17
17
|
"scikit-learn>=1.5",
|
|
18
18
|
"scipy>=1.11",
|
|
19
19
|
"rich>=14.0",
|
|
20
|
+
"pytest==9.1.1",
|
|
21
|
+
"pypdf>=6.0",
|
|
20
22
|
]
|
|
21
23
|
license = { file = "LICENSE" }
|
|
22
24
|
authors = [
|
|
@@ -36,6 +38,10 @@ agentomics-run = "agentomics.cli.run:main"
|
|
|
36
38
|
agentomics-inference = "agentomics.cli.inference:main"
|
|
37
39
|
agentomics-retrain = "agentomics.cli.retrain:main"
|
|
38
40
|
agentomics-check-dataset = "agentomics.cli.check_dataset:main"
|
|
41
|
+
agentomics-add-supplementary = "agentomics.cli.add_supplementary:main"
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
|
39
45
|
|
|
40
46
|
[tool.setuptools]
|
|
41
47
|
package-dir = {"" = "src"}
|
|
@@ -46,3 +52,9 @@ packages = [
|
|
|
46
52
|
"agentomics.runtime",
|
|
47
53
|
"agentomics.utils",
|
|
48
54
|
]
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.package-data]
|
|
57
|
+
agentomics = [
|
|
58
|
+
"supplementary_catalog/README.md",
|
|
59
|
+
"supplementary_catalog/foundation_models/*.md",
|
|
60
|
+
]
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import shutil
|
|
5
|
+
import sys
|
|
6
|
+
from importlib.resources import files
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
|
|
11
|
+
from agentomics.datasets.data_contract import SUPPLEMENTARY_DIR_NAME
|
|
12
|
+
|
|
13
|
+
console = Console()
|
|
14
|
+
|
|
15
|
+
CATALOG_DIR_NAME = "supplementary_catalog"
|
|
16
|
+
FOUNDATION_MODELS_DIR_NAME = "foundation_models"
|
|
17
|
+
CATALOG_README_NAME = "README.md"
|
|
18
|
+
|
|
19
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
20
|
+
parser = argparse.ArgumentParser(
|
|
21
|
+
description=(
|
|
22
|
+
"Copy foundation models' documentation into a dataset's supplementary/ folder"
|
|
23
|
+
),
|
|
24
|
+
allow_abbrev=False,
|
|
25
|
+
)
|
|
26
|
+
fm_selection = parser.add_mutually_exclusive_group(required=True)
|
|
27
|
+
fm_selection.add_argument(
|
|
28
|
+
"--all",
|
|
29
|
+
action="store_true",
|
|
30
|
+
help=f"Attach all foundation models from this list: {', '.join(_available_model_names())}",
|
|
31
|
+
)
|
|
32
|
+
fm_selection.add_argument(
|
|
33
|
+
"--model",
|
|
34
|
+
help=f"Foundation model to attach. Available: {', '.join(_available_model_names())}",
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"--dataset-dir",
|
|
38
|
+
type=Path,
|
|
39
|
+
required=True,
|
|
40
|
+
help="Dataset directory to attach the model documentation to",
|
|
41
|
+
)
|
|
42
|
+
return parser
|
|
43
|
+
|
|
44
|
+
def _catalog() -> Path:
|
|
45
|
+
return Path(str(files("agentomics"))) / CATALOG_DIR_NAME
|
|
46
|
+
|
|
47
|
+
def _foundation_models_catalog() -> Path:
|
|
48
|
+
return _catalog() / FOUNDATION_MODELS_DIR_NAME
|
|
49
|
+
|
|
50
|
+
def _available_model_names() -> list[str]:
|
|
51
|
+
return sorted(doc.stem for doc in _foundation_models_catalog().glob("*.md"))
|
|
52
|
+
|
|
53
|
+
def _resolve_model_name(requested_model: str) -> str:
|
|
54
|
+
available_names = _available_model_names()
|
|
55
|
+
for name in available_names:
|
|
56
|
+
if name.lower() == requested_model.lower():
|
|
57
|
+
return name
|
|
58
|
+
raise ValueError(
|
|
59
|
+
f"Unknown foundation model: {requested_model}. Available: {', '.join(available_names)}"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def add_supplementary_fm(model: str, dataset_dir: Path) -> Path:
|
|
63
|
+
if not dataset_dir.is_dir():
|
|
64
|
+
raise NotADirectoryError(f"Dataset directory not found: {dataset_dir}")
|
|
65
|
+
|
|
66
|
+
model_name = _resolve_model_name(model)
|
|
67
|
+
destination_dir = dataset_dir / SUPPLEMENTARY_DIR_NAME / FOUNDATION_MODELS_DIR_NAME
|
|
68
|
+
destination_dir.mkdir(parents=True, exist_ok=True)
|
|
69
|
+
|
|
70
|
+
model_doc = _foundation_models_catalog() / f"{model_name}.md"
|
|
71
|
+
for source in (model_doc, _catalog() / CATALOG_README_NAME):
|
|
72
|
+
shutil.copy(source, destination_dir)
|
|
73
|
+
return destination_dir / model_doc.name
|
|
74
|
+
|
|
75
|
+
def main() -> int:
|
|
76
|
+
arguments = build_parser().parse_args()
|
|
77
|
+
try:
|
|
78
|
+
models = _available_model_names() if arguments.all else [arguments.model]
|
|
79
|
+
for model in models:
|
|
80
|
+
model_doc = add_supplementary_fm(model, arguments.dataset_dir)
|
|
81
|
+
console.print(f"Added {model_doc}", style="green")
|
|
82
|
+
except (ValueError, OSError) as error:
|
|
83
|
+
console.print(f"{error}", style="red")
|
|
84
|
+
return 1
|
|
85
|
+
return 0
|
|
86
|
+
|
|
87
|
+
if __name__ == "__main__":
|
|
88
|
+
sys.exit(main())
|
|
@@ -13,6 +13,46 @@ DEFAULT_IMAGE = f"biogemt/agentomics:{get_version()}"
|
|
|
13
13
|
DEVELOPMENT_IMAGE = "agentomics:dev"
|
|
14
14
|
CONTAINER_PYTHON = "/opt/conda/envs/agentomics-env/bin/python"
|
|
15
15
|
|
|
16
|
+
PROXY_ENV_VAR_NAMES = (
|
|
17
|
+
"HTTP_PROXY",
|
|
18
|
+
"HTTPS_PROXY",
|
|
19
|
+
"ALL_PROXY",
|
|
20
|
+
"NO_PROXY"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def resolve_proxy_env_vars() -> dict[str, str]:
|
|
25
|
+
"""Resolve proxy variables from the environment and .env file."""
|
|
26
|
+
|
|
27
|
+
env_vars: dict[str, str] = {}
|
|
28
|
+
env_file_values: dict[str, str] = {}
|
|
29
|
+
env_file = Path.cwd() / ".env"
|
|
30
|
+
if env_file.is_file():
|
|
31
|
+
for line in env_file.read_text().splitlines():
|
|
32
|
+
line = line.strip()
|
|
33
|
+
if line and not line.startswith("#") and "=" in line:
|
|
34
|
+
name, value = line.split("=", 1)
|
|
35
|
+
env_file_values[name.strip()] = value.strip()
|
|
36
|
+
|
|
37
|
+
for upper_name in PROXY_ENV_VAR_NAMES:
|
|
38
|
+
lower_name = upper_name.lower()
|
|
39
|
+
value = (
|
|
40
|
+
os.environ.get(upper_name)
|
|
41
|
+
or os.environ.get(lower_name)
|
|
42
|
+
or env_file_values.get(upper_name)
|
|
43
|
+
or env_file_values.get(lower_name)
|
|
44
|
+
)
|
|
45
|
+
if value:
|
|
46
|
+
env_vars[upper_name] = value
|
|
47
|
+
env_vars[lower_name] = value
|
|
48
|
+
return env_vars
|
|
49
|
+
|
|
50
|
+
def _proxy_build_arguments() -> list[str]:
|
|
51
|
+
arguments: list[str] = []
|
|
52
|
+
for name, value in resolve_proxy_env_vars().items():
|
|
53
|
+
arguments.extend(["--build-arg", f"{name}={value}"])
|
|
54
|
+
return arguments
|
|
55
|
+
|
|
16
56
|
def create_parser(description: str) -> argparse.ArgumentParser:
|
|
17
57
|
parser = argparse.ArgumentParser(
|
|
18
58
|
description=description,
|
|
@@ -50,6 +90,7 @@ def build_development_image() -> str:
|
|
|
50
90
|
[
|
|
51
91
|
"docker",
|
|
52
92
|
"build",
|
|
93
|
+
*_proxy_build_arguments(),
|
|
53
94
|
"--build-arg",
|
|
54
95
|
"REPOSITORY_SOURCE=.",
|
|
55
96
|
"-t",
|
|
@@ -36,7 +36,15 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
36
36
|
default=Path(Config.BEST_ITERATION_SNAPSHOT_DIRNAME),
|
|
37
37
|
help="Iteration directory relative to --agent-dir",
|
|
38
38
|
)
|
|
39
|
-
parser.
|
|
39
|
+
artifacts_source_options = parser.add_mutually_exclusive_group()
|
|
40
|
+
artifacts_source_options.add_argument(
|
|
41
|
+
"--artifacts-dir", type=Path,
|
|
42
|
+
help=(
|
|
43
|
+
"Use these model artifacts instead of the selected iteration's original artifacts "
|
|
44
|
+
"(cannot be combined with --all-iterations)"
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
artifacts_source_options.add_argument(
|
|
40
48
|
"--all-iterations", action="store_true",
|
|
41
49
|
help="Run every archived iteration",
|
|
42
50
|
)
|
|
@@ -63,6 +71,16 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
|
|
|
63
71
|
"--iteration-dir",
|
|
64
72
|
str(arguments.iteration_dir),
|
|
65
73
|
]
|
|
74
|
+
mounts = [
|
|
75
|
+
f"type=bind,src={arguments.agent_dir},dst=/agent,readonly",
|
|
76
|
+
f"type=bind,src={arguments.input_path},dst={container_input},readonly",
|
|
77
|
+
f"type=bind,src={arguments.output.parent},dst=/inference-output",
|
|
78
|
+
]
|
|
79
|
+
if arguments.artifacts_dir is not None:
|
|
80
|
+
mounts.append(
|
|
81
|
+
f"type=bind,src={arguments.artifacts_dir},dst=/inference-artifacts,readonly"
|
|
82
|
+
)
|
|
83
|
+
python_arguments.extend(["--artifacts-dir", "/inference-artifacts"])
|
|
66
84
|
if arguments.label_col:
|
|
67
85
|
python_arguments.extend(["--label-col", arguments.label_col])
|
|
68
86
|
if arguments.all_iterations:
|
|
@@ -75,11 +93,7 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
|
|
|
75
93
|
return run_python_in_docker(
|
|
76
94
|
image=arguments.image,
|
|
77
95
|
cpu_only=arguments.cpu_only,
|
|
78
|
-
mounts=
|
|
79
|
-
f"type=bind,src={arguments.agent_dir},dst=/agent",
|
|
80
|
-
f"type=bind,src={arguments.input_path},dst={container_input},readonly",
|
|
81
|
-
f"type=bind,src={arguments.output.parent},dst=/inference-output",
|
|
82
|
-
],
|
|
96
|
+
mounts=mounts,
|
|
83
97
|
python_arguments=python_arguments,
|
|
84
98
|
docker_arguments=docker_environment_arguments(
|
|
85
99
|
"WANDB_API_KEY",
|
|
@@ -88,9 +102,11 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
|
|
|
88
102
|
"HTTP_PROXY",
|
|
89
103
|
"HTTPS_PROXY",
|
|
90
104
|
"ALL_PROXY",
|
|
105
|
+
"NO_PROXY",
|
|
91
106
|
"http_proxy",
|
|
92
107
|
"https_proxy",
|
|
93
108
|
"all_proxy",
|
|
109
|
+
"no_proxy",
|
|
94
110
|
),
|
|
95
111
|
check=False,
|
|
96
112
|
)
|
|
@@ -95,7 +95,6 @@ def _build_container_arguments(arguments: argparse.Namespace) -> list[str]:
|
|
|
95
95
|
workflow_arguments.extend(arguments.tags)
|
|
96
96
|
for option, enabled in (
|
|
97
97
|
("--use-provisioning-key", arguments.use_provisioning_key),
|
|
98
|
-
("--test", arguments.test),
|
|
99
98
|
("--cpu-only", arguments.cpu_only),
|
|
100
99
|
("--disable-training-reporting", arguments.disable_training_reporting),
|
|
101
100
|
("--list-models", arguments.list_models),
|
|
@@ -111,8 +110,9 @@ def _docker_environment_arguments(agent_id: str) -> list[str]:
|
|
|
111
110
|
"OPENAI_API_KEY", "ANTHROPIC_API_KEY", "OPENROUTER_API_KEY",
|
|
112
111
|
"PROVISIONING_OPENROUTER_API_KEY", "OLLAMA_BASE_URL",
|
|
113
112
|
"WANDB_API_KEY", "WANDB_PROJECT_NAME", "WANDB_ENTITY",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
113
|
+
"WANDB_RUN_GROUP", "WANDB_JOB_TYPE", "WANDB_NAME",
|
|
114
|
+
"HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY",
|
|
115
|
+
"http_proxy", "https_proxy", "all_proxy", "no_proxy", "CUDA_VISIBLE_DEVICES",
|
|
116
116
|
)
|
|
117
117
|
docker_arguments.extend(["-e", f"AGENT_ID={agent_id}"])
|
|
118
118
|
if sys.stdin.isatty() and sys.stdout.isatty():
|
|
@@ -162,9 +162,10 @@ def _resolve_dataset(
|
|
|
162
162
|
return dataset_directory
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
def
|
|
165
|
+
def build_dataset_mounts(
|
|
166
166
|
dataset_directory: Path | None,
|
|
167
167
|
) -> list[str]:
|
|
168
|
+
"""Build Docker mounts exposing only allowlisted public dataset entries."""
|
|
168
169
|
mounts = [f"type=tmpfs,dst={CONTAINER_DATASETS_DIRECTORY}"]
|
|
169
170
|
if dataset_directory is None:
|
|
170
171
|
return mounts
|
|
@@ -258,6 +259,7 @@ def _run_inference_on_test_input(
|
|
|
258
259
|
),
|
|
259
260
|
label_col=None,
|
|
260
261
|
iteration_dir=Path(Config.BEST_ITERATION_SNAPSHOT_DIRNAME),
|
|
262
|
+
artifacts_dir=None,
|
|
261
263
|
all_iterations=False,
|
|
262
264
|
cpu_only=cpu_only,
|
|
263
265
|
wandb_prefix=test_input.name,
|
|
@@ -355,8 +357,7 @@ def _run_reporting_in_docker(
|
|
|
355
357
|
def _is_agent_run(arguments: argparse.Namespace) -> bool:
|
|
356
358
|
# TODO: Replace this implicit check with explicit command modes.
|
|
357
359
|
return not (
|
|
358
|
-
arguments.
|
|
359
|
-
or arguments.list_models
|
|
360
|
+
arguments.list_models
|
|
360
361
|
or arguments.list_datasets
|
|
361
362
|
or arguments.list_metrics
|
|
362
363
|
)
|
|
@@ -397,7 +398,7 @@ def main() -> int:
|
|
|
397
398
|
return 1
|
|
398
399
|
|
|
399
400
|
workspace_directory = _resolve_workspace(arguments.workspace_dir, agent_id)
|
|
400
|
-
dataset_mounts =
|
|
401
|
+
dataset_mounts = build_dataset_mounts(dataset_directory)
|
|
401
402
|
try:
|
|
402
403
|
exit_code = _run_agent_in_docker(
|
|
403
404
|
arguments,
|
|
@@ -138,11 +138,6 @@ def add_run_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
138
138
|
default=10,
|
|
139
139
|
help="Spend limit for the temporary OpenRouter key",
|
|
140
140
|
)
|
|
141
|
-
operational_arguments.add_argument(
|
|
142
|
-
"--test",
|
|
143
|
-
action="store_true",
|
|
144
|
-
help="Run the project's integrated test suite instead of an agent run",
|
|
145
|
-
)
|
|
146
141
|
operational_arguments.add_argument(
|
|
147
142
|
"--cpu-only",
|
|
148
143
|
action="store_true",
|
|
@@ -9,19 +9,27 @@ from agentomics.run_logging.wandb_setup import setup_logging
|
|
|
9
9
|
from agentomics.runtime.git_checkpoints import initialize_repo_if_needed
|
|
10
10
|
from agentomics.runtime.read_write_utils import (
|
|
11
11
|
initialize_run_directories,
|
|
12
|
-
|
|
12
|
+
save_config_to_file,
|
|
13
13
|
save_dataset_metadata,
|
|
14
14
|
)
|
|
15
15
|
from agentomics.runtime.run_lifecycle import run_agentomics
|
|
16
16
|
from agentomics.utils.config import Config
|
|
17
17
|
from agentomics.run_logging.env_utils import are_wandb_vars_available
|
|
18
18
|
from agentomics.utils.printing_utils import print_phase
|
|
19
|
-
from agentomics.utils.providers.provider import
|
|
19
|
+
from agentomics.utils.providers.provider import Provider
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def initialize_run(config: Config, dataset_metadata: dict) -> None:
|
|
23
|
+
initialize_run_directories(config)
|
|
24
|
+
config.wandb_run_id = setup_logging(config) if are_wandb_vars_available() else None
|
|
25
|
+
save_config_to_file(config)
|
|
26
|
+
save_dataset_metadata(config, dataset_metadata)
|
|
27
|
+
initialize_repo_if_needed(config)
|
|
20
28
|
|
|
21
29
|
|
|
22
30
|
async def run_experiment(
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
model_name: str,
|
|
32
|
+
iteration_plan_model_name: str,
|
|
25
33
|
dataset_name: str,
|
|
26
34
|
task_type: str,
|
|
27
35
|
val_metric: str,
|
|
@@ -30,7 +38,7 @@ async def run_experiment(
|
|
|
30
38
|
tags: list[str],
|
|
31
39
|
iterations: int,
|
|
32
40
|
user_prompt: str,
|
|
33
|
-
provider:
|
|
41
|
+
provider: Provider,
|
|
34
42
|
timeout: int | None,
|
|
35
43
|
split_timeout: int | None,
|
|
36
44
|
run_python_timeout: int,
|
|
@@ -49,12 +57,11 @@ async def run_experiment(
|
|
|
49
57
|
split_time_deadline = time.time() + split_timeout if split_timeout is not None else None
|
|
50
58
|
|
|
51
59
|
agent_id = os.getenv("AGENT_ID")
|
|
52
|
-
agent_user = os.getenv("AGENT_USER")
|
|
53
60
|
config = Config(
|
|
54
61
|
agent_id=agent_id,
|
|
55
|
-
model_name=
|
|
56
|
-
iteration_plan_model_name=
|
|
57
|
-
provider_name=provider,
|
|
62
|
+
model_name=model_name,
|
|
63
|
+
iteration_plan_model_name=iteration_plan_model_name,
|
|
64
|
+
provider_name=provider.name,
|
|
58
65
|
dataset=dataset_name,
|
|
59
66
|
tags=tags,
|
|
60
67
|
val_metric=val_metric,
|
|
@@ -70,22 +77,16 @@ async def run_experiment(
|
|
|
70
77
|
time_deadline=time_deadline,
|
|
71
78
|
split_time_deadline=split_time_deadline,
|
|
72
79
|
run_python_tool_timeout=run_python_timeout,
|
|
73
|
-
agent_user=agent_user,
|
|
74
80
|
disable_training_reporting=disable_training_reporting,
|
|
75
81
|
conda_export_mode=conda_export_mode
|
|
76
82
|
)
|
|
77
83
|
print_phase("Agentomics run started")
|
|
78
|
-
|
|
79
|
-
config.wandb_run_id = setup_logging(config) if are_wandb_vars_available() else None
|
|
80
|
-
save_config(config)
|
|
81
|
-
save_dataset_metadata(config, dataset_metadata)
|
|
82
|
-
initialize_repo_if_needed(config)
|
|
84
|
+
initialize_run(config, dataset_metadata)
|
|
83
85
|
|
|
84
86
|
config.print_summary()
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
iteration_plan_model = provider_obj.create_model(config.iteration_plan_model_name, config)
|
|
88
|
+
default_model = provider.create_model(config.model_name, config)
|
|
89
|
+
iteration_plan_model = provider.create_model(config.iteration_plan_model_name, config)
|
|
89
90
|
|
|
90
91
|
run_fn = run_agentomics
|
|
91
92
|
if timeout is not None:
|
|
@@ -97,7 +98,7 @@ async def run_experiment(
|
|
|
97
98
|
config=config,
|
|
98
99
|
default_model=default_model,
|
|
99
100
|
iteration_plan_model=iteration_plan_model,
|
|
100
|
-
provider=
|
|
101
|
+
provider=provider,
|
|
101
102
|
)
|
|
102
103
|
except TimeoutError:
|
|
103
104
|
print("Timeout reached")
|
|
@@ -124,10 +124,10 @@ def _resolve_interactive_parameters(
|
|
|
124
124
|
if not dataset:
|
|
125
125
|
raise RuntimeError("No dataset selected")
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
if not
|
|
127
|
+
model_name = arguments.model
|
|
128
|
+
if not model_name:
|
|
129
129
|
print_phase("Model Selection")
|
|
130
|
-
|
|
130
|
+
model_name = provider.interactive_model_selection(limit=50)
|
|
131
131
|
|
|
132
132
|
iterations = arguments.iterations
|
|
133
133
|
if iterations is None:
|
|
@@ -140,7 +140,7 @@ def _resolve_interactive_parameters(
|
|
|
140
140
|
if _is_tty_available()
|
|
141
141
|
else Config.DEFAULT_ITERATIONS
|
|
142
142
|
)
|
|
143
|
-
return dataset,
|
|
143
|
+
return dataset, model_name, iterations
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
def run_agent_interactive(arguments: argparse.Namespace) -> int:
|
|
@@ -170,8 +170,8 @@ def run_agent_interactive(arguments: argparse.Namespace) -> int:
|
|
|
170
170
|
style="yellow",
|
|
171
171
|
)
|
|
172
172
|
|
|
173
|
-
dataset,
|
|
174
|
-
|
|
173
|
+
dataset, model_name, iterations = _resolve_interactive_parameters(arguments, provider)
|
|
174
|
+
iteration_plan_model_name = arguments.iteration_plan_model or model_name
|
|
175
175
|
prepared_datasets_dir = arguments.workspace_dir / PREPARED_DATASETS_DIR_NAME
|
|
176
176
|
inherited_dataset_metadata = (
|
|
177
177
|
load_dataset_metadata(existing_config)
|
|
@@ -197,8 +197,8 @@ def run_agent_interactive(arguments: argparse.Namespace) -> int:
|
|
|
197
197
|
|
|
198
198
|
asyncio.run(
|
|
199
199
|
run_experiment(
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
model_name=model_name,
|
|
201
|
+
iteration_plan_model_name=iteration_plan_model_name,
|
|
202
202
|
dataset_name=dataset,
|
|
203
203
|
task_type=task_type,
|
|
204
204
|
dataset_metadata=dataset_metadata,
|
|
@@ -210,7 +210,7 @@ def run_agent_interactive(arguments: argparse.Namespace) -> int:
|
|
|
210
210
|
tags=arguments.tags,
|
|
211
211
|
iterations=iterations,
|
|
212
212
|
user_prompt=arguments.user_prompt,
|
|
213
|
-
provider=
|
|
213
|
+
provider=provider,
|
|
214
214
|
split_allowed_iterations=split_allowed_iterations,
|
|
215
215
|
exploration_iterations=arguments.exploration_iterations,
|
|
216
216
|
timeout=arguments.timeout,
|
|
@@ -14,7 +14,6 @@ from agentomics.runtime.conda_utils import (
|
|
|
14
14
|
export_environment_descriptor_to_path,
|
|
15
15
|
get_iteration_environment_archive_path,
|
|
16
16
|
get_iteration_environment_descriptor_path,
|
|
17
|
-
get_shared_environment_path,
|
|
18
17
|
)
|
|
19
18
|
from agentomics.runtime.filesystem import remove_path
|
|
20
19
|
from agentomics.runtime.step_outputs import load_step_output
|
|
@@ -52,7 +51,7 @@ def update_best_iteration_snapshot(config: Config, iteration: int) -> None:
|
|
|
52
51
|
|
|
53
52
|
def _publish_best_iteration_snapshot(config: Config, source_dir: Path) -> None:
|
|
54
53
|
best_iteration_snapshot_dir = config.best_iteration_snapshot_dir
|
|
55
|
-
conda_env =
|
|
54
|
+
conda_env = config.shared_environment_path
|
|
56
55
|
if not conda_env.exists():
|
|
57
56
|
raise FileNotFoundError(
|
|
58
57
|
f"Cannot publish the best iteration snapshot because the shared Conda environment is missing at {conda_env}."
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import os
|
|
4
5
|
import re
|
|
5
6
|
import shutil
|
|
6
7
|
import subprocess
|
|
@@ -12,8 +13,28 @@ from agentomics.utils.config import Config
|
|
|
12
13
|
|
|
13
14
|
ENVIRONMENT_ARCHIVE_FILENAME = "environment.tar.gz"
|
|
14
15
|
|
|
15
|
-
def
|
|
16
|
-
|
|
16
|
+
def initialize_shared_environment(config: Config) -> Path:
|
|
17
|
+
"""Initialize the run's shared conda environment independently of agent tools."""
|
|
18
|
+
environment_path = config.shared_environment_path
|
|
19
|
+
# Preserve forked run environment.
|
|
20
|
+
if not (environment_path / "conda-meta" / "history").is_file():
|
|
21
|
+
environment_path.mkdir(parents=True, exist_ok=True)
|
|
22
|
+
subprocess.run(
|
|
23
|
+
["tar", "-xf", os.environ["START_ENV_PKG"], "-C", str(environment_path)],
|
|
24
|
+
cwd=config.shared_dir,
|
|
25
|
+
check=True,
|
|
26
|
+
)
|
|
27
|
+
subprocess.run(
|
|
28
|
+
[str(environment_path / "bin" / "conda-unpack")],
|
|
29
|
+
cwd=config.shared_dir,
|
|
30
|
+
check=True,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
subprocess.run(
|
|
34
|
+
["chown", "-R", config.AGENT_USER, str(environment_path)],
|
|
35
|
+
check=True,
|
|
36
|
+
)
|
|
37
|
+
return environment_path
|
|
17
38
|
|
|
18
39
|
def get_iteration_environment_descriptor_path(iteration_dir: Path) -> Path:
|
|
19
40
|
return iteration_dir / Config.RUNTIME_INFO_DIRNAME / Config.ENVIRONMENT_DESCRIPTOR_FILENAME
|
|
@@ -55,6 +76,7 @@ def export_environment_archive(env_path: Path, archive_path: Path) -> None:
|
|
|
55
76
|
str(Path(sys.executable).parent / "conda-pack"),
|
|
56
77
|
"-p", str(env_path),
|
|
57
78
|
"-o", str(archive_path),
|
|
79
|
+
"-j", "-1",
|
|
58
80
|
"--force",
|
|
59
81
|
"--quiet",
|
|
60
82
|
],
|
|
@@ -133,7 +155,7 @@ def run_python_in_environment(
|
|
|
133
155
|
)
|
|
134
156
|
|
|
135
157
|
def export_shared_environment_descriptor(config: Config) -> None:
|
|
136
|
-
conda_env =
|
|
158
|
+
conda_env = config.shared_environment_path
|
|
137
159
|
export_environment_descriptor_to_path(
|
|
138
160
|
env_path=conda_env,
|
|
139
161
|
descriptor_path=config.shared_dir / Config.ENVIRONMENT_DESCRIPTOR_FILENAME,
|
|
@@ -196,7 +218,7 @@ def _collect_environment_packages(
|
|
|
196
218
|
(
|
|
197
219
|
(name, version)
|
|
198
220
|
for norm, (name, version) in conda_managed.items()
|
|
199
|
-
if norm not in
|
|
221
|
+
if norm not in conda_replaced_by_pip
|
|
200
222
|
),
|
|
201
223
|
key=lambda x: x[0],
|
|
202
224
|
)
|
|
@@ -252,11 +274,17 @@ def _iter_python_metadata_paths(env_path: Path, conda_record: dict) -> list[Path
|
|
|
252
274
|
|
|
253
275
|
|
|
254
276
|
def _read_distribution_name(metadata_path: Path) -> str | None:
|
|
255
|
-
if
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
277
|
+
if metadata_path.is_file():
|
|
278
|
+
for line in metadata_path.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
279
|
+
if line.startswith("Name: "):
|
|
280
|
+
return line.removeprefix("Name: ").strip()
|
|
281
|
+
# pip can delete METADATA, the file containing a Python package's name.
|
|
282
|
+
# Conda still records its path (e.g. chardet-5.2.0.dist-info/METADATA).
|
|
283
|
+
# Take the directory name before the final "-<version>" as the package name.
|
|
284
|
+
directory = metadata_path.parent
|
|
285
|
+
if directory.suffix == ".dist-info" and "-" in directory.stem:
|
|
286
|
+
name, _version = directory.stem.rsplit("-", 1)
|
|
287
|
+
return name
|
|
260
288
|
return None
|
|
261
289
|
|
|
262
290
|
|
|
@@ -31,6 +31,10 @@ def resolve_inference_paths(arguments: Namespace) -> None:
|
|
|
31
31
|
arguments.agent_dir = resolve_existing_directory(arguments.agent_dir)
|
|
32
32
|
arguments.input_path = resolve_existing_path(arguments.input_path)
|
|
33
33
|
arguments.output = resolve_output_path(arguments.output)
|
|
34
|
+
if arguments.artifacts_dir is not None:
|
|
35
|
+
if arguments.all_iterations:
|
|
36
|
+
raise ValueError("--artifacts-dir cannot be used with --all-iterations")
|
|
37
|
+
arguments.artifacts_dir = resolve_existing_directory(arguments.artifacts_dir)
|
|
34
38
|
|
|
35
39
|
def require_empty_directory(path: Path) -> None:
|
|
36
40
|
if path.exists() and not path.is_dir():
|
|
@@ -58,7 +58,11 @@ def _run_single_inference(arguments: Namespace) -> None:
|
|
|
58
58
|
if not inference_script.is_file():
|
|
59
59
|
raise FileNotFoundError(f"inference.py not found at: {inference_script}")
|
|
60
60
|
|
|
61
|
-
artifacts_path =
|
|
61
|
+
artifacts_path = (
|
|
62
|
+
arguments.artifacts_dir
|
|
63
|
+
if arguments.artifacts_dir is not None
|
|
64
|
+
else iteration_root / "model_training" / "training_artifacts"
|
|
65
|
+
)
|
|
62
66
|
print(f"Using iteration directory: {arguments.iteration_dir}")
|
|
63
67
|
|
|
64
68
|
with tempfile.TemporaryDirectory() as temporary_directory:
|
|
@@ -26,7 +26,7 @@ def initialize_run_directories(config: Config) -> None:
|
|
|
26
26
|
config.best_iteration_snapshot_dir.mkdir(parents=True, exist_ok=True)
|
|
27
27
|
config.splits_dir.mkdir(parents=True, exist_ok=True)
|
|
28
28
|
|
|
29
|
-
def
|
|
29
|
+
def save_config_to_file(config: Config) -> None:
|
|
30
30
|
config.config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
31
31
|
config.config_path.write_text(json.dumps(asdict(config), indent=2), encoding="utf-8")
|
|
32
32
|
|
|
@@ -60,8 +60,7 @@ def load_config_from_run_dir_and_reroot(run_dir: Path) -> Config:
|
|
|
60
60
|
def initialize_current_iteration_workspace(config: Config) -> None:
|
|
61
61
|
config.current_iteration_dir.mkdir(parents=True, exist_ok=True)
|
|
62
62
|
config.current_iteration_runtime_info_dir.mkdir(exist_ok=True)
|
|
63
|
-
|
|
64
|
-
chown_tree_to_root(config.current_iteration_dir)
|
|
63
|
+
chown_tree_to_root(config.current_iteration_dir)
|
|
65
64
|
|
|
66
65
|
def archive_current_iteration(config: Config, iteration: int) -> None:
|
|
67
66
|
export_shared_environment_descriptor(config)
|
|
@@ -77,8 +76,7 @@ def archive_current_iteration(config: Config, iteration: int) -> None:
|
|
|
77
76
|
if archived_iteration_dir.exists():
|
|
78
77
|
remove_path(archived_iteration_dir)
|
|
79
78
|
current_iteration_dir.replace(archived_iteration_dir)
|
|
80
|
-
|
|
81
|
-
chown_tree_to_root(archived_iteration_dir)
|
|
79
|
+
chown_tree_to_root(archived_iteration_dir)
|
|
82
80
|
|
|
83
81
|
def get_archived_iterations(
|
|
84
82
|
config: Config,
|