mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-28 07:57:44 +00:00
d6ce70b551
* 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>
89 lines
3.0 KiB
Python
89 lines
3.0 KiB
Python
from __future__ import annotations
|
|
|
|
# TODO: use pydantic for other modules in Qlib
|
|
from pathlib import Path
|
|
from typing import cast
|
|
|
|
from pydantic_settings import (
|
|
BaseSettings,
|
|
EnvSettingsSource,
|
|
PydanticBaseSettingsSource,
|
|
)
|
|
|
|
|
|
class ExtendedBaseSettings(BaseSettings):
|
|
|
|
@classmethod
|
|
def settings_customise_sources(
|
|
cls,
|
|
settings_cls: type[BaseSettings],
|
|
init_settings: PydanticBaseSettingsSource,
|
|
env_settings: PydanticBaseSettingsSource,
|
|
dotenv_settings: PydanticBaseSettingsSource,
|
|
file_secret_settings: PydanticBaseSettingsSource,
|
|
) -> tuple[PydanticBaseSettingsSource, ...]:
|
|
# 1) walk from base class
|
|
def base_iter(settings_cls: type[ExtendedBaseSettings]) -> list[type[ExtendedBaseSettings]]:
|
|
bases = []
|
|
for cl in settings_cls.__bases__:
|
|
if issubclass(cl, ExtendedBaseSettings) and cl is not ExtendedBaseSettings:
|
|
bases.append(cl)
|
|
bases.extend(base_iter(cl))
|
|
return bases
|
|
|
|
# 2) Build EnvSettingsSource from base classes, so we can add parent Env Sources
|
|
parent_env_settings = [
|
|
EnvSettingsSource(
|
|
base_cls,
|
|
case_sensitive=base_cls.model_config.get("case_sensitive"),
|
|
env_prefix=base_cls.model_config.get("env_prefix"),
|
|
env_nested_delimiter=base_cls.model_config.get("env_nested_delimiter"),
|
|
)
|
|
for base_cls in base_iter(cast("type[ExtendedBaseSettings]", settings_cls))
|
|
]
|
|
return init_settings, env_settings, *parent_env_settings, dotenv_settings, file_secret_settings
|
|
|
|
|
|
class RDAgentSettings(ExtendedBaseSettings):
|
|
# TODO: (xiao) I think LLMSetting may be a better name.
|
|
# TODO: (xiao) I think most of the config should be in oai.config
|
|
# Log configs
|
|
# TODO: (xiao) think it can be a separate config.
|
|
log_trace_path: str | None = None
|
|
|
|
# azure document intelligence configs
|
|
azure_document_intelligence_key: str = ""
|
|
azure_document_intelligence_endpoint: str = ""
|
|
# factor extraction conf
|
|
max_input_duplicate_factor_group: int = 300
|
|
max_output_duplicate_factor_group: int = 20
|
|
max_kmeans_group_number: int = 40
|
|
|
|
# workspace conf
|
|
workspace_path: Path = Path.cwd() / "git_ignore_folder" / "RD-Agent_workspace"
|
|
|
|
# multi processing conf
|
|
multi_proc_n: int = 1
|
|
|
|
# pickle cache conf
|
|
cache_with_pickle: bool = True # whether to use pickle cache
|
|
pickle_cache_folder_path_str: str = str(
|
|
Path.cwd() / "pickle_cache/",
|
|
) # the path of the folder to store the pickle cache
|
|
use_file_lock: bool = (
|
|
True # when calling the function with same parameters, whether to use file lock to avoid
|
|
# executing the function multiple times
|
|
)
|
|
|
|
# misc
|
|
"""The limitation of context stdout"""
|
|
stdout_context_len: int = 400
|
|
stdout_line_len: int = 10000
|
|
|
|
enable_mlflow: bool = False
|
|
|
|
initial_fator_library_size: int = 20
|
|
|
|
|
|
RD_AGENT_SETTINGS = RDAgentSettings()
|