mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-07 03:57:45 +00:00
feat: make spec optional (#719)
* feat: Add spec_enabled configuration for data science settings * make spec alternative * change spec logic in exp_gen * remove some general texts * align --------- Co-authored-by: Young <afe.young@gmail.com> Co-authored-by: yuanteli <1957922024@qq.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from rdagent.app.data_science.conf import DS_RD_SETTING
|
||||
from rdagent.components.coder.CoSTEER import CoSTEER
|
||||
from rdagent.components.coder.CoSTEER.evaluators import (
|
||||
CoSTEERMultiEvaluator,
|
||||
@@ -23,6 +25,8 @@ from rdagent.oai.llm_utils import APIBackend
|
||||
from rdagent.utils.agent.ret import PythonBatchEditOut
|
||||
from rdagent.utils.agent.tpl import T
|
||||
|
||||
DIRNAME = Path(__file__).absolute().resolve().parent
|
||||
|
||||
|
||||
class ModelMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
|
||||
def implement_one_task(
|
||||
@@ -71,8 +75,16 @@ class ModelMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
|
||||
# latest_code=workspace.file_dict.get(f"{target_task.name}.py", None),
|
||||
# )
|
||||
# We want to use a simpler way to
|
||||
code_spec = (
|
||||
workspace.file_dict["spec/model.md"]
|
||||
if DS_RD_SETTING.spec_enabled
|
||||
else T("scenarios.data_science.share:component_spec.general").r(
|
||||
spec=T("scenarios.data_science.share:component_spec.Model").r(),
|
||||
test_code=(DIRNAME / "eval_tests" / "model_test.txt").read_text().replace("model01", target_task.name),
|
||||
)
|
||||
)
|
||||
user_prompt = T(".prompts:model_coder.user_general").r(
|
||||
model_spec=workspace.file_dict["spec/model.md"],
|
||||
code_spec=code_spec,
|
||||
latest_model_code=workspace.get_codes(
|
||||
r"^model_(?!test)\w+\.py$"
|
||||
), # TODO: If we have high failure rate here, we should clean this step with less information.
|
||||
|
||||
@@ -98,8 +98,6 @@ class ModelGeneralCaseSpecEvaluator(CoSTEEREvaluator):
|
||||
task_desc=target_task.get_task_information(),
|
||||
test_code=test_code,
|
||||
code=implementation.file_dict[f"{target_task.name}.py"],
|
||||
scenario=self.scen.get_scenario_all_desc(),
|
||||
spec=implementation.file_dict["spec/model.md"],
|
||||
workflow_stdout=workflow_stdout,
|
||||
workflow_code=implementation.all_codes,
|
||||
)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Tests for `model_workflow` in model01.py
|
||||
"""
|
||||
import time
|
||||
|
||||
from feature import feat_eng
|
||||
|
||||
@@ -53,8 +53,8 @@ model_coder:
|
||||
{% endif %}
|
||||
|
||||
user_general: |-
|
||||
--------- Model Building Specification ---------
|
||||
{{ model_spec }}
|
||||
--------- Code Specification ---------
|
||||
{{ code_spec }}
|
||||
|
||||
--------- Former model code ---------
|
||||
{% if latest_model_code|length == 0 %}
|
||||
|
||||
Reference in New Issue
Block a user