genmol-nim
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenMol NIM
GenMol NIM
Generate drug-like molecules with GenMol. Use this for first-pass
hosted/local usage; load supplemental files only when needed:
SKILL.md- : endpoints, schema, Docker flags, response fields.
references/api.md - : use cases, strengths, limits, and handoffs.
references/science.md - : SAFE patterns and tuning effects.
references/parameters.md - : chemical and artifact checks.
references/validation.md - : compact request patterns.
references/examples.md
使用GenMol生成类药分子。请使用此进行首次托管/本地使用;仅在需要时加载补充文件:
SKILL.md- :端点、模式、Docker参数、响应字段。
references/api.md - :用例、优势、局限性及交接说明。
references/science.md - :SAFE模式及调优效果。
references/parameters.md - :化学有效性及人工产物检查。
references/validation.md - :简洁请求模式。
references/examples.md
Choose Mode
选择模式
Ask only when context is unclear:
Hosted NVIDIA API or local Docker NIM?
- Hosted:
https://health.api.nvidia.com/v1/biology/nvidia/genmol/generate - Local:
http://localhost:8000/generate
Hosted requests use . Supported local Docker
startup uses (or via the preflight) for
registry login, entitlement checks, and first-run model downloads; pass it
into the container with . Local inference requests use no
auth header after readiness. Warm-cache key-free startup varies by
image/version and should not be assumed.
Authorization: Bearer $NGC_API_KEYNGC_API_KEYNVIDIA_API_KEY-e NGC_API_KEY仅在上下文不明确时询问:
使用托管式NVIDIA API还是本地Docker NIM?
- 托管式:
https://health.api.nvidia.com/v1/biology/nvidia/genmol/generate - 本地:
http://localhost:8000/generate
托管式请求需使用。本地Docker启动需使用(或通过预检请求使用)进行注册表登录、权限验证及首次运行模型下载;需通过将其传入容器。本地推理请求在就绪后无需认证头。无缓存密钥的预热启动因镜像/版本而异,请勿默认假设其可用。
Authorization: Bearer $NGC_API_KEYNGC_API_KEYNVIDIA_API_KEY-e NGC_API_KEYLocal Docker
本地Docker部署
Use shell env first; source repo-root only if present. Do not print keys.
For local setup answers, include this sequence: env preflight, ,
, readiness loop, then a no-auth localhost request. Do not invent a
cache default or drop the fallback.
.envdocker logindocker runNVIDIA_API_KEYFor the exact startup preflight ( sourcing, fallback,
, both flags, , and the
for ), copy the command block in
under Docker run reference verbatim.
.envNVIDIA_API_KEY--shm-size=2G--ulimitdocker logindocker runnvcr.io/nim/nvidia/genmol:1.0.1references/api.mdGenMol is single-GPU; defaults to . Wait for readiness:
NIM_TEST_GPU0bash
until curl -sf http://localhost:8000/v1/health/ready; do sleep 5; done优先使用Shell环境变量;仅当存在仓库根目录的文件时才加载它。请勿打印密钥。对于本地设置相关问题,请包含以下步骤:环境预检、、、就绪循环,然后发起无认证的本地主机请求。请勿自行设置缓存默认值,也不要省略备选方案。
.envdocker logindocker runNVIDIA_API_KEY如需获取确切的启动预检流程(包括文件加载、备选、、两个参数、以及针对的命令),请直接复制中Docker run reference下的命令块内容。
.envNVIDIA_API_KEY--shm-size=2G--ulimitdocker loginnvcr.io/nim/nvidia/genmol:1.0.1docker runreferences/api.mdGenMol为单GPU运行;默认值为。等待服务就绪:
NIM_TEST_GPU0bash
until curl -sf http://localhost:8000/v1/health/ready; do sleep 5; doneSAFE Input
SAFE输入
The API field is named , but GenMol expects SAFE notation. Masked
positions use .
smiles[*{min-max}]- De novo:
safe_input = "[*{20-30}]" - Scaffold decoration:
safe_input = scaffold_to_safe("C1CC(=O)NC1", 10, 15) - Motif extension:
safe_input = f"[*{{5-10}}].{motif_safe}.[*{{5-10}}]" - Lead optimization: encode the hit, then replace a fragment with
.[*{5-12}]
Use for conditioned generation. Simple ring scaffolds may raise
; fall back to the original SMILES plus a SAFE mask.
safe-molSAFEFragmentationErrorSee the helper in
under Scaffold Decoration.
scaffold_to_safereferences/examples.mdWider masks increase diversity; tight masks keep analog size more predictable.
API字段名为,但GenMol期望接收SAFE符号。掩码位置使用格式。
smiles[*{min-max}]- 从头生成:
safe_input = "[*{20-30}]" - 骨架修饰:
safe_input = scaffold_to_safe("C1CC(=O)NC1", 10, 15) - 基序延伸:
safe_input = f"[*{{5-10}}].{motif_safe}.[*{{5-10}}]" - 先导化合物优化:编码命中分子,然后将某个片段替换为
.[*{5-12}]
使用进行条件生成。简单环骨架可能会触发;此时可退回到原始SMILES加SAFE掩码的方式。
safe-molSAFEFragmentationError请查看中Scaffold Decoration下的辅助函数。
references/examples.mdscaffold_to_safe掩码范围越宽,多样性越高;掩码范围越窄,类似物大小越可预测。
Request Pattern
请求模式
python
import os
import requests
HOSTED = True
url = (
"https://health.api.nvidia.com/v1/biology/nvidia/genmol/generate"
if HOSTED else "http://localhost:8000/generate"
)
headers = {"Content-Type": "application/json"}
if HOSTED:
headers["Authorization"] = f"Bearer {os.getenv('NGC_API_KEY')}"
payload = {
"smiles": "[*{20-30}]", # SAFE notation
"num_molecules": 30,
"temperature": "1.0", # string, not float
"noise": "1.0", # string, not float
"step_size": 1,
"scoring": "QED", # or "LogP"
"unique": False,
}
response = requests.post(url, headers=headers, json=payload, timeout=180)
response.raise_for_status()
result = response.json()Gotchas:
- and
temperatureare strings.noise - is 1-1000; invalid/duplicate molecules may be filtered, so request extra when the user needs a minimum count.
num_molecules - is
scoringfor drug-likeness or"QED"for lipophilicity."LogP" - Set for deduplicated analog lists.
unique=True
python
import os
import requests
HOSTED = True
url = (
"https://health.api.nvidia.com/v1/biology/nvidia/genmol/generate"
if HOSTED else "http://localhost:8000/generate"
)
headers = {"Content-Type": "application/json"}
if HOSTED:
headers["Authorization"] = f"Bearer {os.getenv('NGC_API_KEY')}"
payload = {
"smiles": "[*{20-30}]", # SAFE notation
"num_molecules": 30,
"temperature": "1.0", # string, not float
"noise": "1.0", # string, not float
"step_size": 1,
"scoring": "QED", # or "LogP"
"unique": False,
}
response = requests.post(url, headers=headers, json=payload, timeout=180)
response.raise_for_status()
result = response.json()注意事项:
- 和
temperature为字符串类型。noise - 取值范围为1-1000;无效/重复分子会被过滤,因此当用户需要最低数量的分子时,请请求额外的数量。
num_molecules - 可设为
scoring(类药性评分)或"QED"(亲脂性评分)。"LogP" - 设置可获取去重的类似物列表。
unique=True
Save And Report Output
保存并报告输出
Sort molecules by score, print the top ranks, and write a file as shown
in under Save Ranked
Results. For chemical validity, uniqueness, PAINS/alerts, and visualization
with RDKit, read .
.smireferences/examples.mdreferences/validation.md按分数对分子排序,打印排名靠前的结果,并按照中Save Ranked Results下的示例写入文件。如需了解化学有效性、唯一性、PAINS警示及使用RDKit进行可视化,请阅读。
references/examples.md.smireferences/validation.mdLimits And Troubleshooting
局限性与故障排除
- Fewer molecules than requested is expected after filtering.
- Invalid SAFE strings cause or validation errors.
status: "failed" - Install only for scaffold, motif, or lead-optimization workflows; de novo masks work without conversion.
safe-mol - Local startup downloads about 20 GB into .
LOCAL_NIM_CACHE - Container issues: confirm , NVIDIA Container Toolkit, and
nvidia-smi; use--runtime=nvidiato choose the single visible GPU.NIM_TEST_GPU
- 过滤后得到的分子数量可能少于请求数量,这属于正常情况。
- 无效的SAFE字符串会导致或验证错误。
status: "failed" - 仅在进行骨架、基序或先导化合物优化工作流时才需要安装;从头生成掩码无需转换即可使用。
safe-mol - 本地启动时会下载约20GB数据到目录。
LOCAL_NIM_CACHE - 容器问题:请确认、NVIDIA Container Toolkit及
nvidia-smi已正确配置;使用--runtime=nvidia选择单个可见GPU。NIM_TEST_GPU