mstar.model.cosmos3.loader#
Weight loading for the Cosmos3 generator backbone.
The published checkpoint is the diffusers transformer/ layout: flat
layers.N.* keys with unfused attention projections (to_q/to_k/to_v for
the understanding pathway, add_q_proj/add_k_proj/add_v_proj for the
generation pathway) and _moe_gen-suffixed GEN MLP/norms. Our backbone
module mirrors that layout one-to-one, so loading needs no key remapping and
no stacked-parameter fusion — only the unused text lm_head is dropped.
Functions
|
Map a checkpoint key to a backbone parameter path, or |
|
Stream the |
|
Return every tensor key declared by the |
|
Return |
- mstar.model.cosmos3.loader.cosmos3_name_remapper(name)[source]#
Map a checkpoint key to a backbone parameter path, or
Noneto drop.Identity for every key the backbone owns;
Nonefor the intentional drop-list. Kept explicit so an unexpected checkpoint key surfaces as a coverage failure rather than being silently ignored.
- mstar.model.cosmos3.loader.load_transformer_weights(model, checkpoint_dir, device='cpu')[source]#
Stream the
transformer/shards intomodeland return loaded keys.Mirrors the meta-device +
load_hf_weightspath the other model packages use, but resolves the shard list from the diffusersdiffusion_pytorch_modelindex (the generic iterator only knows themodel.safetensorsname). No stacked-parameter rules: the checkpoint’s projections are unfused and match the backbone parameter names directly. Raises if any backbone parameter is left unfilled — the completeness guarantee bagel’s loader also enforces.
- mstar.model.cosmos3.loader.read_transformer_weight_keys(checkpoint_dir)[source]#
Return every tensor key declared by the
transformer/shard index.