| name | onnx-convert-cca-yuv |
| description | Convert CCA_YUV training checkpoints into split ONNX exports and keep the required model-definition/runtime code bundled with the skill. Use when Codex needs to export ONNX from a CCA_YUV checkpoint, patch or inspect the CCA_YUV ONNX toolchain, run split-graph verification or Kodak regression checks, or use the bundled codec runtime and bitstream CLI. Trigger on requests mentioning onnx-convert-cca_yuv, CCA_YUV, checkpoint-to-ONNX, split ONNX, export from .pth/.pt/.pth.tar, or CCA_YUV runtime tooling. |
CCA_YUV ONNX Export
Use scripts/export_onnx_convert_cca_yuv.py as the default entrypoint.
Recommended Environment / Verified Environment
- Run this skill in the
compressai2 Conda environment.
- Treat
compressai2 as the recommended and currently verified environment for export, verification, and inference workflows on Windows.
- Expect Python
3.8.
- Expect these verified core packages:
torch 1.10.2, onnx 1.17.0, onnxruntime 1.19.2, lpips 0.1.4, pytorch-msssim 1.0.0, scikit-image 0.21.0.
Why Not Chatchat
- Do not describe
chatchat as a supported runtime for this skill.
chatchat currently lacks torch, onnx, lpips, pytorch-msssim, and scikit-image.
chatchat currently uses Python 3.11, while the verified export environment uses Python 3.8.
- Treat Python
3.11 compatibility for this export toolchain as unverified until it is tested end to end.
Default Flow
- Accept a training checkpoint path that contains a top-level
state_dict.
- Activate
compressai2 and run the wrapper export script.
- Let the script derive the default export directory as
<checkpoint directory>/onnx_exports/<checkpoint name>/ unless the user overrides --output-dir.
- Inspect
meta/export_manifest.json and the generated encode/, decode/, and meta/ artifacts after export.
Primary Command
Activate compressai2 before running the export. If the command fails outside that environment, troubleshoot the environment before blaming the checkpoint file.
conda activate compressai2
python scripts/export_onnx_convert_cca_yuv.py --checkpoint C:\path\to\model.pth.tar
Optional flags:
conda activate compressai2
python scripts/export_onnx_convert_cca_yuv.py `
--checkpoint C:\path\to\model.pth.tar `
--output-dir C:\path\to\exports `
--device cpu `
--sample-height 512 `
--sample-width 768 `
--opset 13
Bundled Toolchain
- Use
scripts/cca_yuv_onnx/export_cca_yuv_split_onnx.py for the raw export implementation.
- Use
scripts/cca_yuv_onnx/verify_cca_yuv_split_onnx.py --checkpoint <ckpt> --dataset <kodak-dir> for module consistency and Kodak regression verification.
- Use
scripts/cca_yuv_onnx/run_cca_yuv_split_onnx_inference.py --checkpoint <ckpt> --dataset <image-dir> for ONNX inference reports.
- Use
scripts/cca_yuv_onnx/cca_yuv_codec_cli.py for encode, decode, and benchmark.
All bundled scripts resolve --onnx-dir from the checkpoint path when the flag is omitted.
Bundled Source Layout
scripts/cca_yuv_onnx/ contains the ONNX export, verification, inference, and codec runtime scripts.
scripts/CCA_YUV/model/ contains the CCA_YUV model-definition files required to rebuild the PyTorch model.
scripts/models/ contains the LICAutoencoder dependency used by CCAplus_v16_2.py.
scripts/compressai/ contains the local compressai source snapshot used by the bundled code.
references/source-readme.md contains the original short README copied from the source project.
Bundled Dependency Notes
- Treat
scripts/compressai/ as a bundled source snapshot that satisfies this skill's local compressai imports.
- Do not infer from that snapshot that any Python environment can run the export toolchain.
- Still require the active environment to provide compatible
torch, onnx, lpips, pytorch-msssim, scikit-image, and related runtime compatibility.
Unsupported Environments
- Do not advertise
chatchat as runnable until its missing dependencies are installed and the workflow is validated end to end.
- Treat requests to run this skill in
chatchat as migration work, not as a supported default path.
Chatchat Migration Notes
- To support export-only usage in
chatchat, plan to add at least torch, onnx, lpips, pytorch-msssim, and scikit-image.
- Consider moving
lpips and pytorch_msssim imports out of module import time and into verify or inference-only code paths to reduce the minimum export dependency set.
- Verify end-to-end behavior on Python
3.11 before marking chatchat as supported.
Constraints
- Require a checkpoint format that is a dict containing
state_dict.
- Do not assume any weight file is bundled inside the skill.
- Read
references/source-readme.md only when you need the original project summary; most implementation details already live in the bundled scripts.