Chen Yulin's BlogChen Yulin's Blog
HomeArchivesCategoriesTagsAbout
  目录
ChemGPT
Posted 2025-11-27Updated 2026-03-08Review3 minutes read (About 511 words)   visits

ChemGPT

Base Model

ChemGPT 早期基座模型基于 EleutherAI 的语言模型 GPT‑Neo,在分子字符串语料(SMILES 或 SELFIES)上进行自回归建模。
典型预训练数据集为公开的大规模分子库 PubChem10M,参数规模覆盖百万到十亿级别(如约 4.7M 的轻量版本或 100M+ 的科研版本)。
属于领域特化的 decoder-only 化学语言模型。

Training Method

  • 对分子进行编码:对 SMILES/SELFIES/反应式进行 tokenization,构建化学“语言”词表(原子、键、环、分支、立体标记等均被离散化为 token)
  • 预训练目标:自回归分子语言建模(Next-token prediction),最大化生成合法分子序列的对数似然。

调用方式

网页直接使用

https://www.chemgpt.app/
(我没有注册账号,直接问会显示网络繁忙)

### Huggingface 下载模型并调用 当前 HF Hub 上最常被引用的 ChemGPT 版本包括: - 轻量模型:ChemGPT 4.7M (https://huggingface.co/ncfrey/ChemGPT-4.7M) - 中型模型:ChemGPT 1.2B (https://huggingface.co/ncfrey/ChemGPT-1.2B)

模型推理(文本生成 Pipeline)

text-generation pipeline 适合生成式任务(包括化学问答、分子生成)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import pipeline

chem_pipe = pipeline(
"text-generation",
model="ncfrey/ChemGPT-1.2B", # 或 ncfrey/ChemGPT-4.7M
device_map="auto"
)

prompt = "CCO>>" # 以乙醇为前缀生成分子衍生结构或产物候选
result = chem_pipe(
prompt,
max_new_tokens=128,
temperature=0.7,
do_sample=True
)

print(result[0]["generated_text"])

模型推理(直接使用 model.generate)

当需要精细控制 token 级生成时,直接调用 generate API。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_name = "ncfrey/ChemGPT-1.2B" # 或 Chemistry 结构生成模型 ncfrey/ChemGPT-4.7M
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
model.eval()
model.to("cuda" if torch.cuda.is_available() else "cpu")

prompt = "CCO>>"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.6,
top_p=0.95
)

generated = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(generated)

ChemGPT

http://chen-yulin.github.io/2025/11/27/[OBS]Chemistry-ChemGPT/

Author

Chen Yulin

Posted on

2025-11-27

Updated on

2026-03-08

Licensed under

#Research-paperChemistryLLM
VQ-VAE and Latent Action for Robotics
DREAM TO CONTROL= LEARNING BEHAVIORS BY LATENT IMAGINATION

Comments

Chen Yulin

Chen Yulin

SJTU student

Manchester by the Sea

Posts

131

Categories

6

Tags

105

Follow

Catalogue

  • Base Model
  • Training Method
  • 调用方式
    • 网页直接使用
      • 模型推理(文本生成 Pipeline)
      • 模型推理(直接使用 model.generate)

Archives

  • February 20268
  • November 20253
  • July 20252
  • May 20252
  • April 20259
  • March 202540
  • February 20259
  • January 202512
  • December 20246
  • November 20242
  • October 20244
  • September 20246
  • August 20241
  • July 20241
  • June 20241
  • May 20241
  • April 20244
  • March 20241
  • January 20241
  • December 20231
  • May 20231
  • August 20221
  • May 20226
  • April 20229

Recents

exist_label

2026-02-14

exist_label

Note

BAGEL-Unified-Multimodal-Pretraining

2026-02-06

BAGEL-Unified-Multimodal-Pretraining

Review

LingBot-VLA

2026-02-05

LingBot-VLA

Review

Mixture-of-Experts-Survey

2026-02-05

Mixture-of-Experts-Survey

Review

UniDiffuser

2026-02-03

UniDiffuser

Review

Tags

3D-Scene17
Atlas1
CADC1
CLIP11
CNN1
CV56
Chemistry1
Contrastive-Learning5
Csharp1
DINO3
DT1
Debate2
Diffusion2
DiffusionModel4
Discrete-Mathematics1
Embodied-AI18
Emoation1
Emotion9
FL1
FPN2
Foundation1
FoundationModel4
Functional programming1
Game1
Gated-NN3
Github1
HRI2
Haskell1
Hexo4
Hierarchical4
Html1
HumanoidRobot1
Image-Grounding2
Image-Text4
Image-generation2
Image2Text7
ImgGen3
ImitationLearning5
LLM15
LatentAction1
Latex1
Love2
ML8
MR/AR3
Message-Passing2
MoE2
Mod1
Multi-modal14
Multi-view1
MultiModal5
NLP6
NN7
Nodejs1
Object-Detection9
Open-Vocabulary11
OpenCV1
Panoptic1
Physical-Scene4
Plugin1
PoseEstimation3
Probability1
Promise1
Python1
Pytorch1
QML1
Quantum1
RL3
RNN3
ROS3
Reading3
Real2Sim2
Reconstruct13
Representation-Learning5
Research-paper97
RobotLearning13
Robotics29
SJTU-Lecture1
Scalability2
Scene-graph31
Scene-synthesis2
Segmentation7
Semantic14
Signals and Systems1
Sim2Real1
Snippets1
Subgraph1
Survey4
Task-Planning9
Tech Communication1
Transformer20
Translation-Embedding2
Travel1
Unified-Multimodal1
Unity1
VAE1
VLA2
VLM8
VLP5
VQ-VAE1
ViT5
Vim1
Visual-Relation23
WSL1
Web1
WorldModel2
Chen Yulin's BlogChen Yulin's Blog

© 2026 Chen Yulin  Powered by Hexo & Icarus

×