Register a model so that framework hooks can capture weight and gradient snapshots at epoch boundaries. Only needed for bare PyTorch loops (Keras and HuggingFaceDocumentation Index
Fetch the complete documentation index at: https://docs.cirron.com/llms.txt
Use this file to discover all available pages before exploring further.
Trainer discover the model from their
callback kwargs automatically).
Signature
Parameters
| Name | Type | Purpose |
|---|---|---|
model | any | The model to snapshot. Typically an nn.Module for PyTorch. |
When to call
Call once, before training starts, afterci.profile():
When not to call
Skipci.watch when:
- You’re using Keras: the hook reads
self.modelinsideon_epoch_end. - You’re using HuggingFace
Trainer: the callback receives the model viaTrainer.model. - You’re not capturing snapshots (
ci.profile(enabled=False), or you simply don’t read the snapshot records).
What it does
Stores a reference to the model on the active profiler. At each detected epoch boundary (DataLoader iterator exhaustion,ci.epochs()
iteration, or callback-reported epoch end), the snapshot subsystem
walks model.named_parameters() and writes per-tensor records to the
spool (see Snapshot schema).
In snapshots="sampled" or "full" mode, raw tensor values
additionally serialize to
./.cirron/snapshots/<span_id>/weights.safetensors.
Module-level only
ci.watch is a module-level function only. There is no
Cirron.watch() method. If you’re working with an explicit Cirron
instance, call cirron.watch(model) from the module top-level. The
registered model is held on the active profiler singleton.
Multiple models
Callci.watch multiple times to capture snapshots from more than one
model (e.g. GAN generator + discriminator). Each registered model
contributes its own parameter namespace to the snapshot records.
Related
ci.profile
The
snapshots= parameter that controls what watch produces.Snapshot schema
On-disk format for weight and gradient captures.