openfold3-nim
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOpenFold3 NIM
OpenFold3 NIM
Predict biomolecular structures with OpenFold3. It supports proteins, DNA, RNA,
small-molecule ligands, and multi-entity assemblies. Use this for
basic hosted/local NIM use; load supplemental files only when the task needs
deeper context:
SKILL.md- : exact endpoints, schemas, Docker flags, response fields.
references/api.md - : purpose, strengths, limitations, and model handoffs.
references/science.md - : molecule fields, MSAs, templates, samples, tuning.
references/parameters.md - : artifact checks and scientific sanity checks.
references/validation.md - : compact hosted/local request patterns.
references/examples.md
使用OpenFold3预测生物分子结构。它支持蛋白质、DNA、RNA、小分子配体以及多实体复合物。本适用于托管/本地NIM的基础使用;仅当任务需要更深入的上下文时,才加载补充文件:
SKILL.md- :精确的端点、模式、Docker参数、响应字段。
references/api.md - :用途、优势、局限性以及模型切换说明。
references/science.md - :分子字段、MSA、模板、样本、调优参数。
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 URL:
https://health.api.nvidia.com/v1/biology/openfold/openfold3/predict - Local URL:
http://localhost:8000/biology/openfold/openfold3/predict - Local readiness:
http://localhost:8000/v1/health/ready
Mode difference: the local prediction path has no prefix. 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.
/v1/Authorization: Bearer $NGC_API_KEYNGC_API_KEYNVIDIA_API_KEY-e NGC_API_KEY仅当上下文不明确时询问:
使用NVIDIA托管API还是本地Docker NIM?
- 托管URL:
https://health.api.nvidia.com/v1/biology/openfold/openfold3/predict - 本地URL:
http://localhost:8000/biology/openfold/openfold3/predict - 本地就绪检查:
http://localhost:8000/v1/health/ready
模式差异:本地预测路径没有前缀。托管请求需使用。本地Docker启动需使用(或通过预检流程使用)进行镜像仓库登录、权限校验和首次运行模型下载;需通过将其传入容器。本地推理请求在就绪检查通过后无需身份验证头。无密钥的预热缓存启动方式因镜像/版本而异,不应默认使用。
/v1/Authorization: Bearer $NGC_API_KEYNGC_API_KEYNVIDIA_API_KEY-e NGC_API_KEYAuth And Environment
身份验证与环境配置
Do not print API keys. Confirm they exist with shell tests, not echoes.
Hosted needs in the request header. Local startup needs
, or as a fallback, plus .
A repo-root file may be sourced as a local override before validation.
NGC_API_KEYNGC_API_KEYNVIDIA_API_KEYLOCAL_NIM_CACHE.env请勿打印API密钥。通过Shell测试确认密钥存在,而非直接输出。
托管模式需在请求头中携带。本地启动需(或备用的)以及。可在验证前加载仓库根目录下的文件作为本地配置覆盖。
NGC_API_KEYNGC_API_KEYNVIDIA_API_KEYLOCAL_NIM_CACHE.envLocal Docker
本地Docker部署
Use the official OpenFold3 NIM image and mount at
. First startup downloads model artifacts and can take several
minutes.
LOCAL_NIM_CACHE/opt/nim/.cacheWhen writing local setup commands, copy the preflight below exactly. Do not
replace it with a simple check, do not
drop , and do not invent a default ; those
lines are the repo's local NIM env contract. The default single-GPU launch
should show the literal ; choose a different device only
when the user asks.
: "${NGC_API_KEY:?Set NGC_API_KEY}"NVIDIA_API_KEYLOCAL_NIM_CACHE--gpus "device=0"bash
set -a
[ -f .env ] && . ./.env
set +a
if [ -z "${NGC_API_KEY:-}" ] && [ -n "${NVIDIA_API_KEY:-}" ]; then
export NGC_API_KEY="$NVIDIA_API_KEY"
fi
: "${NGC_API_KEY:?Set NGC_API_KEY or NVIDIA_API_KEY}"
: "${LOCAL_NIM_CACHE:?Set LOCAL_NIM_CACHE}"
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
mkdir -p "${LOCAL_NIM_CACHE}"
chmod 755 "${LOCAL_NIM_CACHE}"
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus "device=0" \
--shm-size=16g \
-e NGC_API_KEY \
-v "${LOCAL_NIM_CACHE}:/opt/nim/.cache" \
-p 8000:8000 \
nvcr.io/nim/openfold/openfold3:latestReadiness check:
bash
until curl -sf http://localhost:8000/v1/health/ready; do sleep 5; done使用官方OpenFold3 NIM镜像,并将挂载到。首次启动会下载模型产物,可能需要数分钟时间。
LOCAL_NIM_CACHE/opt/nim/.cache编写本地搭建命令时,请完全复制以下预检代码。不要将其替换为简单的检查,不要删除,也不要自行设置的默认值;这些代码是仓库本地NIM环境的约定。默认单GPU启动应显示字面量;仅当用户要求时才选择其他设备。
: "${NGC_API_KEY:?Set NGC_API_KEY}"NVIDIA_API_KEYLOCAL_NIM_CACHE--gpus "device=0"bash
set -a
[ -f .env ] && . ./.env
set +a
if [ -z "${NGC_API_KEY:-}" ] && [ -n "${NVIDIA_API_KEY:-}" ]; then
export NGC_API_KEY="$NVIDIA_API_KEY"
fi
: "${NGC_API_KEY:?Set NGC_API_KEY or NVIDIA_API_KEY}"
: "${LOCAL_NIM_CACHE:?Set LOCAL_NIM_CACHE}"
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
mkdir -p "${LOCAL_NIM_CACHE}"
chmod 755 "${LOCAL_NIM_CACHE}"
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus "device=0" \
--shm-size=16g \
-e NGC_API_KEY \
-v "${LOCAL_NIM_CACHE}:/opt/nim/.cache" \
-p 8000:8000 \
nvcr.io/nim/openfold/openfold3:latest就绪检查:
bash
until curl -sf http://localhost:8000/v1/health/ready; do sleep 5; doneRequest Pattern
请求模式
Use . For local Docker tasks,
set after the readiness check passes.
requests.post(..., json=payload, timeout=300)hosted = Falsepython
import os
import requests
hosted = True
url = (
"https://health.api.nvidia.com/v1/biology/openfold/openfold3/predict"
if hosted
else "http://localhost:8000/biology/openfold/openfold3/predict"
)
headers = {"Content-Type": "application/json"}
if hosted:
headers["Authorization"] = f"Bearer {os.getenv('NGC_API_KEY')}"
seq = "MKTVRQERLKSIVR"
payload = {
"inputs": [{
"input_id": "prediction_1",
"output_format": "pdb",
"molecules": [{
"type": "protein",
"id": "A",
"sequence": seq,
"diffusion_samples": 1,
"msa": {
"main": {
"a3m": {
"alignment": f">query\n{seq}",
"format": "a3m"
}
}
}
}]
}]
}
response = requests.post(url, headers=headers, json=payload, timeout=300)
response.raise_for_status()
result = response.json()Payload gotchas:
- Top level is and OpenFold3 accepts exactly one input.
{"inputs": [...]} - can contain 1-32 objects with
molecules:type,protein,dna, orrna.ligand - Protein/RNA MSAs are optional but, when supplied, must start with a FASTA header such as
alignment.>query\nSEQUENCE - Ligands use either or
smiles, for exampleccd_codes.{"type": "ligand", "id": "L", "ccd_codes": "ATP"} - DNA/RNA entities use , for example
sequence.{"type": "dna", "id": "B", "sequence": "ATCGATCG"} - is 1-5.
diffusion_samplesisoutput_formatorpdb.cif
使用。对于本地Docker任务,在就绪检查通过后设置。
requests.post(..., json=payload, timeout=300)hosted = Falsepython
import os
import requests
hosted = True
url = (
"https://health.api.nvidia.com/v1/biology/openfold/openfold3/predict"
if hosted
else "http://localhost:8000/biology/openfold/openfold3/predict"
)
headers = {"Content-Type": "application/json"}
if hosted:
headers["Authorization"] = f"Bearer {os.getenv('NGC_API_KEY')}"
seq = "MKTVRQERLKSIVR"
payload = {
"inputs": [{
"input_id": "prediction_1",
"output_format": "pdb",
"molecules": [{
"type": "protein",
"id": "A",
"sequence": seq,
"diffusion_samples": 1,
"msa": {
"main": {
"a3m": {
"alignment": f">query\n{seq}",
"format": "a3m"
}
}
}
}]
}]
}
response = requests.post(url, headers=headers, json=payload, timeout=300)
response.raise_for_status()
result = response.json()请求负载注意事项:
- 顶层结构为,且OpenFold3仅接受一个输入。
{"inputs": [...]} - 可包含1-32个对象,类型为
molecules、protein、dna或rna。ligand - 蛋白质/RNA的MSA为可选参数,但提供时必须以FASTA头(如
alignment)开头。>query\nSEQUENCE - 配体需使用或
smiles,例如ccd_codes。{"type": "ligand", "id": "L", "ccd_codes": "ATP"} - DNA/RNA实体使用,例如
sequence。{"type": "dna", "id": "B", "sequence": "ATCGATCG"} - 取值范围为1-5。
diffusion_samples为output_format或pdb。cif
Save And Interpret Output
保存与解读输出
Save every returned structure as a scientific artifact. Main response path:
.
result["outputs"][0]["structures_with_scores"]python
output = result["outputs"][0]
for i, sample in enumerate(output["structures_with_scores"], start=1):
fmt = sample["format"]
with open(f"openfold3_structure_{i}.{fmt}", "w", encoding="utf-8") as fh:
fh.write(sample["structure"])
print("confidence_score", sample.get("confidence_score"))
print("complex_plddt_score", sample.get("complex_plddt_score"))
print("ptm_score", sample.get("ptm_score"))
print("iptm_score", sample.get("iptm_score"))
print("complex_pde_score", sample.get("complex_pde_score"))Higher , , , and
are generally better; lower is generally better. Treat toy
or very short sequences as API smoke tests, not meaningful structural biology.
For why and when OpenFold3 is scientifically appropriate, read
.
confidence_scorecomplex_plddt_scoreptm_scoreiptm_scorecomplex_pde_scorereferences/science.md将所有返回的结构保存为科学产物。主要响应路径为:。
result["outputs"][0]["structures_with_scores"]python
output = result["outputs"][0]
for i, sample in enumerate(output["structures_with_scores"], start=1):
fmt = sample["format"]
with open(f"openfold3_structure_{i}.{fmt}", "w", encoding="utf-8") as fh:
fh.write(sample["structure"])
print("confidence_score", sample.get("confidence_score"))
print("complex_plddt_score", sample.get("complex_plddt_score"))
print("ptm_score", sample.get("ptm_score"))
print("iptm_score", sample.get("iptm_score"))
print("complex_pde_score", sample.get("complex_pde_score"))通常,、、和越高越好;越低越好。将玩具序列或极短序列视为API冒烟测试,而非有意义的结构生物学研究。关于OpenFold3在科学场景中的适用场景与原因,请阅读。
confidence_scorecomplex_plddt_scoreptm_scoreiptm_scorecomplex_pde_scorereferences/science.mdCommon Limits
常见限制
- Inputs per request: 1.
- Molecules per input: 1-32.
- Diffusion samples: 1-5.
- TensorRT path supports shorter sequences; PyTorch path can support longer sequences, but long inputs need much more GPU memory.
- Sequences over roughly 1800 residues require at least 80 GB GPU memory.
- Local NIM is single-GPU only; choose the target device in the Docker flag.
- 每个请求的输入数量:1个。
- 每个输入的分子数量:1-32个。
- 扩散样本数量:1-5个。
- TensorRT路径支持较短序列;PyTorch路径可支持较长序列,但长输入需要更多GPU内存。
- 约1800个残基以上的序列需要至少80GB GPU内存。
- 本地NIM仅支持单GPU;需在Docker参数中选择目标设备。
Troubleshooting
故障排查
- : missing, expired, or unauthorized NGC API key.
401 - : invalid molecule type, invalid sequence characters, bad MSA shape, or
422outside 1-5.diffusion_samples - MSA errors: ensure the alignment starts with .
>query\n - Local : remove
404from the prediction URL./v1/ - Local startup stalls: first run may be downloading 10-15 GB of model weights
into .
LOCAL_NIM_CACHE - Memory errors: shorten the sequence, reduce samples, or use a larger GPU.
- :NGC API密钥缺失、过期或未授权。
401 - :分子类型无效、序列字符非法、MSA格式错误或
422超出1-5范围。diffusion_samples - MSA错误:确保对齐内容以开头。
>query\n - 本地:从预测URL中移除
404前缀。/v1/ - 本地启动停滞:首次运行可能正在下载10-15GB的模型权重到。
LOCAL_NIM_CACHE - 内存错误:缩短序列、减少样本数量或使用更大显存的GPU。