Text Generation
PEFT
Safetensors
Chinese
English
chemistry
smiles
lora
conditional-generation
chemdfm
Instructions to use Liangyingping/ChemLLM-0812-lyp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Liangyingping/ChemLLM-0812-lyp with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
ChemLLM-0812-lyp:条件化胺分子 SMILES 生成
私有仓库。给定 Size / Polarity / Complexity 条件,生成胺分子 SMILES。
**最新推荐权重见目录 0906/**(8B SFT+RL + 14B SFT)。
一、仓库结构
0906/ # ★ 当前主推版本包
chemdfm_sft_lora/ # ChemDFM-v1.5-8B LoRA-SFT
chemdfm_rl_lora/ # 8B SFT + GRPO 风格 RL
chemdfm14b_sft_lora/ # ChemDFM-v2.0-14B QLoRA-SFT
CUSTOM_PROMPT.md # 自定义 prompt 详解
DATA_AND_PROMPT.md # 0827 数据与训练 prompt 设计
CHEMDFM14B.md # 14B 简要说明
infer.py / run_infer.sh
examples/custom_prompts/ # 可直接改的示例
README.md
chemdfm_sft_lora/ # 早期 8B 上传(可忽略,请用 0906/)
chemdfm_rl_lora/
qwen3b_sft_lora/
examples/ # 早期验证集拆分等
infer.py / eval_smiles.py # 早期脚本
适配器(在 0906/ 下) |
底座 | 说明 |
|---|---|---|
chemdfm_sft_lora |
OpenDFM/ChemDFM-v1.5-8B | 0827 数据 LoRA-SFT |
chemdfm_rl_lora |
同上 | SFT 后再 RL(合法性 + 条件匹配) |
chemdfm14b_sft_lora |
OpenDFM/ChemDFM-v2.0-14B | QLoRA 4bit SFT;24GB 推理自动 4bit |
本仓只含 LoRA,不含底座全量权重。
二、访问私有仓库
pip install -U "huggingface_hub[cli]"
huggingface-cli login # 粘贴所有者发给你的 token(勿把 token 写进仓库文件)
huggingface-cli download Liangyingping/ChemLLM-0812-lyp \
--include "0906/**" \
--local-dir ChemLLM-0812-lyp \
--local-dir-use-symlinks False
cd ChemLLM-0812-lyp/0906
也可用环境变量:export HF_TOKEN=你的TOKEN。
三、权重说明(0906)
数据
- 来源:
data/0827,约 451 个胺分子(去掉不合格结构) - 规范 SMILES + 多标签结构类(卤化 / 脂肪 / 芳香 / 高极性 N/O)
- 导出 SFT:train ≈3248(×8 条件增强),val = 45
8B
- 底座 ChemDFM-v1.5-8B,LoRA r=16
chemdfm_rl_lora:在 SFT 上继续 RL(默认 kl=0)
14B
- 底座 ChemDFM-v2.0-14B,QLoRA 4bit,2 epoch
- train_loss≈0.37,eval_loss≈0.83
- 14B RL 尚未上传;有结果后会放到
0906/chemdfm14b_rl_lora/
四、Prompt 构建说明
训练与推理共用同一模板。每条样本包含三类条件(至少各 1 条),可选结构类别。
模板
Generate one amine molecule as a SMILES string that matches the following conditions. Each property line may include a short explanation in parentheses.
- structural class: <英文多标签,可选>
[Size]
- molecular weight (total molecular mass in g/mol): 100-140
- heavy atom count (number of non-hydrogen atoms): 9
[Polarity]
- logP (...): -1.00 to 1.00
- TPSA (...): 20.0-40.0
- N atoms (...): 2
[Complexity / synthetic difficulty]
- primary amines (...): 1
- synthetic accessibility score (...): 4.0-7.0
SMILES:
结构类别(可叠加)
| 中文 | Prompt 英文 |
|---|---|
| 卤化胺 | Halogenated amines |
| 脂肪族胺 | Aliphatic amines |
| 芳香胺 | Aromatic amines |
| 高极性 N/O 富集 | Highly polar N/O-rich amines |
例:- structural class: Halogenated amines; Aliphatic amines
可用字段
- Size:
molecular weight(区间 ±20)、heavy atom count - Polarity:
logP(±0.5)、TPSA(±10)、H-bond donors/acceptors、N/O/S/F/Cl/Br atoms - Complexity:
ring count、一/二/三级胺、芳香/脂肪胺、rotatable bonds、synthetic accessibility score(1 易–10 难)
不要写:atom count、bond count、aromatic rings、protonatable amines。
更细的自定义说明与示例见:0906/CUSTOM_PROMPT.md、0906/DATA_AND_PROMPT.md、0906/examples/custom_prompts/。
五、使用说明(推理)
cd ChemLLM-0812-lyp/0906
pip install torch transformers peft accelerate safetensors bitsandbytes
# 8B RL(推荐)
CUDA_VISIBLE_DEVICES=0 bash run_infer.sh examples/custom_prompts/class_v_polar.txt
# 8B SFT
ADAPTER=chemdfm_sft_lora CUDA_VISIBLE_DEVICES=0 \
bash run_infer.sh examples/custom_prompts/halogenated_small.txt
# 14B SFT(自动 4bit)
ADAPTER=chemdfm14b_sft_lora CUDA_VISIBLE_DEVICES=0 \
bash run_infer.sh examples/custom_prompts/class_v_polar.txt
或:
python infer.py --adapter chemdfm_rl_lora \
--prompt-file examples/custom_prompts/class_v_polar.txt --temperature 0
命令行拼条件:
python infer.py --adapter chemdfm_rl_lora \
--condition "Class V" \
--extra "- molecular weight: 100-150\n- logP: -1.0 to 1.0\n- N atoms: 2"
需能加载对应底座(本地 HF cache 或联网下载)。
六、注意
- 目标是 合法 SMILES + 满足条件,不是精确复现某一条金标分子
- Access Token 仅授权用户使用,勿公开传播
- 请同时遵守 ChemDFM / Qwen 底座许可
问题联系仓库所有者。
- Downloads last month
- -
Model tree for Liangyingping/ChemLLM-0812-lyp
Base model
OpenDFM/ChemDFM-v1.5-8B