configuration
It constructs, loads, merges, validates, and safely edits gradSLAM CfgNode configuration trees.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- configuration
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- It constructs, loads, merges, validates, and safely edits gradSLAM CfgNode configuration trees.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/api-reference.md5.1 KB
- 参考文档references/troubleshooting.md4.1 KB
- 参考文档references/workflows.md4.4 KB
03 SKILL.md 正文
gradSLAM configuration
Use this sub-skill when a task needs the repository's CfgNode rather than a
plain dictionary. CfgNode is a dictionary-backed tree with attribute access,
YAML/Python loading, controlled merges, type checks, mutability controls, and
legacy-key diagnostics.
Entry points
- Import
CfgNodefromgradslam.config(the package also exposes the compatibility-levelload_cfgalias). - Construct from a nested dictionary, or construct an empty node and assign
nested
CfgNodeobjects. - Read the exact method signatures and accepted file forms in the API reference.
- Follow the operation sequences in the workflows.
- Use the troubleshooting guide when a merge, type, load, or mutability operation fails.
- Run
scripts/config_smoke.py --helpbefore using the bundled deterministic check; it creates only temporary local files.
Core operating rules
- Keep a stable base schema in a
CfgNode. Nested dictionaries passed to the constructor are recursively converted to nodes. - Use attribute access for known keys (
cfg.TRAIN.LR) and dictionary access when a key is dynamic. Missing attributes raiseAttributeError. - Apply overlays deliberately.
merge_from_file,merge_from_other_cfg, andmerge_from_listoverwrite existing values; later operations win when applied sequentially. - Treat a list override as pairs of
FULL.KEY,VALUE. Values are decoded with Python literal syntax where possible, so quote strings that could be mistaken for another literal. - Expect strict schema checks by default. An unknown key raises an error,
except at a node constructed with
new_allowed=Truewhen merging a config tree or file. This setting is local to that node. - Existing list/tuple values may be replaced by the other container type and are coerced to the original type. Other replacement types must match exactly; do not rely on numeric or boolean coercion.
- Freeze before handing a configuration to code that must not mutate it.
freeze()propagates to nested nodes;defrost()propagates back. Clone before making an experimental variant so the base remains independent. - Register removed keys as deprecated when old inputs should be ignored with a warning. Register renamed keys when old inputs must fail with a replacement and optional migration message.
Safe merge sequence
- Build or load the base schema.
- Validate that every file/list override uses an existing path unless the destination merge node explicitly permits new keys.
- Apply broad file/tree overlays first, then narrow CLI-style overrides.
- Inspect
cfg.dump()for a YAML serialization and usestr(cfg)for the sorted human-readable tree.repr(cfg)is a diagnostic representation, not a portable config file. - Freeze only after all intended merges. If a variant is needed, clone it, defrost the clone, change it, and freeze it again.
Diagnostics contract
- Missing attribute:
AttributeError. - Invalid leaf or assigned value:
AssertionErrorwith a key/type message. - Unknown merge key:
KeyError. - Wrong replacement type:
ValueError. - Renamed key:
KeyErrornaming the replacement and optional message. - Deprecated key: merge is skipped and a warning is logged.
- Odd-length override list or a missing path component:
AssertionError.
Do not treat new_allowed=True as recursive global permissiveness, and do not
assume freeze() makes every mapping-level merge method transactional. The
implementation guards attribute assignment; perform merges before freezing, or
use an explicit defrost/clone/re-freeze sequence.
Boundaries
This sub-skill covers configuration tree mechanics only. It does not define
model, dataset, odometry, device, or command-line parser schemas. Those callers
must provide the base keys and convert their own application arguments into
merge_from_list pairs.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.