The files train/train_ape.py, train/train_spe.py, and train/train_trie.py contain the code for building the Atom-Pair Encoding, SMILES-Pair Encoding, and Trie-based encoding compressors, respectively. We use the PubChem parquet data files in the data/ folder.
To run, first install the necessary requirements:
pip install -r requirements.txtThen, run the training files (train_*.py) in train/ for the desired compressors and run experiments/bench_lengths.py to compare the compressed vocabularies generated by the SPE, APE, Trie, and Trie+TTG algorithms.
The results will be visible in both the standard output of bench_lengths.py and the visualisations folder, which contains JSON formatted data for the histograms and the histograms themselves for each of the compression algorithms. Other outputs are stored in data/, such as run time.
Various experiments were conducted during the review of this paper to test different properties about the generated encodings for each of the three tokenizers.
The relevant code can be found in files labeled experiments/test_e#.py, replacing # with the experiment number.
Remaining Python files are a mix of utilities (see e.g. utils.py), implementations of the underlying compressor algorithms (see e.g. ape_tokenizer.py, and trie_funcs.py).
Most output is directed into one of the top-level directories in this repository, usually data/ or visualisations/.