Model inference
Use this sub-skill after an input has been converted to model-ready tensors, or
use the tiny smoke helper to validate the model contract before allocating a
large run. Start with workflows, then consult the
API contract for exact shapes and
troubleshooting for recovery.
Route by responsibility
- Send proteins, nucleic acids, ligands, metals, atom features, batching,
masks, representative-atom indices, and output structure conversion to
input-representation.
- Send mmCIF/PDB parsing, MSA and template acquisition or preprocessing to
data-pipeline. This model accepts already prepared
tensors; it does not fetch biological data for you.
- Send
Trainer, datasets, optimizers, YAML, EMA, and checkpointed training
loops to training-configuration.
- Send Click command construction, output files, and Gradio operation to
cli-serving.
Operating sequence
- Select CPU for contract checks and reduced tests; select CUDA only after the
device, dtype, and memory budget are explicit.
- Construct a deliberately reduced
Alphafold3 with dimensions and depths
appropriate to the available memory. The constructor's production defaults
are not a smoke configuration.
- Validate
atom_inputs, atom-pair inputs, token counts, molecule lengths,
masks, and all index offsets before calling forward.
- Choose the return mode deliberately: coordinates for inference, or loss and
an optional breakdown when ground-truth positions/labels are supplied.
- Add confidence/distogram logits only when they are needed; rank multiple
samples/models with the dedicated scoring classes rather than treating raw
logits as scores.
- For a checkpoint, prefer
init_and_load when the file was saved by this
package, and verify version, constructor dimensions, device, and strictness
before production inference.
Run the bundled safe check. The examples assume this
sub-skill directory is the current directory; from any other directory, invoke
the linked script by its resolved path because the helper has no current-directory
assumptions:
python scripts/smoke_model.py --help
python scripts/smoke_model.py --mode signature --device cpu
# Only for an explicitly bounded tiny forward:
python scripts/smoke_model.py --mode forward --device cpu --num-sample-steps 2
python scripts/smoke_model.py --mode forward --device cpu --num-sample-steps 2 --with-distogram
The helper never downloads weights, enables PLM/NLM encoders, trains, starts a
server, or uses production-scale defaults. It is a contract probe, not evidence
of useful structural accuracy or production throughput.
1---2name: model-inference3description: "Construct bounded AlphaFold 3 models, choose forward loss or4 sampling modes, load compatible checkpoints, and inspect confidence,5 distogram, and ranking outputs."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/model-inference9 disco-role: operating10license: MIT11---1213# Model inference1415Use this sub-skill after an input has been converted to model-ready tensors, or16use the tiny smoke helper to validate the model contract before allocating a17large run. Start with [workflows](references/workflows.md), then consult the18[API contract](references/model-and-forward-api.md) for exact shapes and19[troubleshooting](references/troubleshooting.md) for recovery.2021## Route by responsibility2223- Send proteins, nucleic acids, ligands, metals, atom features, batching,24 masks, representative-atom indices, and output structure conversion to25 [input-representation](../input-representation/SKILL.md).26- Send mmCIF/PDB parsing, MSA and template acquisition or preprocessing to27 [data-pipeline](../data-pipeline/SKILL.md). This model accepts already prepared28 tensors; it does not fetch biological data for you.29- Send `Trainer`, datasets, optimizers, YAML, EMA, and checkpointed training30 loops to [training-configuration](../training-configuration/SKILL.md).31- Send Click command construction, output files, and Gradio operation to32 [cli-serving](../cli-serving/SKILL.md).3334## Operating sequence35361. Select CPU for contract checks and reduced tests; select CUDA only after the37 device, dtype, and memory budget are explicit.382. Construct a deliberately reduced `Alphafold3` with dimensions and depths39 appropriate to the available memory. The constructor's production defaults40 are not a smoke configuration.413. Validate `atom_inputs`, atom-pair inputs, token counts, molecule lengths,42 masks, and all index offsets before calling `forward`.434. Choose the return mode deliberately: coordinates for inference, or loss and44 an optional breakdown when ground-truth positions/labels are supplied.455. Add confidence/distogram logits only when they are needed; rank multiple46 samples/models with the dedicated scoring classes rather than treating raw47 logits as scores.486. For a checkpoint, prefer `init_and_load` when the file was saved by this49 package, and verify version, constructor dimensions, device, and strictness50 before production inference.5152Run the [bundled safe check](scripts/smoke_model.py). The examples assume this53sub-skill directory is the current directory; from any other directory, invoke54the linked script by its resolved path because the helper has no current-directory55assumptions:5657```bash58python scripts/smoke_model.py --help59python scripts/smoke_model.py --mode signature --device cpu60# Only for an explicitly bounded tiny forward:61python scripts/smoke_model.py --mode forward --device cpu --num-sample-steps 262python scripts/smoke_model.py --mode forward --device cpu --num-sample-steps 2 --with-distogram63```6465The helper never downloads weights, enables PLM/NLM encoders, trains, starts a66server, or uses production-scale defaults. It is a contract probe, not evidence67of useful structural accuracy or production throughput.