Files
NexQuant/rdagent/app/model_extraction_and_code/GeneralModel.py
T

63 lines
1.9 KiB
Python
Raw Normal View History

2024-07-30 15:47:21 +08:00
from pathlib import Path
2024-07-30 17:23:05 +08:00
from rdagent.components.coder.model_coder.model import ModelExperiment
2024-07-30 15:47:21 +08:00
from rdagent.core.prompts import Prompts
from rdagent.core.scenario import Scenario
prompt_dict = Prompts(file_path=Path(__file__).parent / "prompts.yaml")
2024-07-30 17:23:05 +08:00
2024-07-30 15:47:21 +08:00
class GeneralModelScenario(Scenario):
@property
def background(self) -> str:
return prompt_dict["general_model_background"]
@property
def source_data(self) -> str:
raise NotImplementedError("source_data of GeneralModelScenario is not implemented")
@property
def output_format(self) -> str:
return prompt_dict["general_model_output_format"]
@property
def interface(self) -> str:
return prompt_dict["general_model_interface"]
@property
def simulator(self) -> str:
return prompt_dict["general_model_simulator"]
2024-07-30 17:23:05 +08:00
2024-07-30 15:47:21 +08:00
@property
2024-07-30 17:23:05 +08:00
def rich_style_description(self) -> str:
return """
# [Model Research & Development Co-Pilot] (#_scenario)
## [Overview](#_summary)
This demo automates the extraction and development of PyTorch models from academic papers. It supports various model types through two main components: Reader and Coder.
#### [Workflow Components](#_rdloops)
1. **[Reader](#_research)**
- Extracts model information from papers, including architectures and parameters.
- Converts content into a structured format using Large Language Models.
2. **[Evolving Coder](#_development)**
- Translates structured information into executable PyTorch code.
- Ensures correct tensor shapes with an evolving coding mechanism.
- Refines the code to match source specifications.
2024-07-30 15:47:21 +08:00
2024-07-30 17:23:05 +08:00
"""
2024-07-30 15:47:21 +08:00
def get_scenario_all_desc(self) -> 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}
"""