mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-07 03:57:45 +00:00
feat: Add runtime measurement for each step and loop in RDLoop. (#281)
* Add runtime measurement for each step and loop in RDLoop. * refine some codes * refine the code (#276) * show variables only when it exists (#277) * fix: support seed and fix absolute path (#278) * fix: support seed and fix absolute path * Absolute path * lint * fix: improve_execution_time_in_kaggle_loop (#279) * improve_execution_time_in_kaggle_loop * fix CI * fix CI * fix CI * fix: Update runner.py to fix a small bug (#282) * fix: Update runner.py to fix a small bug * fix CI * refine the code * Update loop.py * Update rd_loop.py * Update model_xgb.py --------- Co-authored-by: XianBW <36835909+XianBW@users.noreply.github.com> Co-authored-by: you-n-g <you-n-g@users.noreply.github.com> Co-authored-by: Xu Yang <peteryang@vip.qq.com>
This commit is contained in:
@@ -10,11 +10,13 @@ from rdagent.app.qlib_rd_loop.conf import FACTOR_PROP_SETTING
|
||||
from rdagent.components.workflow.rd_loop import RDLoop
|
||||
from rdagent.core.exception import FactorEmptyError
|
||||
from rdagent.log import rdagent_logger as logger
|
||||
from rdagent.log.time import measure_time
|
||||
|
||||
|
||||
class FactorRDLoop(RDLoop):
|
||||
skip_loop_error = (FactorEmptyError,)
|
||||
|
||||
@measure_time
|
||||
def running(self, prev_out: dict[str, Any]):
|
||||
with logger.tag("ef"): # evaluate and feedback
|
||||
exp = self.runner.develop(prev_out["coding"])
|
||||
|
||||
@@ -14,6 +14,7 @@ from rdagent.components.document_reader.document_reader import (
|
||||
from rdagent.core.prompts import Prompts
|
||||
from rdagent.core.proposal import Hypothesis
|
||||
from rdagent.log import rdagent_logger as logger
|
||||
from rdagent.log.time import measure_time
|
||||
from rdagent.oai.llm_utils import APIBackend
|
||||
from rdagent.scenarios.qlib.experiment.factor_experiment import QlibFactorExperiment
|
||||
from rdagent.scenarios.qlib.factor_experiment_loader.pdf_loader import (
|
||||
@@ -101,6 +102,7 @@ def extract_hypothesis_and_exp_from_reports(report_file_path: str) -> Tuple[Qlib
|
||||
|
||||
|
||||
class FactorReportLoop(FactorRDLoop, metaclass=LoopMeta):
|
||||
@measure_time
|
||||
def __init__(self, report_folder: str = None):
|
||||
super().__init__(PROP_SETTING=FACTOR_FROM_REPORT_PROP_SETTING)
|
||||
if report_folder is None:
|
||||
@@ -116,6 +118,7 @@ class FactorReportLoop(FactorRDLoop, metaclass=LoopMeta):
|
||||
self.current_loop_exp = None
|
||||
self.steps = ["propose_hypo_exp", "propose", "exp_gen", "coding", "running", "feedback"]
|
||||
|
||||
@measure_time
|
||||
def propose_hypo_exp(self, prev_out: dict[str, Any]):
|
||||
with logger.tag("r"):
|
||||
while True:
|
||||
@@ -137,9 +140,11 @@ class FactorReportLoop(FactorRDLoop, metaclass=LoopMeta):
|
||||
self.current_loop_exp = exp
|
||||
return None
|
||||
|
||||
@measure_time
|
||||
def propose(self, prev_out: dict[str, Any]):
|
||||
return self.current_loop_hypothesis
|
||||
|
||||
@measure_time
|
||||
def exp_gen(self, prev_out: dict[str, Any]):
|
||||
return self.current_loop_exp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user