This repository implements a library for running LAPS (language / abstraction and program search) experiments.
The codebase is implemented in both Python and OCaml. The repository contains prebuilt OCaml binaries that have been tested on OS X. However,
We also provide scripts for installing and running this repository on two MIT-specific computing clusters, which do not allow directly installing software and run on Linux architectures.
These are instructions for setting up on the OpenMind computing cluster managed by the MIT BCS department.
- Git clone this repository into a local directory on OpenMind. This is likely at
om2/user/<USERNAME>after logging in viassh <USERNAME>@openmind7.mit.edu - Run
setup_om.shfrom the top-level repository. In particular, this should copy over a Singularity container with the necessary dependencies and also rebuild a Linux-specific version of the dependencies locally. - You can now run experiments via standard SLURM commands, using the Singularity container to execute the Python/OCaml.
- If you are running
evaluate_compression_model_scoring.py, running your desired command with--util_generate_cloud_command omwill automatically generate command-line parameters to run on OpenMind. - If you are running experiments from
evaluate_compression_model_scoring.py, you can reference previous reported results here.
These are instructions for setting up on the Supercloud computing cluster managed by Lincoln Labs.
- Git clone this repository into a local directory on Supercloud. This is likely in a home directory after logging in via
USERNAME@txe1-login.mit.edu. - Run
setup_supercloud.shfrom the top-level repository. In particular, this should switch you to using a Linux-specific build of the OCaml binaries (which we build on OM) and pip install thelaps_requirements.txtlocally. - You can now run experiments via standard SLURM commands like these. Note that if running interactively or writing your own batch commands, you should call
module load anaconda/2020bto access the appropriate Python installation.- If you are running
evaluate_compression_model_scoring.py, running your desired command with--util_generate_cloud_command supercloudwill automatically generate command-line parameters to run on Supercloud.
- If you are running
- If you are running experiments from
evaluate_compression_model_scoring.py, you can reference previous reported results here.
Experiments are run and managed through Config files. Example config files can be found in experiments/configs.
The Python entrypoint to these is run_experiment.py. Example usage: python run_experiment.py --config_dir experiments/configs --config_file dreamcoder_compositional_graphics_200_human.json.
We implement a rewritten API over the original DreamCoder compressor for ease of use and adaptation into new library learning and library ranking functions. If you are just looking to work with this API, you may find it more useful to examine the following:
- The Python entrypoint to run compressor-specific tests is
evaluate_compression_model_scoring.py. Example usage:python evaluate_compression_model_scoring.py -k test_discrimination_original_final_libraries_full --db_no_model_trainingwill run a test that benchmarks compressor performance on increasingly large numbers of programs in a training set. - We implement a Python wrapper over the compressor that makes API calls in
laps_grammar.py. See:_send_receive_compressor_api_callfor an example of the calling syntax, and_get_compressed_grammmar_and_rewritten_frontiersfor a wrapper function that gets a compressed grammar and rewritten frontiers for a set of train and test programs. - Finally, the OCaml implementation itself is in
ocaml/solvers/compression_rescoring_api.mlandocaml/solvers/compression_rescoring_api_utils.ml. The former specifies all of the API functions; the latter implements them.