NRDK CLI¶
Usage
The CLI tools use tyro:
- Positional arguments ("required") are passed as positional command line arguments
- Named arguments are passed as flagged command line arguments
nrdk export
¶
Export model weights from a full-service checkpoint.
Usage
Take the best checkpoint in results/experiment/version
, and export
the model to results/experiment/version/weights.pth
:
The model is assumed to be created by
NRDKLightningModule
(via pytorch lightning), so has a
state_dict
attribute that contains the model weights, where each key
has a leading .model
prefix.
- If the
path
points to a file, export that checkpoint. - If the
path
is a directory, the directory should have acheckpoints.yaml
with abest
key which specifies the best checkpoint in acheckpoints/
directory; the exported model is saved relative to thepath
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
path to the checkpoint. |
required |
output
|
str
|
path to save the exported weights. |
'weights.pth'
|
Source code in src/nrdk/_cli/export.py
nrdk inspect
¶
Inspect a pytorch / pytorch lightning checkpoint.
If the path
points to a file, inspect that checkpoint; if it points to a
directory, inspect the most recent checkpoint (by modification time).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
path to checkpoint file. |
required |
depth
|
int
|
maximum depth to print in the module/parameter tree. |
2
|
weights_only
|
bool
|
allow loading pytorch checkpoints containing custom objects. Note that this allows arbitrary code execution! |
False
|