2024-06-28 11:45:23 +08:00
|
|
|
"""
|
|
|
|
|
TODO: Model Structure RD-Loop
|
|
|
|
|
TODO: move the following code to a new class: Model_RD_Agent
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# import_from
|
|
|
|
|
from rdagent.app.model_proposal.conf import MODEL_PROP_SETTING
|
2024-07-05 17:42:00 +08:00
|
|
|
|
2024-07-02 17:58:37 +08:00
|
|
|
from rdagent.core.proposal import (
|
|
|
|
|
Experiment2Feedback,
|
|
|
|
|
Hypothesis2Experiment,
|
|
|
|
|
HypothesisSet,
|
|
|
|
|
Trace,
|
|
|
|
|
)
|
|
|
|
|
from rdagent.core.task_generator import TaskGenerator
|
2024-06-28 11:45:23 +08:00
|
|
|
|
|
|
|
|
# load_from_cls_uri
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scen = load_from_cls_uri(MODEL_PROP_SETTING.scen)()
|
|
|
|
|
|
2024-07-02 17:58:37 +08:00
|
|
|
hypothesis_gen = load_from_cls_uri(MODEL_PROP_SETTING.hypothesis_gen)(scen)
|
2024-06-28 11:45:23 +08:00
|
|
|
|
2024-07-02 17:58:37 +08:00
|
|
|
hypothesis2task: Hypothesis2Experiment = load_from_cls_uri(MODEL_PROP_SETTING.hypothesis2task)()
|
2024-06-28 11:45:23 +08:00
|
|
|
|
|
|
|
|
task_gen: TaskGenerator = load_from_cls_uri(MODEL_PROP_SETTING.task_gen)(scen) # for implementation
|
|
|
|
|
|
2024-07-02 17:58:37 +08:00
|
|
|
imp2feedback: Experiment2Feedback = load_from_cls_uri(MODEL_PROP_SETTING.imp2feedback)(scen) # for implementation
|
2024-06-28 11:45:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
iter_n = MODEL_PROP_SETTING.iter_n
|
|
|
|
|
|
|
|
|
|
trace = Trace()
|
|
|
|
|
|
2024-07-02 17:58:37 +08:00
|
|
|
hypothesis_set = HypothesisSet()
|
2024-06-28 11:45:23 +08:00
|
|
|
for _ in range(iter_n):
|
2024-07-02 17:58:37 +08:00
|
|
|
hypothesis = hypothesis_gen.gen(trace)
|
|
|
|
|
task = hypothesis2task.convert(hypothesis)
|
2024-06-28 11:45:23 +08:00
|
|
|
imp = task_gen.gen(task)
|
|
|
|
|
imp.execute()
|
|
|
|
|
feedback = imp2feedback.summarize(imp)
|
2024-07-02 17:58:37 +08:00
|
|
|
trace.hist.append((hypothesis, feedback))
|