$npx -y skills add jinzhezenggroup/computational-chemistry-agent-skills --skill unimolA standardized CLI wrapper for Uni-Mol molecular ML workflows that handles representation extraction (embeddings), model training (regression/classification), and property prediction with built-in RDKit SMILES validation. USE WHEN you need to generate molecular embeddings, train
| 1 | # Uni-Mol |
| 2 | |
| 3 | This skill provides practical command patterns for **Uni-Mol molecular representation / training / prediction** using the standardized CLI wrapper: `<skill_path>/scripts/unimol_helper.py`. |
| 4 | |
| 5 | Key behaviors (important for Agents): |
| 6 | |
| 7 | - The script prints **environment detection** (Python/Torch/CUDA) by default. |
| 8 | - Bad/illegal SMILES are **skipped and logged** to `*.skipped.csv` (no crash). |
| 9 | - Each run ends by printing **absolute output paths** like: |
| 10 | - `[RESULT] repr_npy=/abs/path.npy` |
| 11 | - `[RESULT] model_dir=/abs/model_dir` |
| 12 | - `[RESULT] pred_csv=/abs/pred.csv` |
| 13 | |
| 14 | ## Quick Start |
| 15 | |
| 16 | Check CLI help: |
| 17 | |
| 18 | ```bash |
| 19 | uv run python <skill_path>/scripts/unimol_helper.py --help |
| 20 | ``` |
| 21 | |
| 22 | Check subcommand help: |
| 23 | |
| 24 | ```bash |
| 25 | uv run python <skill_path>/scripts/unimol_helper.py repr --help |
| 26 | uv run python <skill_path>/scripts/unimol_helper.py train --help |
| 27 | uv run python <skill_path>/scripts/unimol_helper.py predict --help |
| 28 | ``` |
| 29 | |
| 30 | Disable environment printing (optional): |
| 31 | |
| 32 | ```bash |
| 33 | uv run python <skill_path>/scripts/unimol_helper.py --no-env repr --smiles "CCO" --output out.npy |
| 34 | ``` |
| 35 | |
| 36 | ## Core Tasks |
| 37 | |
| 38 | ### 1) Extract molecular representations (embedding) to .npy |
| 39 | |
| 40 | Single SMILES: |
| 41 | |
| 42 | ```bash |
| 43 | uv run python <skill_path>/scripts/unimol_helper.py repr \ |
| 44 | --smiles "CCO" \ |
| 45 | --output /tmp/ccO.repr.npy |
| 46 | ``` |
| 47 | |
| 48 | From CSV (default SMILES column is `smiles`): |
| 49 | |
| 50 | ```bash |
| 51 | uv run python <skill_path>/scripts/unimol_helper.py repr \ |
| 52 | --file data.csv \ |
| 53 | --smiles-col smiles \ |
| 54 | --output data.repr.npy |
| 55 | ``` |
| 56 | |
| 57 | From SMI: |
| 58 | |
| 59 | ```bash |
| 60 | uv run python <skill_path>/scripts/unimol_helper.py repr \ |
| 61 | --file molecules.smi \ |
| 62 | --output molecules.repr.npy |
| 63 | ``` |
| 64 | |
| 65 | Force CPU / GPU: |
| 66 | |
| 67 | ```bash |
| 68 | # Force CPU |
| 69 | uv run python <skill_path>/scripts/unimol_helper.py repr --smiles "CCO" --no-gpu --output out.npy |
| 70 | |
| 71 | # Force GPU (will warn & fall back if CUDA is unavailable) |
| 72 | uv run python <skill_path>/scripts/unimol_helper.py repr --smiles "CCO" --use-gpu --output out.npy |
| 73 | ``` |
| 74 | |
| 75 | ### 2) Train a property model (classification / regression / multilabel\_\*) |
| 76 | |
| 77 | Regression training (CSV must contain `smiles` and `target` columns): |
| 78 | |
| 79 | ```bash |
| 80 | uv run python <skill_path>/scripts/unimol_helper.py train \ |
| 81 | --task regression \ |
| 82 | --input train.csv \ |
| 83 | --smiles-col smiles \ |
| 84 | --target-col target \ |
| 85 | --epochs 50 \ |
| 86 | --output ./model_reg |
| 87 | ``` |
| 88 | |
| 89 | Classification training: |
| 90 | |
| 91 | ```bash |
| 92 | uv run python <skill_path>/scripts/unimol_helper.py train \ |
| 93 | --task classification \ |
| 94 | --input train.csv \ |
| 95 | --smiles-col smiles \ |
| 96 | --target-col target \ |
| 97 | --epochs 50 \ |
| 98 | --output ./model_cls |
| 99 | ``` |
| 100 | |
| 101 | Multilabel regression training (explicit multi-target columns): |
| 102 | |
| 103 | ```bash |
| 104 | uv run python <skill_path>/scripts/unimol_helper.py train \ |
| 105 | --task multilabel_regression \ |
| 106 | --input train.csv \ |
| 107 | --smiles-col smiles \ |
| 108 | --target-cols target_0,target_1,target_2 \ |
| 109 | --epochs 50 \ |
| 110 | --output ./model_mreg |
| 111 | ``` |
| 112 | |
| 113 | Multilabel classification training: |
| 114 | |
| 115 | ```bash |
| 116 | uv run python <skill_path>/scripts/unimol_helper.py train \ |
| 117 | --task multilabel_classification \ |
| 118 | --input train.csv \ |
| 119 | --smiles-col smiles \ |
| 120 | --target-cols y_cls_0,y_cls_1,y_cls_2 \ |
| 121 | --epochs 50 \ |
| 122 | --output ./model_mcls |
| 123 | ``` |
| 124 | |
| 125 | Target recognition for training: |
| 126 | |
| 127 | - Single-task (`classification` / `regression`): use `--target-col` (default `target`). |
| 128 | - Multilabel tasks: prefer `--target-cols` (comma-separated). |
| 129 | - If `--target-cols` is omitted for multilabel tasks, the helper auto-detects columns named `target` or prefixed with `target_` (case-insensitive). |
| 130 | |
| 131 | Force CPU: |
| 132 | |
| 133 | ```bash |
| 134 | uv run python <skill_path>/scripts/unimol_helper.py train \ |
| 135 | --task regression \ |
| 136 | --input train.csv \ |
| 137 | --epochs 50 \ |
| 138 | --output ./model_cpu \ |
| 139 | --no-cuda |
| 140 | ``` |
| 141 | |
| 142 | ### 3) Predict properties to .csv |
| 143 | |
| 144 | Predict from CSV: |
| 145 | |
| 146 | ```bash |
| 147 | uv run python <skill_path>/scripts/unimol_helper.py predict \ |
| 148 | --model ./model_reg \ |
| 149 | --input test.csv \ |
| 150 | --smiles-col smiles \ |
| 151 | --output pred.csv |
| 152 | ``` |
| 153 | |
| 154 | Predict from SMI: |
| 155 | |
| 156 | ```bash |
| 157 | uv run python <skill_path>/scripts/unimol_helper.py predict \ |
| 158 | --model ./model_reg \ |
| 159 | --input test.smi \ |
| 160 | --output pred.csv |
| 161 | ``` |
| 162 | |
| 163 | Notes: |
| 164 | |
| 165 | - Output CSV contains the input rows (for valid SMILES) plus `pred` / `pred_*` columns. |
| 166 | - If there are bad SMILES, they are skipped and saved to `pred.csv.skipped.csv` (or your `--error-log` path). |
| 167 | |
| 168 | ## Agent Checklist |
| 169 | |
| 170 | When usi |