Instructions to use Delower/molmistral-dpp4-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Delower/molmistral-dpp4-finetuned with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://Delower/molmistral-dpp4-finetuned") - Notebooks
- Google Colab
- Kaggle
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
MolMistral β DPP-4 Fine-Tuned
DPP-4-specific fine-tune of the MolMistral SMILES foundation model (12 layers, hidden 512, 21.8M parameters, vocab 621, max_len 128). Causal language model over SMILES with conditional generation via 7 property control tokens.
Provenance
- Base model:
Delower/molmistral-foundation-v61β the verified foundation trained by SPARCq job 822 (Cheaha, A100 80GB) on 5,441,246 decontaminated SMILES (ChEMBL / MOSES / BindingDB / PubChem / ZINC). Base weights sha2562076717dee20df2bf9e04985a0fbaef9aa93801b242ba6e6d1ffdb85b938e802, verified in-notebook before training. - Fine-tune run: Kaggle notebook
delower2021/molmistral-finetune-potent, Version 1, GPU T4 x2, 2026-11-17. Training code:train_llm_foundation.py(shipped in this bundle; the fine-tune stage only β the foundation was trained unconditionally).
Fine-tuning data
- DPP-4 POTENT ONLY β 5,747 compounds (pIC50 β₯ 7.0), split 5,173 train / 574 validation.
- No moderate compounds. No FDA/regulatory gliptins (the 12 are excluded from this fine-tune by design).
- Conditional training: each sequence is
[BOS] [7 property tokens] SMILES [EOS]β[POTENT]plus MW / LOGP / HBD / HBA / TPSA / ROT bins computed per molecule β with condition dropout 0.15, so the model also works unconditionally. - Batch 128, max_len 128, LR 5e-5, epoch ceiling 120, patience 25, target val_loss 0.20 (early stop on target).
Training result
Stopped at epoch 3 when the validation loss reached the 0.20 target:
| epoch | train loss | val loss |
|---|---|---|
| 1 | 0.3428 | 0.2412 |
| 2 | 0.2090 | 0.2016 |
| 3 | 0.1841 | 0.1973 (best) |
Best val_loss 0.1973167 (perplexity 1.218) at epoch 3.
best_finetune_dpp4.keras is the best-val checkpoint.
Full history: history_finetune.csv; machine-readable cards:
model_card_finetune.json, finetune_metrics_summary.json.
β οΈ Two-weights rule β read before using
These weights are DPP-4-specific. Never use them as the base
for fine-tuning on another disease or target. For any other
disease, start from the disease-free foundation:
Delower/molmistral-foundation-v61. The companion scripts enforce
this β infer_finetuned.py and generate_finetuned.py refuse any
bundle that does not verify as the fine-tuned one.
Usage
Inference / scoring check (verifies the fine-tuned role, tokenizer round-trip, and teacher-forced loss/perplexity on built-in drug SMILES):
python infer_finetuned.py --bundle .
python infer_finetuned.py --bundle . --csv my_smiles.csv --out scores.csv
Conditional generation (default: 500 molecules at each of T = 0.8, 1.0, 1.1; raw, unfiltered SMILES β RDKit validation is a separate downstream stage):
python generate_finetuned.py --bundle . --out dpp4_generated_raw.csv
python generate_finetuned.py --bundle . --no_condition --n_per_arm 100
Default condition (the fine-tune set's modal property profile):
POTENT,MW_400_450,LOGP_2_3,HBD_1,HBA_5_6,TPSA_60_90,ROT_4_6
Files
| file | contents |
|---|---|
best_finetune_dpp4.keras |
fine-tuned weights (Keras 3, whole model) |
vocab.txt, tokenizer_config.json |
621-token SMILES vocabulary |
model_card_finetune.json |
trainer's model card |
finetune_metrics_summary.json |
run configuration + result summary |
history_finetune.csv |
per-epoch train/val loss |
gate_scan_finetuned.json |
non-finite tensor scan of the weights (0 NaN/Inf) |
inference_check.txt |
output of the post-assembly inference check |
infer_finetuned.py |
scoring / inference check script |
generate_finetuned.py |
conditional generation script |
train_llm_foundation.py |
training/tokenizer code the scripts import |
- Downloads last month
- 12