Skip to content
Back to skills

Model And Weight Utilities

ASecurity

"Inspect ControlNet model/config APIs and safely reason about

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
code-qualitygoapi

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill model-and-weight-utilities --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Model And Weight Utilities?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Model And Weight Utilities
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-model-and-weight-utilities/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-model-and-weight-utilities)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: model-and-weight-utilities
description: "Inspect ControlNet model/config APIs and safely reason about
  checkpoint initialization, transfer, and state-dict mappings."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# Model and Weight Utilities

Use this sub-skill when a user needs to understand ControlNet architecture/configs, inspect model-loading APIs, dry-run checkpoint key mappings, initialize ControlNet weights from Stable Diffusion, transfer an existing ControlNet to a compatible community checkpoint, or debug checkpoint-loading failures.

For generated-image app usage, route to [gradio-inference-apps](../gradio-inference-apps/SKILL.md). For fine-tuning loops, Fill50K data, `sd_locked`, and dataset schema, route to [training-and-datasets](../training-and-datasets/SKILL.md). For detector outputs and control-map creation, route to [annotators-and-preprocessing](../annotators-and-preprocessing/SKILL.md).

## Quick Routing

- Read [API reference](references/api-reference.md) when inspecting `create_model`, `load_state_dict`, `get_state_dict`, `ControlNet`, `ControlledUnetModel`, `ControlLDM`, or `DDIMSampler` signatures and method responsibilities.
- Read [configuration and architecture](references/configuration-and-architecture.md) when comparing `cldm_v15.yaml` with `cldm_v21.yaml`, explaining `jpg`/`txt`/`hint`, zero convolutions, locked/trainable branches, low-VRAM behavior, or attention options.
- Read [weight utilities](references/weight-utilities.md) when adapting `tool_add_control.py`, `tool_add_control_sd21.py`, or the ControlNet transfer-offset algorithm without destructive hard-coded outputs.
- Read [troubleshooting](references/troubleshooting.md) when checkpoint paths, config/checkpoint pairing, safetensors loading, CUDA/xformers, state-dict prefixes, or overwrite guards fail.
- Run [`scripts/inspect_weight_mapping.py`](scripts/inspect_weight_mapping.py) when a user asks for a non-destructive report of ControlNet key mapping or newly initialized keys before writing a checkpoint.

## Safe Default Workflow

1. Identify the base family first: SD1.x uses `cldm_v15`/SD1.5 initialization; SD2.1 uses `cldm_v21`/SD2.1 initialization.
2. Dry-run key mapping before saving anything: use the bundled inspector with a real checkpoint or `--self-test` for the mapping logic.
3. Treat model creation and checkpoint loading separately: configs define target classes and tensor shapes; checkpoints supply state-dict keys and tensor values.
4. Preserve output safety: the original conversion scripts refuse missing input files, refuse existing output files, and require the output directory to exist; keep those guards in any adapted writer.
5. Avoid network and generation side effects in diagnostics: the bundled inspector performs no downloads, model generation, training, or checkpoint writes.

## Common User Requests

- "Create a ControlNet init checkpoint from SD1.5": read [weight utilities](references/weight-utilities.md), verify the input is an SD1.x checkpoint, dry-run with the inspector, then adapt the documented add-control writer only if an output save is explicitly requested.
- "Explain `cldm_v15` vs `cldm_v21`": read [configuration and architecture](references/configuration-and-architecture.md), especially context dimension, text encoder, attention head settings, and `use_linear_in_transformer`.
- "Dry-run state-dict key mapping": run [`scripts/inspect_weight_mapping.py`](scripts/inspect_weight_mapping.py) with `--config-family sd15` or `sd21` and optionally `--checkpoint`.
- "Debug safetensors loading": read [API reference](references/api-reference.md) for `load_state_dict` behavior and [troubleshooting](references/troubleshooting.md) for dependency/device issues.
- "Explain zero convolution learning": read [configuration and architecture](references/configuration-and-architecture.md) for the distilled FAQ explanation and how zero outputs become trainable after gradient updates.

Files in this skill

  • SKILL.md3.9 KB
  • references/api-reference.md6.6 KB
  • references/configuration-and-architecture.md6.3 KB
  • references/troubleshooting.md5.8 KB
  • references/weight-utilities.md6.6 KB
  • scripts/inspect_weight_mapping.py15.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.