Big Model Inference
Use this sub-skill when an agent needs to load, inspect, partition, or troubleshoot models that may not fit in a single device's memory. It covers Accelerate's init_empty_weights, infer_auto_device_map, load_checkpoint_and_dispatch, dispatch_model, CPU/disk offload helpers, hook behavior, prepare_pippy, and model-size estimation concepts.
Route First
- For generic
accelerate launch, accelerate config, or accelerate estimate-memory CLI syntax, route to ../configuration-and-cli/.
- For DeepSpeed ZeRO-3 training/inference tradeoffs, route to
../distributed-training-backends/.
- For normal
Accelerator.prepare training loops, route to the training-oriented sub-skill instead of using big-model dispatch primitives.
Core References
- Read
references/workflows.md for safe workflows: meta-device construction, device-map planning, checkpoint dispatch, CPU/disk offload, distributed inference, and pipeline parallelism.
- Read
references/api-reference.md for public APIs, key parameters, and import locations.
- Read
references/troubleshooting.md when device maps, offload folders, checkpoint indexes, meta tensors, split points, or optional model libraries fail.
- Use
scripts/big_model_api_smoke.py --help or run the script directly to verify tiny CPU/meta-device API availability without downloads.
Safety Defaults
- Prefer tiny synthetic
torch.nn.Module models for inspection and examples.
- Do not call
from_pretrained, snapshot_download, or heavyweight model examples unless the user explicitly wants network/model downloads.
- Treat disk offload as requiring a real writable offload folder and clean it up after experiments.
- Never call
.to("cpu"), .cuda(), or a forward pass on a model still initialized on meta; load or set real tensors first.
1---2name: big-model-inference3description: "Use Accelerate big-model inference utilities for meta4 initialization, device-map planning, checkpoint dispatch, CPU/disk offload,5 hooks, pipeline inference, and memory sizing without triggering downloads or6 heavyweight runs."7disable-model-invocation: true8metadata:9 source: https://skillmd.com/skills/vectorspacelab/big-model-inference10 disco-role: operating11license: Apache 2.012---1314# Big Model Inference1516Use this sub-skill when an agent needs to load, inspect, partition, or troubleshoot models that may not fit in a single device's memory. It covers Accelerate's `init_empty_weights`, `infer_auto_device_map`, `load_checkpoint_and_dispatch`, `dispatch_model`, CPU/disk offload helpers, hook behavior, `prepare_pippy`, and model-size estimation concepts.1718## Route First1920- For generic `accelerate launch`, `accelerate config`, or `accelerate estimate-memory` CLI syntax, route to `../configuration-and-cli/`.21- For DeepSpeed ZeRO-3 training/inference tradeoffs, route to `../distributed-training-backends/`.22- For normal `Accelerator.prepare` training loops, route to the training-oriented sub-skill instead of using big-model dispatch primitives.2324## Core References2526- Read `references/workflows.md` for safe workflows: meta-device construction, device-map planning, checkpoint dispatch, CPU/disk offload, distributed inference, and pipeline parallelism.27- Read `references/api-reference.md` for public APIs, key parameters, and import locations.28- Read `references/troubleshooting.md` when device maps, offload folders, checkpoint indexes, meta tensors, split points, or optional model libraries fail.29- Use `scripts/big_model_api_smoke.py --help` or run the script directly to verify tiny CPU/meta-device API availability without downloads.3031## Safety Defaults3233- Prefer tiny synthetic `torch.nn.Module` models for inspection and examples.34- Do not call `from_pretrained`, `snapshot_download`, or heavyweight model examples unless the user explicitly wants network/model downloads.35- Treat disk offload as requiring a real writable offload folder and clean it up after experiments.36- Never call `.to("cpu")`, `.cuda()`, or a forward pass on a model still initialized on `meta`; load or set real tensors first.