Save Lens
Save Lens — stop re-extracting that direction, just save it
- steer
- steer
- path
Save Lens is the write half of the lens system: take a QSCOPE_STEER plan and persist it to disk as lenses/qwenscope/<name>.safetensors. The direction plus the key parameters (source, d_model, default strength, layer spec, normalize, last-token-only) are stored in the safetensors header, so when you load it later the lens "remembers" how it was meant to behave.
Why bother? Because the interesting directions take effort to produce - you trained a contrastive lens on 12 prompt pairs, or you found a feature that does something genuinely useful. Recreating that every session is a waste of your GPU and your patience. One save and the direction is a permanent asset you can load in any workflow, including ones you share. It's the difference between "this was a fun experiment" and "I have a cinematic lens on file now."
How it works
The node takes the steer plan's direction tensor, moves it to CPU, casts to float, and writes it with safetensors - which means a JSON header plus raw tensor bytes and no pickle, so nothing executes when the file is later loaded. The .safetensors extension is appended automatically if you forget it. Files land in <pack>/lenses/qwenscope/ by default, which is exactly where Load Lens scans - so save and reload are a drop-in round trip.
One detail worth knowing: the node passes the steer plan through unchanged on its steer output. So you can chain it - Feature → Direction → Save Lens → Steer Conditioning - without breaking the flow. Saving isn't a terminal operation; it's a side effect.
The inputs
- steer - any
QSCOPE_STEERplan: from Feature → Direction, Train Lens (Contrastive), Combine Lenses, Load Lens, Residual Steer. Whatever you want to keep. - name - the filename without extension (default
my_lens). Pick something descriptive; "cinematic" beats "lens1" when you've got twenty of them.
Outputs: steer (the same plan, passed through) and path - the absolute path the file was written to, which is your confirmation it saved and a pointer if you want to manage the file manually.
Installing it
Same pack, one install: ComfyUI Manager → search "ComfyUI QwenScope", or
cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-QwenScope
restart. Deps are the usual transformers, huggingface_hub, safetensors, Pillow, numpy. Saving is instant - a direction tensor is tiny next to model weights.
Common issues
The main gotcha is dimension discipline: a lens saves whatever d_model it has, and if that doesn't match the encoder you apply it to later, you'll get a mismatch error at apply time - so name your lens with its target in mind (e.g. cinematic_8b vs cinematic_2b). Also note the default strength stored is the plan's strength at save time; Load Lens lets you override it, but if you save with strength 3.0 and forget, you've effectively saved a stronger lens than you intended. Check the path output after saving - if it doesn't exist on disk, the save failed and the error will say why.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| steer | QSCOPE_STEER | — | |
| name | STRING | my_lens | .safetensors extension is added automatically. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| steer | QSCOPE_STEER | — |
| path | STRING | — |