Files
hao-ai-lab-FastVideo/scripts/checkpoint_conversion/AGENTS.md
T
SolitaryThinkerandClaude Opus 5.5 d692d1cc3b [misc]: remove DreamX World, HunyuanGameCraft, GLM-Image, LongCat, TurboDiffusion, and Z-Image
These ports were marked pending removal in #1820. Each has a newer,
maintained counterpart in the repo, and their model-specific hooks
leaked into shared stages, request fields, CLI args, and loaders.

Remove each model's code, configs, presets, examples, converters,
tests, cookbook pages, CI planner rules, and registry entries, along
with the shared-code hooks only they used:

- camera kwargs (GameCraft camera_states, DreamX y_camera) in the
  shared denoising loop
- LongCat refine branches in latent preparation, the decoding crop,
  the --bsa-* CLI args, its train model, and third_party/longcat_video
- Z-Image cfg_normalization/cfg_truncation and GameCraft/DreamX
  camera/action fields in SamplingParam, ForwardBatch, and the schema
- the GLM-Image vision-language loader and the TurboDiffusion rCM
  scheduler and SLA auto-select in the train entrypoint
- the Wan definition groups that only preserved DreamX detector order

Removed env vars and their legacy aliases move to DEPRECATED_VARIABLES
per the env-var policy. Matrix Game 2.0 stays: the new trainer's world
model scenarios depend on it. The SLA and BSA attention backends stay.
The TurboDiffusion int8 kernels in fastvideo-kernel are left for a
separate kernel PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 22:40:54 +00:00

2.7 KiB

scripts/checkpoint_conversion/ — Official → FastVideo Converters

Generated: 2026-05-02

Pre-commit excludes scripts/. Format / lint by hand against neighboring converters before opening a PR.

What Lives Here

checkpoint_conversion/
├── convert_gen3c_to_fastvideo.py
├── convert_ltx2_weights.py
├── convert_minimax_h3_adaln_rank.py     # Rank-reduces AdaLN in place; same family
├── stable_audio_to_diffusers.py
├── wan_to_diffusers.py
├── pt_to_safetensors.py                 # Generic format flip
└── create_hf_repo.py                    # Push to HF after conversion

Naming Convention

Pattern Use
convert_<model>_*.py / <model>_to_<format>.py One-shot converter for a model family
extract_<role>_*.py Pull a sub-component out of a multimodal repo
validate_<model>_*.py Post-conversion shape / norm sanity checks
<format>_to_<format>.py Generic format conversion (no model knowledge)

Authoring a New Converter

  1. Prototype the FastVideo-native component first under fastvideo/models/<role>/<model>.py. Its state_dict() is the target surface — never the other way around.
  2. Mirror the official-checkpoint key pattern → FastVideo-native key pattern in a param_names_mapping (declared on the arch config in fastvideo/configs/models/<role>/<model>.py).
  3. The converter's only job: load the official checkpoint, apply the mapping (with split/fuse for QKV / packed MLP), and write a safetensors directory that the ComponentLoader (fastvideo/models/loader/) can read.
  4. Record intentionally skipped keys (training-only EMA, optimizer state, logvar, dynamic buffers) in a constant near the top of the converter — with a one-line reason each.
  5. Add a smoke test under tests/local_tests/<model>/ or fastvideo/tests/<role>/ that loads the converted weights and runs a parity assertion against the official reference (1 forward pass).

Cross-Reference

  • fastvideo/layers/AGENTS.md — which native layer to target (fused QKV, parallel MLP, etc.). Determines the split/fuse logic in the converter.
  • fastvideo/models/AGENTS.md — model-side discipline (lint excluded, native state-dict is the source of truth).

Anti-Patterns

  • Hard-coding tensor renames inside the model class instead of the converter.
  • Converting via a private fork of transformers / diffusers weight loaders. Read tensors directly with safetensors or torch.load.
  • Pushing to HF before the validate / smoke test passes locally.
  • Skipping the explicit "skipped keys" list — it documents intent and prevents silent precision loss across re-conversions.