To create a model that can correct invalid outputs, transformer models were constructed using PyTorch . The transformer model used in this research is adapted from Ben Trevett's Pytorch Seq2Seq model . For this model, the input and output sequences were tokenized using TorchText tokenizers and the output sequence was reversed. The SMILES tokenizer was based on the one described by Olivecrona et al. and most tokens consisted of single characters, except for tokens denoting atoms with two-letter atom symbols, atom descriptions between brackets, and numbers following the % sign (Supporting information Table ). . In addition to these tokens, start, stop and padding tokens were used, resulting in vocabulary sizes of between 101 and 110 tokens.