perceptual_latent_compression
Validate LDM autoencoder latent compression contracts, spatial downsampling, regularization metadata, and reconstruction diagnostics.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- perceptual_latent_compression
- description
- Validate LDM autoencoder latent compression contracts, spatial downsampling, regularization metadata, and reconstruction diagnostics.
02 资源文件 2
- 脚本scripts/latent_contract.py2.9 KB
- 脚本tests/test_latent_contract.py807 B
03 SKILL.md 正文
Perceptual Latent Compression
Use this skill when a task needs the first-stage latent representation contract from Latent Diffusion Models. It is appropriate for planning or validating LDM training, sampling, or recovery experiments. Do not use it to claim that a production perceptual autoencoder has been trained or loaded; the script validates contracts and reduced-proxy metadata only.
Inputs
- Image height, width, and RGB channel count.
- Downsampling factor
f, preferably one of the mild LDM factors such as 4 or 8. - Latent channel count.
- Regularization mode:
kl,vq, ornonefor declared proxies. - Optional reconstruction diagnostics supplied by the caller.
Outputs
- Latent grid dimensions and latent shape.
- Compression ratio and spatial reduction.
- Warnings for pixel-space operation, aggressive compression, or proxy regularization.
- Validation errors for invalid shapes or unsupported modes.
Workflow
- Confirm the input is an RGB image tensor contract.
- Confirm height and width are divisible by the downsampling factor; reject or require explicit caller-side padding before claiming a latent shape.
- Compute latent height, width, and channel dimensions only after divisibility is valid.
- Record regularization mode without inventing training evidence.
- Forward only the latent contract to diffusion or recovery modules.
- Treat deterministic pooling or shape-only encoders as reduced proxies.
Validation
Run python scripts/latent_contract.py --height 16 --width 16 --channels 3 --factor 4 --latent-channels 3 --regularization none and execute python tests/test_latent_contract.py or the Distiller skill validator with --run-tests.
Limitations
This skill does not load paper checkpoints, compute real FID, or train the autoencoder. Full reconstruction quality requires real autoencoder weights and dataset metrics.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).