mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-04 02:37:44 +00:00
90d9cdd0e9
* udpate plot * log and reduce token * trace tag * add simple_background parameter to get_scenario_all_desc * update trace * update first version code * chat model map * add annotation for stack index * add annotation * reformatted by black * several update on kaggle scenarios * update some new change * fix CI * fix CI * fix a bug * fix bugs in graph RAG --------- Co-authored-by: Tim <illking@foxmail.com>
73 lines
2.4 KiB
Python
73 lines
2.4 KiB
Python
from copy import deepcopy
|
|
from pathlib import Path
|
|
|
|
from rdagent.components.coder.model_coder.model import (
|
|
ModelExperiment,
|
|
ModelFBWorkspace,
|
|
ModelTask,
|
|
)
|
|
from rdagent.core.experiment import Task
|
|
from rdagent.core.prompts import Prompts
|
|
from rdagent.core.scenario import Scenario
|
|
from rdagent.scenarios.qlib.experiment.workspace import QlibFBWorkspace
|
|
|
|
prompt_dict = Prompts(file_path=Path(__file__).parent / "prompts.yaml")
|
|
|
|
|
|
class QlibModelExperiment(ModelExperiment[ModelTask, QlibFBWorkspace, ModelFBWorkspace]):
|
|
def __init__(self, *args, **kwargs) -> None:
|
|
super().__init__(*args, **kwargs)
|
|
self.experiment_workspace = QlibFBWorkspace(template_folder_path=Path(__file__).parent / "model_template")
|
|
|
|
|
|
class QlibModelScenario(Scenario):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
self._background = deepcopy(prompt_dict["qlib_model_background"])
|
|
self._output_format = deepcopy(prompt_dict["qlib_model_output_format"])
|
|
self._interface = deepcopy(prompt_dict["qlib_model_interface"])
|
|
self._simulator = deepcopy(prompt_dict["qlib_model_simulator"])
|
|
self._rich_style_description = deepcopy(prompt_dict["qlib_model_rich_style_description"])
|
|
self._experiment_setting = deepcopy(prompt_dict["qlib_model_experiment_setting"])
|
|
|
|
@property
|
|
def background(self) -> str:
|
|
return self._background
|
|
|
|
@property
|
|
def source_data(self) -> str:
|
|
raise NotImplementedError("source_data of QlibModelScenario is not implemented")
|
|
|
|
@property
|
|
def output_format(self) -> str:
|
|
return self._output_format
|
|
|
|
@property
|
|
def interface(self) -> str:
|
|
return self._interface
|
|
|
|
@property
|
|
def simulator(self) -> str:
|
|
return self._simulator
|
|
|
|
@property
|
|
def rich_style_description(self) -> str:
|
|
return self._rich_style_description
|
|
|
|
@property
|
|
def experiment_setting(self) -> str:
|
|
return self._experiment_setting
|
|
|
|
def get_scenario_all_desc(
|
|
self, task: Task | None = None, filtered_tag: str | None = None, simple_background: bool | None = None
|
|
) -> str:
|
|
return f"""Background of the scenario:
|
|
{self.background}
|
|
The interface you should follow to write the runnable code:
|
|
{self.interface}
|
|
The output of your code should be in the format:
|
|
{self.output_format}
|
|
The simulator user can use to test your model:
|
|
{self.simulator}
|
|
"""
|