ai/pytorch/SKILL.md
PyTorch model inspection and checkpoint workflow for loading tensors, `state_dict` data, modules, and parameters. Use when working with `.pt` or `.pth` artifacts, auditing model structure, extracting weights, or scripting inference-oriented inspection of deep-learning checkpoints.
npx skillsauth add aeondave/malskill pytorchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use PyTorch when model artifacts are tensors first and everything else second.
Use PyTorch when you need to:
.pt or .pth checkpoints safely onto CPU or GPUstate_dict keys, module hierarchy, and parameter shapesimport torch
checkpoint = torch.load("model.pt", map_location="cpu")
print(type(checkpoint))
print(checkpoint.keys() if isinstance(checkpoint, dict) else "non-dict checkpoint")
state = torch.load("weights.pth", map_location="cpu")
for name, tensor in state.items():
print(name, tuple(tensor.shape), tensor.dtype)
model.eval()
for name, module in model.named_modules():
print(name, module.__class__.__name__)
for name, param in model.named_parameters():
print(name, tuple(param.shape))
model.eval()
with torch.no_grad():
output = model(sample_input)
map_location="cpu" first unless you explicitly need GPU execution.state_dict-style loading and inspection over whole-model pickle blobs when possible.weights_only=True for safer tensor-only loads from trusted workflows.eval() and torch.no_grad() belong together for stable inspection and reduced memory noise.torch.load uses pickle under the hood; do not trust untrusted checkpoint files.No bundled scripts/, references/, or assets/.
Use the official PyTorch docs for torch.load, module introspection, and checkpoint best practices.
development
Auth/lab ref: Unicorn Engine CPU-only emulation for shellcode, decryptors, custom VM handlers, instruction tracing, memory hooks, and register-level experiments.
development
Auth/lab ref: Renode board and SoC simulation for MCU/RTOS firmware, UART/GPIO/peripheral modeling, GDB remote debugging, REPL platforms, and RESC scripts.
development
Auth/lab ref: Qiling OS-layer binary emulation for PE/ELF/Mach-O/UEFI/shellcode with rootfs, syscall/API hooks, filesystem mapping, and runtime patching.
databases
Auth/lab ref: QEMU user-mode and full-system emulation for cross-arch binaries, firmware, kernels, disks, serial consoles, networking, and GDB stubs.