A Python package to run crosscoders.
-
Install conda
-
conda env create --file=env.yml
Create a .env file in the repo root directory and add the following lines, modifying PROJECT_ROOT_DIR and CONFIG_FILEPATH to point to the absolute path of the repo root directory and the run config file you want to use.
export PROJECT_ROOT_DIR="."
export CONFIG_FILEPATH="${PROJECT_ROOT_DIR}/src/scripts/configs/cfg.yml" # egSee
src/crosscoders/constants.pyfor a list ofREQUIRED_ENV_VARS.
See
src/scripts/configs/for preset run configurations.
The run config files are the primary place to tweak anything in the code. The syntax is defined by the config dataclasses at src/crosscoders/dataclasses/configs/.
Currently, there are two base config objects that contain all others: GlobalsConfig and RunnerConfig. Your cfg.yml should have only two root dictionaries: GLOBALS and RUNNER.
For the most part, the field names in the cfg.yml are uppercase versions of the config dataclass names minus Config.
See
src/crosscoders/dataclasses/configs/.
This package is intended to be used as a CLI called xc, although it can be used programmatically as well.
There is only one required argument, mode, which specifies which sub-script to run.
See
src/scripts/main.py.
# export CONFIG_FILEPATH="${PROJECT_ROOT_DIR}/src/scripts/configs/data.yml
xc data# export CONFIG_FILEPATH="${PROJECT_ROOT_DIR}/src/scripts/configs/train.yml
xc train