port-external-models
Skill441 starsChanged 3 months agoApache-2.0View on GitHub
Implement or review a port of an external model in SDM, from upstream inference behavior and checkpoints through public prediction parity and reviewable PRs.
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Follow the repository-root AGENTS.md.
- Very specific: line 18
Before porting blocks, specify the SDM forward: which public inputs become which core tensors, and how core outputs become the returned …
- Very specific: line 19
Keep the model wrapper responsible for SDM inputs, outputs, and lifecycle.
- Very specific: line 21
Start from existing sdm.nn components.
- Distinctive: line 23
Write computations in execution order with short, typed methods and meaningful intermediate names.
- Very specific: line 34
Index (last): add the model to sdm.models and the docs index.
- Distinctive: line 39
Test supported boundaries and edge cases, such as missing or constant inputs, multiple outputs, auxiliary data, and size limits where …
- Distinctive: line 41
When reviewing a proposed port, reconstruct the upstream public contract and intended SDM call path before evaluating the diff.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Port an External Model to SDM
Follow the repository-root AGENTS.md. When a port adds reusable processors or changes a Recipe, also follow the processor-development or recipe-development skill, respectively. Use docstring when writing or reviewing public docstrings.
Establish the reference
- Which revision: Pin the upstream git SHA, Hub revision, model config, and source vs weight licenses. Put them in the PR description; when merging, also in
THIRD_PARTY_LICENSES.md, the model docstring, and the checkpoint load path. - Which behaviour in this revision: Trace an upstream public inference call through input preparation, numerical execution, and output restoration. Identify the functions responsible for each stage; a low-level
forwardmethod alone does not establish public behavior. - Which public contract: Record accepted forms and shapes, feature and target roles, auxiliary inputs, batching and size limits, missing and non-finite values, masks or padding, preprocessing and output restoration, and output ordering where applicable. Include any task-specific semantics that affect predictions. Distinguish public boundary behavior from numerical model computation, and state which capabilities the SDM port supports.
Build the SDM path
- Before porting blocks, specify the SDM
forward: which public inputs become which core tensors, and how core outputs become the returnedTableTensor. - Keep the model wrapper responsible for SDM inputs, outputs, and lifecycle. Put reusable numerical operations in
sdm.nn, model-specific composition and checkpoint handling in model components, and independently reusable preprocessing insdm.processing. ICLModel._forwardtakesTableTensor(plus related tables when used). Unwrap toTensorfor numerical work and keep that tensor's device and dtype.sdm.nntakesTensoronly; keepTableTensoronly while column or relation schema is still required.- Start from existing
sdm.nncomponents. Adapt one to the required semantics when the change is reusable across models; otherwise add a reusable component for a distinct operation. Prefer an efficient, numerically equivalent formulation over copying upstream computations, and verify it against the reference. - Design components for clear SDM semantics, not for strict loading of an upstream state dict. Remap checkpoint keys or tensors at the loading boundary as needed, and verify that all weights required by supported inference are loaded.
- Write computations in execution order with short, typed methods and meaningful intermediate names. Extract helpers for distinct behavior or real reuse; omit upstream factories, configuration layers, and wrappers that SDM does not need.
- Compose default recipes from existing public processors. Use a fitted recipe transform only when its state can be learned from permitted data and applied without leakage; ensure any inverse transform works on the prediction's actual shape.
Plan reviewable PRs
Split the port into this stack. These are phases, not five PRs: Blocks and Capabilities are one PR each. Title PRs [Model N/n] with n the total count. Each PR has one reviewable outcome, names its parent PR, and keeps the branch working. Treat roughly 300 changed lines as a prompt to split, not a reason for incomplete PRs.
- Skeleton (optional): package and
ICLModelsubclass, imported only from the submodule. Zeros are allowed here. - Blocks: one numerical piece per PR (
sdm.nnor model component) with a focused tensor test. Add only what the working path needs. - Working path: assemble the core, load the pinned checkpoint, and run one public
forward/predictfor one supported input kind (related tables only if required). The prediction matches the pinned reference; a public behavior test covers it. Zeros, stubs, or block-only tests do not complete this phase. - Capabilities: extra input types, auxiliaries, missing values, size limits, recipe details. Keep each capability's implementation, tests, and needed docs together.
- Index (last): add the model to
sdm.modelsand the docs index.
Verify and review
- Generate deterministic reference outputs from the pinned upstream revision. Compare observable SDM predictions through the public path, including checkpoint loading and output ordering. Claim end-to-end parity only after this comparison.
- Test supported boundaries and edge cases, such as missing or constant inputs, multiple outputs, auxiliary data, and size limits where applicable. Assert public behavior rather than internal helper layout.
- Benchmark performance-sensitive GPU changes with synchronization-aware timing.
- When reviewing a proposed port, reconstruct the upstream public contract and intended SDM call path before evaluating the diff. Check the working public slice, reference evidence, leakage boundaries, checkpoint behavior, and parity claims against that contract; suggest removing machinery unrelated to the supported path.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docstringSkill
- processor-developmentSkill
- recipe-developmentSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

