Train a transformer to produce Hadamard matrices. Install core dependency with:
pip install -r requirements.txt
Install one logging backend:
pip install -r requirements-wandb.txt
or
pip install -r requirements-tensorboard.txt
check.py has additional dependencies:
pip install -r requirements-check.txt
For wandb logging, you can override defaults with:
export WANDB_ENTITY=your_entity
export WANDB_PROJECT=your_project
Modify the parameters in params.py (size of matrix, transformer parameters, etc) then run:
python hadamard.py
Data are saved in subdirectories of training/; runs can be resumed with the parameter resume in params.py.
A symlink latest/ is created to point to the latest data.
Hadamard matrices for each run are saved in hada.txt.
Use check.py to check that they are indeed hadamard matrices, e.g.,
python check.py latest/hada.txt
Logging is in two forms:
- there is wandb or tensorboard logging, which summarises three types of information:
- Loss in the training process.
- Mean scores of each generation.
- Proportion of Hadamard matrices in each generation.
- There is a
stats.txtthat contains complementary information, including tallies of the generations at which matrices have been produced. Each generation has two entries:- sample which is the sample generated by the transformer (or at the start, a random sample).
- selected which is a subset of the data after improvement and top score selection.
There is also a standalone program exactgs.py to perform exact enumeration of GS type Hadamard matrices for small n, e.g., for n=64:
python exactgs.py 64