Skip to content

Commit

Permalink
add autopydantic_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
qew21 committed Aug 2, 2024
1 parent ee22741 commit 11d2c5d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 16 deletions.
27 changes: 27 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'rda'
copyright = '2024, r'
author = 'r'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

extensions = [
"sphinx.ext.autodoc",
"sphinxcontrib.autodoc_pydantic"
]

autodoc_member_order = "bysource"
Expand Down Expand Up @@ -61,4 +62,4 @@
except ImportError:
html_theme = "default"

html_static_path = ["_static"]
html_static_path = ["_static"]
18 changes: 7 additions & 11 deletions docs/research/benchmark.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ Development Capability Benchmarking
===================================


.. TODO:
Setting.
https://autodoc-pydantic.readthedocs.io/en/stable/users/faq.html
.. autopydantic_model:: target.faq.inherited_members.WithoutInheritedMembers




Benchmark is used to evaluate the effectiveness of code with fixed data.

It mainly includes the following steps:
Expand All @@ -41,6 +31,12 @@ It mainly includes the following steps:

5.save and show the result

Configuration
-------------

.. autopydantic_settings:: rdagent.components.benchmark.conf.BenchmarkSettings



Run Benchmark
-------------
Expand Down Expand Up @@ -70,7 +66,7 @@ Modify the python code in ``rdagent/app/quant_factor_benchmark/analysis.py`` to
A png file will be saved to the designated path as shown below.

.. image:: _static/benchmark.png
.. image:: ../_static/benchmark.png



Expand Down
18 changes: 14 additions & 4 deletions rdagent/components/benchmark/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,33 @@

from pydantic_settings import BaseSettings

DIRNAME = Path(__file__).absolute().resolve().parent
DIRNAME = Path("./")


class BenchmarkSettings(BaseSettings):
class Config:
env_prefix = "BENCHMARK_" # Use BENCHMARK_ as prefix for environment variables
env_prefix = "BENCHMARK_"
"""Use `BENCHMARK_` as prefix for environment variables"""

ground_truth_dir: Path = DIRNAME / "ground_truth"
"""ground truth dir"""

bench_data_path: Path = DIRNAME / "example.json"
"""data for benchmark"""

bench_test_round: int = 10
bench_test_case_n: Optional[int] = None # how many test cases to run; If not given, all test cases will be run
"""how many rounds to run, each round may cost 10 minutes"""

bench_test_case_n: Optional[int] = None
"""how many test cases to run; If not given, all test cases will be run"""

bench_method_cls: str = "rdagent.components.coder.factor_coder.CoSTEER.FactorCoSTEER"
"""method to be used for test cases"""

bench_method_extra_kwargs: dict = field(
default_factory=dict,
) # extra kwargs for the method to be tested except the task list
)
"""extra kwargs for the method to be tested except the task list"""

bench_result_path: Path = DIRNAME / "result"
"""result save path"""

0 comments on commit 11d2c5d

Please sign in to comment.