Conversation
…-MoLFormer, MolGen, and Molexar support.
… SAFE-GPT due to the transformers incompatibility.
|
We added more README / install details: Hub links for the supported generators, extra-package notes and importantly we also changed from GP-MoLFormer to SAFE-GPT. Two problems exist in GP-MoLFormer: So we replaced that scaffold / de novo causal-LM slot with SAFE-GPT(https://huggingface.co/datamol-io/safe-gpt). It is a normal GPT-2 model, so it can use standard Hugging Face generate() on transformers 5.x and sit next to NovoMolGen / MolGen / Molexar. scaffold= can be a full SMILES like "c1ccccc1"; we convert it to SAFE internally. Extra dep is just pip install safe-mol. |
|
We added train test split on the dataset. Total 4 methods: -random: baseline. Use as a control; scores are often a bit high. Thanks! |
…el} generator tests
|
We fixed causal LM scaffold generation and cleaned up the pretrained generator tests: -max_new_tokens: NovoMolGen / SAFE-GPT used Hugging Face max_length as a total sequence cap (prefix + new tokens). A long SAFE/SMILES scaffold ate that budget (53-token prefix → only 11 new tokens). They now default to max_new_tokens=generate_max_length (64 new tokens, prefix does not count). max_length= is still an explicit total-length override. MolGen decoder max_length and Molexar max_new_tokens are unchanged. Please let me know if there is any issues! |
This PR adds HFPretrainedMolecularGenerator: a sklearn-style fit / generate wrapper for Hugging Face pretrained molecular generators, in the same spirit as HFPretrainedMolecularEncoder. The existing generators (LSTM, MolGPT, DiGress, and the rest) are left as they are.
"API": We know some of these Hub models don’t actually speak SMILES internally, MolGen works in SELFIES, Molexar works in Fragment-SELFIES. So, we convert SMILES → SELFIES (or Fragment-SELFIES) on the way in, and convert back to SMILES on the way out.
"Supported models": NovoMolGen and GP-MoLFormer (causal LM / SMILES), MolGen-large and MolGen-large-opt (seq2seq SELFIES), Molexar-10M-base and Molexar-10M-omni (Fragment-SELFIES via the official engine). Extra deps stay in README Additional Packages, not in pyproject.toml. GP-MoLFormer needs transformers<=4.56.2; Molexar needs transformers>=5.8, in which they cannot share an environment.
"Handled": Invalid training SMILES raise with an index (no silent skip). Failed MolGen/Molexar decodes are dropped instead of padded with "", with a got k/n valid SMILES warning. MolGen fine-tuning is denoising, not identity copy. GP-MoLFormer generation is patched for transformers 4.56 cache issues, scaffold= must be an open prefix like "c1cccc", not a closed ring.