feat: add RD-Agent-Quant scenario (#838)

* fix model input shape bug and costeer_model bug

* fix a bug

* fix a bug in docker result extraction

* a system-level optimization

* add a filter of stdout

* update

* add stdout to model

* model training_hyperparameters update

* quant scenario

* update some quant settings

* llm choose action

* Thompson Sampling Bandit for action choosing

* refine both scens

* add trace messages for quant scen

* fix some bugs

* fix some bugs

* update

* update

* update

* fix

* fix

* fix

* update for merge

* fix ci

* fix some bugs

* fix ci

* fix ci

* fix ci

* fix ci

* refactor

* default qlib4rdagent local env downloading

* fix ci

* fix ci

* fix a bug

* fix ci

* fix: align all prompts on template (#908)

* use template to render all prompts

* fix CI

---------

Co-authored-by: Xu Yang <xuyang1@microsoft.com>

* add fin_quant in cli

* fix a bug

* fix ci

* fix some bugs

* refactor

* remove the columns in hypothesis if no value generated in this column

* fix a bug

* fix ci

* fix conda env

* add qlib gitignore

* remove existed qlib folder & install torch in qlib conda

* fix workspace ui in feedback

* align model config in coder and runner in docker or conda

* fix CI

* fix CI

---------

Co-authored-by: Xu Yang <peteryang@vip.qq.com>
Co-authored-by: Xu Yang <xuyang1@microsoft.com>
This commit is contained in:
Yuante Li
2025-05-29 16:16:51 +08:00
committed by GitHub
parent 628deade72
commit d6ce70b551
64 changed files with 2427 additions and 1025 deletions
+24 -2
View File
@@ -5,10 +5,11 @@ from pathlib import Path
from typing import Dict, Optional
from rdagent.components.coder.CoSTEER.task import CoSTEERTask
from rdagent.components.coder.model_coder.conf import MODEL_COSTEER_SETTINGS
from rdagent.core.experiment import Experiment, FBWorkspace
from rdagent.core.utils import cache_with_pickle
from rdagent.oai.llm_utils import md5_hash
from rdagent.utils.env import KGDockerEnv, QTDockerEnv
from rdagent.utils.env import KGDockerEnv, QlibCondaConf, QlibCondaEnv, QTDockerEnv
class ModelTask(CoSTEERTask):
@@ -19,6 +20,7 @@ class ModelTask(CoSTEERTask):
architecture: str,
*args,
hyperparameters: Dict[str, str],
training_hyperparameters: Dict[str, str],
formulation: str = None,
variables: Dict[str, str] = None,
model_type: Optional[str] = None,
@@ -28,6 +30,7 @@ class ModelTask(CoSTEERTask):
self.architecture: str = architecture
self.variables: str = variables
self.hyperparameters: str = hyperparameters
self.training_hyperparameters: str = training_hyperparameters
self.model_type: str = (
model_type # Tabular for tabular model, TimesSeries for time series model, Graph for graph model, XGBoost for XGBoost model
)
@@ -41,6 +44,17 @@ description: {self.description}
task_desc += f"architecture: {self.architecture}\n"
task_desc += f"variables: {self.variables}\n" if self.variables else ""
task_desc += f"hyperparameters: {self.hyperparameters}\n"
task_desc += f"training_hyperparameters: {self.training_hyperparameters}\n"
task_desc += f"model_type: {self.model_type}\n"
return task_desc
def get_task_brief_information(self):
task_desc = f"""name: {self.name}
description: {self.description}
"""
task_desc += f"architecture: {self.architecture}\n"
task_desc += f"hyperparameters: {self.hyperparameters}\n"
task_desc += f"training_hyperparameters: {self.training_hyperparameters}\n"
task_desc += f"model_type: {self.model_type}\n"
return task_desc
@@ -99,7 +113,15 @@ class ModelFBWorkspace(FBWorkspace):
):
self.before_execute()
try:
qtde = QTDockerEnv() if self.target_task.version == 1 else KGDockerEnv()
if self.target_task.version == 1:
if MODEL_COSTEER_SETTINGS.env_type == "docker":
qtde = QTDockerEnv()
elif MODEL_COSTEER_SETTINGS.env_type == "conda":
qtde = QlibCondaEnv(conf=QlibCondaConf())
else:
raise ValueError(f"Unknown env_type: {MODEL_COSTEER_SETTINGS.env_type}")
else:
qtde = KGDockerEnv()
qtde.prepare()
if self.target_task.version == 1: