chore: implement runtime_env func (#1104)

* implement runtime_env func for quant

* add runtime_info code

* add runtime env information to the prompt

* format with black

* optimize get_runtime_env code

* delete unnecessary files

* some refinement

* fix fin_quant bugs

---------

Co-authored-by: Xu Yang <peteryang@vip.qq.com>
This commit is contained in:
Linlang
2025-07-28 14:19:41 +08:00
committed by GitHub
parent 514c191b75
commit bbcee389b4
10 changed files with 156 additions and 16 deletions
@@ -1,6 +1,14 @@
import os
from typing import Optional
from pydantic_settings import SettingsConfigDict
from rdagent.components.coder.CoSTEER.config import CoSTEERSettings
from rdagent.utils.env import (
CondaConf,
Env,
LocalEnv,
)
class FactorCoSTEERSettings(CoSTEERSettings):
@@ -25,4 +33,21 @@ class FactorCoSTEERSettings(CoSTEERSettings):
"""Path to the Python binary"""
def get_factor_env(
conf_type: Optional[str] = None,
extra_volumes: dict = {},
running_timeout_period: int = 600,
enable_cache: Optional[bool] = None,
) -> Env:
conf = FactorCoSTEERSettings()
if hasattr(conf, "python_bin"):
env = LocalEnv(conf=(CondaConf(conda_env_name=os.environ.get("CONDA_DEFAULT_ENV"))))
env.conf.extra_volumes = extra_volumes.copy()
env.conf.running_timeout_period = running_timeout_period
if enable_cache is not None:
env.conf.enable_cache = enable_cache
env.prepare()
return env
FACTOR_COSTEER_SETTINGS = FactorCoSTEERSettings()