ASTRA - Adaptive Stress Testing for Robust AI
ASTRA-RL is a python toolbox for training and evaluating language models and generative AI systems that use textual inputs. It provides a set of tools for training, evaluating, and analyzing language models, with a focus on applying reinforcement learning based refinement techniques to improve evaluator model performance.
To install the ASTRA-RL toolbox, you can use pip. The package is available on PyPI, so you can install it directly from there.
pip install astra-rlYou can then import the library in your Python code:
import astra_rl
# or
import astra_rl as astralThis section provides instructions for setting up the development environment and running tests.
To start, we STRONGLY recommend using uv to manage your Python environment. This will ensure that you have the correct dependencies and versions installed.
-
Clone the repository:
git clone https://github.com/sisl/astra-rl.git cd astra-rl -
Sync package dependencies:
uv sync --dev
This will create a
.venvdirectory in the project root with all the necessary dependencies installed. -
Install pre-commit hooks:
uv run pre-commit install
This will ensure that the linter (
ruff), formatter (ruff), and type checker (mypy) is happy with your code every time you commit.
Assuming you've set up your environment using uv, you can run the tests using the following command:
pytestor
uv run pytestTo generate local coverage reports, you can use:
uv run coverage run -m pytest
uv run coverage report # Generate CLI report
uv run coverage html # Generate HTML reportSome tests may require a GPU to run. You can enable GPU tests by passing the --gpu option:
uv run pytest --gpuThese tests will be skipped by default unless you specify the --gpu option.
To generate the documentation, you can use the following command:
uv run mkdocs serveThis will build the documentation and start a local server. You can then view the documentation in your web browser.